Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started