Question: Use Practice 2 Program - Reading Files as a start. Modify the program to do the following: Request the data file name from the

Use Practice 2 Program - Reading Files as a start. Modify the  program to do the following: Request the data file name from theuser. Use a try-except statement to detect errors when opening the file.

Use Practice 2 Program - Reading Files as a start. Modify the program to do the following: Request the data file name from the user. Use a try-except statement to detect errors when opening the file. Report any errors to the screen. Download the file sales error-1.txt to use as an input file. Use try-except to detect bad data in the input file. Report it to the screen and skip over bad values. Total and average the remaining good data and display results. Sample Output: This program will total and average numbers in your data file. Enter the name of your data file: sales Unable to access the file: sales. Process finished with exit code 0 This program will total and average numbers in your data file. Enter the name of your data file: sales_error-1.txt 13,420.22 45,229.32 35,223.22 29,302.20 95,893.21 94,721.94 Line 7 with a value of 84720.32 was invalid. 84,793.02 10,394.21 30,233.33 23,432.32 Total: Number of entries: Average: 462,642.99 10 46,264.30 Process finished with exit code 0 1 2 3 4 LO 5 a 7 8 9 10 11 12 13 sales_error-1.txt PROGRAMMING LOGIC PRG-105-001N Assignments Chapter 06 Assessment Program Logic - Files and Exc Download Info Close 13420.22 45229.32 35223.22 29302.20 95893.21 94721.94 84720.32 84793.02 10394.21 30233.33 23432.32 ZOOM +

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!