Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Please use Python to solve this problem HW06 Attached Files: numbers.txt (24 B) Due: Wednesday, October 31st, 11:59 PM Late submissions not accepted. Goals: Process

Please use Python to solve this problem
image text in transcribed
image text in transcribed
HW06 Attached Files: numbers.txt (24 B) Due: Wednesday, October 31st, 11:59 PM Late submissions not accepted. Goals: Process a text file. Introduce exception handling. . Average of Numbers Assume that a file containing a series of integers is named numbers.txt and exists on thecomputer's disk. Write a program that calculates the average of all the numbers stored in the file. 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 readfrom the file are converted to a number . e A20-Point Sample Run: RESTART: C:/Users/Hank Stalica/Desktop/hwo6.py Stalica/Desktop/hw06.py C:/Users/Hank.Stalica/Desktop/hw06.py File IO Error. ssaa RESTART: C:/Users/Hank Failed to convert input to an integer. -a--RE--eae -RESTART : The average of the values in the file is: 34.857142857142854 In the above sample run, there are actually three sample runs in the first, I tried running the program without a numbers.txt file. in the second, the file had the word dog" in it. in the third run, the file was present and contained only integers on separate lines. Hints: Don't forget to close the file when you're done with it . There is no flow chart required 30 MacBook Pro

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students explore these related Databases questions