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
If your computer system is not working correctly, you can use System Restore to return the ___________ ____________ to an earlie
Luden [163]

You can use System Restore to return the computer file history to an earlier point in time.

Explanation:

System Restore allows you to recover documents/files that may have been deleted if your computer is not operating as it should be. Therefore, the answer is "computer file history".


Hope this helps!

7 0
4 years ago
What is the smallest negative integer that can be represented in two's complement system in which each value is represented by e
olga nikolaevna [1]

Answer:  Two's complement is a mathematical operation on binary numbers, and is an example of a radix complement. It is used in computing as a method of signed number representation.

8 0
3 years ago
What movie would be greatly improved if it was made into a musical?
Lina20 [59]
Sixteen candles would be even better if it was a musical
3 0
3 years ago
Richard wants to create a cloud-based system that will be a centralized repository of log files from various servers in the orga
jeyben [28]

Answer:

CAD ( d )

Explanation:

Richard should use CAD to create a cloud-based system, since he wants it to be a centralized repository of log files to be taken from the different servers associated with the organization

CAD ; Computer aided design software is the best software to be used because files created using CAD can be easily stored in cloud and it is easily accessible.

4 0
3 years ago
8.9 Lesson Practice edhesive
lapo4ka [179]
Is what it is so it can’t be what it isn’t
6 0
3 years ago
Read 2 more answers
Other questions:
  • Question 1
    9·1 answer
  • The Earth's _______ is ductile overall, tending to flow very slowly and deform in a _______ manner.
    14·2 answers
  • Write methods to do the following: a. Display three full lines of asterisks on the screen. b. Accept as an argument your name, a
    5·1 answer
  • Which of the following is a set of short-range wireless technologies used to share information among devices within about two in
    8·1 answer
  • _____emphasizes on proper breathing and the mind-body-spirit connections.​
    6·2 answers
  • Create the logic for a game that simulates rolling two dice by generating two random numbers between 1 and 6 inclusive. The play
    7·1 answer
  • How long does it take to go 80 miles if you are going 80 mph?
    8·2 answers
  • sunglasses sunglasses sunglasses sunglasses sunglasses sunglasses sunglasses sunglasses sunglasses sunglasses i am a failure sun
    7·2 answers
  • Fix the two words that are used incorrectly.
    10·2 answers
  • Sidney needs to create a decimal number variable that will be added to another number. What kind of variable is required?binaryB
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!