Write a program that asks the user for the name of a file. The program should read

Question:

Write a program that asks the user for the name of a file. The program should read all of the file’s data into a list and display the number of lines of data that the file contains, and then ask the user to enter the number of the line that they want to view. The program should display the specified line.

The program should handle the following exceptions by displaying an error message:

• IOError exceptions that are raised when the specified filename cannot be found or opened.

• ValueError exceptions that are raised when a non-integer value is given as a line number.

• IndexError exceptions that are raised when the line number is outside the range of the data list.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question
Question Posted: