Question: Modify the program that you wrote for Exercise 6 so it handles the following exceptions: It should handle any IOError exceptions that are raised
Modify the program that you wrote for Exercise 6 so it handles the following exceptions:
• It should handle any IOError exceptions that are raised when the file is opened and data is read from it.
• It should handle any ValueError exceptions that are raised when the items that are read from the file are converted to a number.
Exercise 6
Assume a file containing a series of integers is named numbers.txt and exists on the computer’s disk. Write a program that calculates the average of all the numbers stored in the file.
Step by Step Solution
3.44 Rating (170 Votes )
There are 3 Steps involved in it
To modify the program for Exercise 6 to handle IOError and ValueError exceptions you can use tryexce... View full answer
Get step-by-step solutions from verified subject matter experts
