Download the Section Data Files (attached), unzip and extract all files, and save them in a folder.
Use the IDLE editor to write a Python program that does the following:
Opens and reads a text file.
Uses a loop to calculate the average of the numbers in the file.
After the loop, displays the number of scores in the file and the average.
Test your program with the Section1.txt file, and then run the program again with the Section2.txt file.
Add exception handling to the program.
Run your program again using the Section3.txt file (which contains an error in the data) to make sure your program handles the ValueError exception.
Test IOError exception handling by changing the name of the file in your program to something that does not exist.
Hand-calculate the results for each file to make sure your results are correct.
Zip the folder (which must contain your program and all .txt files) and submit it to this assignment.
Get Free Quote!
296 Experts Online