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
erastovalidia [21]
3 years ago
6

Write a program that asks the user for the name of a text file. The program should display the first 10 lines of the file on the

screen. If the file has fewer than 10 lines, the entire file should be displayed along with a message indicating the entire file has been displayed.
Computers and Technology
1 answer:
tangare [24]3 years ago
5 0

Answer:

Written in Python

filenm = input("File name: ")

myfile = open(filenm+".txt")

for i in range(10):

     line = myfile.readline()

     print(line)

print("End of file")

Explanation:

This line prompts user for file name

filenm = input("File name: ")

This line creates an instance of the file

myfile = open(filenm+".txt")

This line iterates through the 10 lines

for i in range(10):

This line reads the line

     line = myfile.readline()

This line prints each line

     print(line)

This line prints a message indicating that all possible lines have been printed

print("End of file")

You might be interested in
Which type of element is , and what is the meaning of that element ?
tester [92]

Can you show a picture other than asking a question without context

6 0
4 years ago
Describe security risks associated with downloading items online
AURORKA [14]

Answer:

1. Hackers could get information and sell it. 2. Hackers can get a hold of your files online. 3. Hackers can look at your photos. Download a VPN

8 0
3 years ago
Omar’s teacher has asked him to send her a PDF copy of his presentation via email.
Vadim26 [7]

Answer:

1. Export

2. Create PDF/XPS document

3. Standard

4. Click Publish

Explanation:

I got wrong on edg and found the correct answer

8 0
3 years ago
Which device stores data only temporarily, and only when the computer is running?
Artist 52 [7]
1. C) RAM

2. C) CPU

3. B) Accounts Payable

I believe these are the correct answers you are looking for.

8 0
4 years ago
A certain audio compact disc (cd) contains 783.216 megabytes of digital information. each byte consists of exactly 8 bits. when
kakasveta [241]
You are not putting the question but I can guess that it asking for the CD duration. To answer this question, you need to convert the CD capacity unit(783.216 megabyte) into megabits which were used for the cd read rate (1.4 megabits/s). The calculation would be:

CD duration: CD capacity / rate= 783.216 megabytes *(8 megabits/megabyte) / (1.4 megabits /s)= 4475.52 second or 74.6 minutes
3 0
4 years ago
Other questions:
  • You try to enter your name into a cell that accepts a numeric value. What error would you receive
    12·2 answers
  • How is steering different from turning ? Need help //:
    13·1 answer
  • Methods can be ____ correctly by providing different parameter lists for methods with the same name.
    7·1 answer
  • An aircraft departs an airport in the mountain standard time zone at 1615 MST for a 2-hour 15-minute flight to an airport locate
    14·1 answer
  • Please help with the question no. 5 and 7 please help ​
    6·1 answer
  • What is the purpose of a Macro in Word?: *
    13·1 answer
  • Which platform is the best? (X-box, PC, Playstation, Nintendo Switch, Wii)
    10·1 answer
  • What is the most secure method for controlling privileged access to a system available for use in a public area?a. Database view
    5·1 answer
  • Explain why it is wise to remember your social security number
    15·2 answers
  • Write a function that receives three StaticArrays where the elements are already i n sorted order and returns a new Static Array
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!