Modify the program that you wrote for Exercise 6 so it handles the following exceptions: It

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 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.

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

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: