Question: 9.8LAB: Input-Output Exceptions: Getting a Valid File In this exercise you will continue with exception processing for file input-output. You should extend the program developed

9.8LAB: Input-Output Exceptions: Getting a Valid File

In this exercise you will continue with exception processing for file input-output. You should extend the program developed in lab 9.7 that includes exception handling for non-existent files. To do this, you will need a loop that continues to prompt the user for file names until a valid file name (when opening it) occurs. In this case, your try-except will be inside the loop.

(1) Make sure that your program works correctly with "data.txt". (2pts)

(2) Test your program with the loop and a try-except to handle an incorrect name of a file name and continue to prompt the user until a valid file is entered. (8 pts)

For example, if you enter the name of a file "data", your program should output:

Enter name of file: File data not found. Enter new file name: File to be processed is: data.txt Average weight = 164.88 Average height = 69.38 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!