1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
dezoksy [38]
2 years ago
8

Write a program that Read first n lines of file

Computers and Technology
1 answer:
sergejj [24]2 years ago
7 0

Answer:

Python 2:

with open("datafile") as myfile:

   head = [next(myfile) for x in xrange(N)]

print head

Python 3:

with open("datafile") as myfile:

   head = [next(myfile) for x in range(N)]

print(head)

Both Python 2 & 3:

from itertools import islice

with open("datafile") as myfile:

   head = list(islice(myfile, N))

print head

You might be interested in
You need to deploy a new cloud-based windows intune deployment to manage mobile devices in your organization. drag and drop the
Elena L [17]

Answer:

step 1: sign up for an intune account

step 2: create intune user accounts

step 3: define intune policies

step 4: enroll mobile devices

step 5: link mobile devices to users.

Explanation:

The Microsoft Windows intune is a Microsoft cloud-based service that provides a central cloud service for all subscribed and linked devices. It provides a sense of security of data resource and tracking of device activities.

A company subscribes to intune to allow the use of both cooperate and BYOD (bring your own device to work), to access data. First, the administrator sign up and create the intune account, then defined the intune security policies. Then it enrolls the individual devices and links them to their respective users.

3 0
3 years ago
What is the memory of a computer called
Nataliya [291]
It is called Ram in another term for memory :)
6 0
3 years ago
Read 2 more answers
Microsoft word's spell checker
natka813 [3]
A, will also check word usage
7 0
3 years ago
Read 2 more answers
Which of the following statements concerning a short in a series circuit is true?
Romashka [77]

Answer:

what is the answers it gave you?

6 0
2 years ago
Distributed computing is a term that describes the work that autonomous computers can do to achieve a common goal, especially in
Bond [772]

Answer:

To find the solution of Global warming, to find the combination of some drugs and test them, etc.

Explanation:

Distributed computing can be described as when a number of computers connected on the network communicate with each other by passing messages, and these systems are known as distributed systems.

There are various goals that can be accomplished using distributed computing, one of them is to find the solution of Global warming, by coordinating with different areas.  

Another one is to find the combination of some drugs and test them to make new medicine.

7 0
3 years ago
Other questions:
  • What year did buck tooth bob become famous
    11·2 answers
  • The Status bar is used to control the majority of the drafting settings in AutoCAD
    13·1 answer
  • A _____ defines what must take place, not how it will be accomplished.​
    12·1 answer
  • Which of the following is the correct ordering of operating systems, oldest to newest?
    5·2 answers
  • During prereading, it is not important to pay attention to visual aids.<br> T f
    15·2 answers
  • Research the topic of legal and ethical behaviors or dilemmas related to technology. Identify five topics of concern and briefly
    9·1 answer
  • When you insert a photo into a document, its placed at the ​
    13·2 answers
  • Describe FIVE distinct features of multi-threaded programming. Your answer should be language independent. g
    9·1 answer
  • Coding with Loops Worksheet
    13·2 answers
  • The other term for template document is _______.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!