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, 23.06.2019 00:00
What engine component is shown in the above figure?
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
Where can page numbers appear? check all that apply. in the header inside tables in the footer at the bottom of columns at the top of columns
Answers: 1
question
Computers and Technology, 24.06.2019 08:10
Where are american poets found in the dewey decimal system
Answers: 1
question
Computers and Technology, 24.06.2019 22:10
Function name: poly parameters: int returns: int description: a polynomial of degree n with coefficients a0,a1,a2,a3, . . ,an is the function p(x) = a0+a1x+a2x2+a3 βˆ— x3+ . . +an βˆ— xn this function can be evaluated at different values of x. for example, if: p(x) = 1+2x+ x2, then p(2) = 1+2 βˆ— 2+22 = 9. if p(x) = 1+x2+x4, then p(2) = 21 and p(3) = 91. write a function poly() that takes as input a list of coefficients a0, a1, a2, a3, . . , an of a polynomial p(x) and a value x. the function will return poly(x), which is the value of the polynomial when evaluated at x.
Answers: 3
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
question
Mathematics, 28.04.2021 20:10
question
English, 28.04.2021 20:10
question
Mathematics, 28.04.2021 20:10
question
Spanish, 28.04.2021 20:10
question
English, 28.04.2021 20:10
Questions on the website: 13722367