Question
***MUST BE WRITTEN IN PYTHON** Topics: list, file input/output You will write a program that allows the user to read grade data from a text
***MUST BE WRITTEN IN PYTHON**
Topics: list, file input/output
You will write a program that allows the user to read grade data from a text file, view computed statistical values based on the data, and to save the computed statistics to a text file. You will use a list to store the data read in, and for computing the statistics. You must use functions.
The data:
The user has the option to load a data file. The data consists of integer values representing student grades in a class. The value ranges from 0 to 100. The data is stored in a text file with each value separated by a white space. You may assume that that number of data points in the file will never exceed 1,000.
Descriptive Statistics:
The user has the option to compute statistics on the grade data. Your program will compute the following values:
- Min - the lowest value in the data
- Max -the highest value in the data
- Mean - the average value
- Median the middle value of the sorted values
To compute the median, you must first sort the data. When the data size is odd, theres only one middle value to pick from as the median. When the data size is even, there are two middle values and you can pick either one as the median.
Saving result:
The user has the option to save the statistics to a file. Your program will save the descriptive statistics result to a text file, each value per line. The format as in the sample below:
Min = 35
Max = 100
Mean = 79
Median = 73
Grading:
Points are assigned to different part of the program.
Reading the input file 2 points
Sorting the data 1 point
Min, Max, Mean, Median 4 point
Saving output file 2 points
Comments/Style 1 point
Submission:
You must zip your program and upload in the usual way.If you submit an unzipped file, you will lose 1 point.
Sample run:
Choose an option:
1. Load data
2. Display computed statistics
3. Save computed statistics
4. Exit
Choice: 1
Enter the name of the file: data.txt
Data read successfully.
Choose an option:
1. Load data
2. Display computed statistics
3. Save computed statistics
4. Exit
Choice: 2
Below are the compute values:
Min = 35
Max = 100
Mean = 79.3
Median = 73
Choose an option:
1. Load data
2. Display computed statistics
3. Save computed statistics
4. Exit
Choice: 3
Enter the name of the file: data-stats.txt
Result saved successful.
Choose an option:
1. Load data
2. Display computed statistics
3. Save computed statistics
4. Exit
Choice: 4
Goodbye!
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