subject

Write a python program that allows the user to navigate through the lines of text in a file. the program prompts the user for a filename and inputs the lines of text into a list. the program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. actual line numbers range from 1 to the number of lines in the file. if the input is 0, the program quits. otherwise, the program prints the line associated with that number.

it should be like as this sample run follows.

enter the input file name: quotes. xtxt
i cannot open the file quotes. xtxt - check the name and try again.
enter the input file name: quotes. txt
the file has 16 lines.
enter a line number [0 to quit]: 1
1 : hakuna matata!
enter a line number [0 to quit]: -1

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:00
Explain briefly why you cannot expect to find a previous version of every file with which you work.
Answers: 1
question
Computers and Technology, 22.06.2019 15:30
Why would a programmer use the logical operator and in an if statement? a: when an action is to be taken that requires both conditions to be falseb: when an action is to be taken that requires both conditions to be truec: when an action is to be taken that requires the first condition to be falsed: when an action is to be taken that requires the second condition to be truei took the test and the answer is b.
Answers: 3
question
Computers and Technology, 23.06.2019 12:00
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
What are the 12 colors of the spectrum called?
Answers: 1
You know the right answer?
Write a python program that allows the user to navigate through the lines of text in a file. the pro...
Questions