Question: Write a function grade_stats that accepts as a parameter a list representing the grades given in a course and returns a dictionary mapping each
Write a function grade_stats that accepts as a parameter a list representing the grades given in a course and returns a dictionary mapping each grade to the count of how many were given. For example, if a list grades contains the following: ['A', 'I', 'C', 'C', 'E', 'B', 'A', 'E', 'E', 'A', 'B', 'B', 'B'] The call of grade_stats (grades) should return the following dictionary: {'A':3, 'I': 1, 'C':2, 'E':3, 'B':4} Note that the grades may not always be A, B, C, D, E and I. For example, A- is a valid grade some places as is 3.7. You should treat whatever is in the passed in list as a valid grade. If the passed in list is empty, your function should return an empty dictionary.
Step by Step Solution
3.46 Rating (172 Votes )
There are 3 Steps involved in it
The detailed answer for the above question is provided below Sorting S... View full answer
Get step-by-step solutions from verified subject matter experts
