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]
3 years ago
8

Write a program that Read first n lines of file

Computers and Technology
1 answer:
sergejj [24]3 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
Describe accessibility in Windows 7 ​
satela [25.4K]

Answer:

Accessibility is the epitome of usability and was a key tenet throughout the engineering of Windows 7. ... Windows 7 includes accessibility options and programs that make it easier to see, hear, and use your computer including ways to personalize your computers and use keyboard shortcuts.

7 0
2 years ago
Provide the instruction type, assembly language instruction, and binary representation of instruction described by the following
Rudik [331]

Answer:

Explanation:

Its a R-type instruction:

 31        25 24     20 19     15 14  12 11      7 6           0

+------------+---------+---------+------+---------+-------------+

| funct7     | rs2     | rs1     |funct3| rd      | opcode      |

+------------+---------+---------+------+---------+-------------+

Assembly Language Instruction:

sub rd, rs1, rs2    || 0x0 0x20   || R[rd] ← R[rs1] - R[rs2]

Binary Conversion:

R-TYPE  funct7        rs2           rs1        funct3      rd        opcode  

Bits           7              5              5             3           5             7

Binary   100000    00101      00111       000     00110     0110011

So Binary representation for this is: 0100 0000 0101 0011 1000 0011 0011 0011

5 0
3 years ago
What is motivation and state the two forms​
pav-90 [236]
It is extrinsic Motivation
3 0
3 years ago
Which of the following is not a valid FICO Credit score?
kumpel [21]

Answer: C 475

Explanation:  These choices are A. 375, B. 276, and D. 575. so that wolde mean it would be C 475.

8 0
3 years ago
Read 2 more answers
Zola is very skilled with Microsoft and Apple, and she knows different methods of programming. This knowledge will help make Zol
hammer [34]
I believe programmer would be your answer! If there is a multiple choice, please tell me in the comments of this answer!
3 0
3 years ago
Read 2 more answers
Other questions:
  • Hardy doesn't have access to a work template, which is on the network server. What should he do?
    14·1 answer
  • Which language is the most popular language for writing apple os x?
    9·1 answer
  • Write a python program that requests a word (with lowercase letters) as input and translates the word into pig latin. The rules
    15·2 answers
  • The jailbreak property that, if the user turns the device off and back on, the device will start up completely, and the kernel w
    15·1 answer
  • A DESKTOP COMPUTER (NAMED WORKSTATION22) CAN'T CONNECT TO THE NETWORK. A NETWORK CARD WAS PURCHASED WITHOUT DOCUMENTATION OR DRI
    14·1 answer
  • Describe at least three virus scanning techniques
    13·1 answer
  • Is there anyone that knows how to work in Microsoft Access and someone that could help me on my test at 11 30am?​
    7·1 answer
  • What sort of query is (strbucks]?
    14·1 answer
  • Code: ckg-jbqp-hki<br>only girls join❤️​
    11·2 answers
  • True or False? Popular sites are always mean accurate.
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!