Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete Programming Exercises 6 and 9 (combined as one assignment), 7 and 8 (combined as one assignment), and 12, at the end of Chapter 6

Complete Programming Exercises 6 and 9 (combined as one assignment), 7 and 8 (combined as one assignment), and 12, at the end of Chapter 6 as elaborated on below. For each exercise, submit the .py file. (3 files total to submit).
For the combined #6 and 9, please use the file numbers.txt that came with the source code download from the Course Companion Site. You can edit that file if you like, but then be sure to attach your version of the file (or include a printout) with your submittal. 30 points.
For the combined #7 and 8, please use the name randoms.txt for the text file that you generate (in #7) and read from (in #8). 30 points.
For # 12 please use the steps.txt.
image text in transcribed
image text in transcribed
6. Average of Numbers Assume a file containing a series of integers is named numbers.txt and exists on the compu the file. 7. Random Number File Writer s disk. Write a program that calculates the average of all the numbers stored in e a program that writes a series of random numbers to a file. Each random number Writ should be in the range of 1 through 500. The application should let the user specify how many random numbers the file will hold. 8. Random Number File Reader This exercise assumes you have completed Programming Exercise 7, Random Number File Writer. Write another program that reads the random numbers from the file, displays the numbers, then displays the following data: . The total of the numbers . The number of random numbers read from the file 9. Exception Handing Modify the program that you wrote for Exercise 6 so it handles the following exceptions: e It should handle any I0Error 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 6. Average of Numbers Assume a file containing a series of integers is named numbers.txt and exists on the compu the file. 7. Random Number File Writer s disk. Write a program that calculates the average of all the numbers stored in e a program that writes a series of random numbers to a file. Each random number Writ should be in the range of 1 through 500. The application should let the user specify how many random numbers the file will hold. 8. Random Number File Reader This exercise assumes you have completed Programming Exercise 7, Random Number File Writer. Write another program that reads the random numbers from the file, displays the numbers, then displays the following data: . The total of the numbers . The number of random numbers read from the file 9. Exception Handing Modify the program that you wrote for Exercise 6 so it handles the following exceptions: e It should handle any I0Error 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

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions