Question: Needs Python 3.4.2 to answer this assignment: Number Stats Programming Assignment In this programming assignment you are to create a program called numstat.py that reads
Needs Python 3.4.2 to answer this assignment:
Number Stats Programming Assignment
In this programming assignment you are to create a program called numstat.py that reads a series of float numbers from a file and determines and displays the following
- The name of the file.
- The sum of the numbers.
- The count of how many numbers are in the file.
- The average of the numbers. The average is the sum of the numbers divided by how many there are.
- The maximum value.
- The minimum value.
- The range of the values. The range is the maximum value minus the minimum value.
- The grade distribution of the values (How many As, Bs, Cs, Ds, Fs. eg. anything about 90 is an A)
The program is to prompt the user for the name of the file that contains the numbers. If an exception occurs trying to open or read the file an error message is to be displayed. The program is not to crash if the file is not found or there is an error reading the file. Use try-except!
You are NOT allowed to use max(), min(), sum(), or len() in getting any of these values.
The output from the program is to display the information described above using the following strings preceding the values. There is to be a space between the colon and the value.
For this Grade Distribution case I have a file of grades that I want stats on. If the range of the numbers Max =< 100 and Min >= 0 then execute the grade distribution. For example, if I have a file with numbers that range from -100 -> 1000 Im unlikely trying to calculate grades.
Red Only prints when The numbers range from 0-100
File name: Sum: Count: Average: Maximum: Minimum: Range: Grade Distribution: As:
Bs: Cs: Ds: Fs:
Number Stats Programming Assignment
At the end of one attempt at reading, or a successful read, of a file the user it to be asked if they would like to evaluate another file of numbers. Use the prompt: Would you like to evaluate another file? (y/n) If the user answers y, then the program is to accept input for another file name. If the user answers with anything other than y, the program is to exit.
Testing
Once you have written your program you need to test it. A sample file called numbers.txt containing a list of integers is provided for testing. It is contained in a file attached to the assignment called numbers.txt.zip. You must unzip the file to get the numbers.txt file. You can also hand create files or use the random number writer from the programming assignment in module 5 to create files for testing.
The numbers.txt file, or any other test file containing numbers, needs to be in the same directory as the python program for it to be found.
For the provided numbers.txt file the following are the values your program should generate:
Sum: 56110 Count: 100 Average: 561.1 Maximum: 995 Minimum: 8 Range: 987
For the provided numbersg.txt file the following are the values your program should generate: Enter the name of the file you would like to process: numbersg.txt
File name: numbersg.txt Sum: 11393.139999999998 Count: 127 Average: 89.70976377952753 Maximum: 100.0 Minimum: 0.0 Range: 100.0 Grade Distribution: A's: 84 B's: 30 C's: 9 D's: 1 F's: 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
