Question
You have been asked by your professors to write a small Python script to help them analyze assignments for their course. Luckily for you, they
You have been asked by your professors to write a small Python script to help them analyze assignments for their course. Luckily for you, they only want to analyze a single assignment at a time. They also store all their grading data in CSV files, which you happen to know how to work with!
You will be provided with three CSV files, named in this format:
Assignment#_grades.csv
Each will have data in the following form (data randomly generated using http://www.convertcsv.com/generate-test-data.htm)
Student | Grade |
Mitchell Figuson | 22 |
Jordan Warren | 82 |
Matthew Yates | 67 |
Jerome Gill | 5 |
In the final reports, the professor does not want the student names. However, for each class, the professor wants you to calculate the following:
The average grade on the assignment
The highest and lowest grade on the assignment
A histogram of the letter grades, using a typical A to F grading scale as used by most classes. Save it as a dictionary
Your script should be written to accept the csv file being used as input and then print out the stats to the console. The grade histogram should be pickled into a file called grade_hist.pickle. A sample of the first files output is given, while the other two are not provided.
If the file doesnt exist, kindly inform the user the file doesnt exist and exit the program.
Note that the max,min, and average should be calculated efficiently. It is better to use a function than to write your own loop!
Sample from Assignment3_grades.csv
You have been asked by your professors to write a small Python script to help them analyze assignments for their course. Luckily for you, they only want to analyze a single assignment at a time. They also store all their grading data in CSV files, which you happen to know how to work with!
You will be provided with three CSV files, named in this format:
Assignment#_grades.csv
Each will have data in the following form (data randomly generated using http://www.convertcsv.com/generate-test-data.htm)
Student | Grade |
Mitchell Figueroa | 24 |
Jordan Ward | 82 |
Matthew Yates | 67 |
Jerome Gill | 5 |
In the final reports, the professor does not want the student names. However, for each class, the professor wants you to calculate the following:
The average grade on the assignment
The highest and lowest grade on the assignment
A histogram of the letter grades, using a typical A to F grading scale as used by most classes. Save it as a dictionary
Your script should be written to accept the csv file being used as input and then print out the stats to the console. The grade histogram should be pickled into a file called grade_hist.pickle. A sample of the first files output is given, while the other two are not provided.
If the file doesnt exist, kindly inform the user the file doesnt exist and exit the program.
Note that the max,min, and average should be calculated efficiently. It is better to use a function than to write your own loop!
Sample from Assignment3_grades.csv
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