Question: Please read question carefully before you post an aswer. It must follow all guidelines. The Problem Design a program that generates 100 random numbers between
Please read question carefully before you post an aswer. It must follow all guidelines.
The Problem
Design a program that generates 100 random numbers between 1-1000 and writes them, one per line, to an output file. Change the status of the file to an input file and read the numbers into a list. Determine the following:
The largest number in the list.
The smallest number in the list.
The average of the numbers.
The total of the numbers.
The Assignment
Write pseudo-code and a Python program that contains modules/functions as follows:
Module main. Calls the functions writeFile, readFile, and statFile. Declare all necessary variables.
Module writeFile. Uses a loop to generate 100 random numbers between 1-1000. Each number should be written to a file called numbers.dat. Display a message indicating all numbers have been generated and written to a file.
Module readFile. Reads all numbers from the file into a list called numbers. numbers should be returned to the main function and assigned to a variable.
Module statFile. Traverses the list to determine and display the largest number, the smallest number, the average of the numbers, and the total of the numbers.
A Python program that provides an implementation of the pseudo-code to provide a solution to the problem. You should write and run your program using Python 3.x.
Programs will be graded based on the following:
Correctness of each module (including Module main()), including comments, declarations, spacing and correct logic. (5 points each). There should be pseudo-code for each module.
Parallel structure of pseudo-code and the Python program (10 points)
Success of your program, (5 points)
Sample Input/Output
100 random numbers have been generated and written to an output file.
The largest of the numbers is 771. The smallest number is 8. The total of the numbers is 45827. The average of the numbers is 463.
Results will differ for each execution of the program because they numbers are randomly generated.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
