Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3: Grades Write a function, final_grade_ranking that takes two inputs: a dictionary (containing students as keys and a list of grades of length n) and
3: Grades Write a function, final_grade_ranking that takes two inputs: a dictionary (containing students as keys and a list of grades of length n) and a set of weights for each assignment (the set of weights is also of length n). The output is a list of pairs (students names, grade) sorted by the weighted average. For example, here if there were three assignments, and four students the dictionary might be given by grades and the weights by weights , in the cell below. The weights can be thought of as percentages. The output should be [('terri', 51), ('sherry', 54), ('kerry', 75), ('jerry', 78), ('harry', 79)] Hint: Construct a function final_grade that calculates a final grade from the list of assignments and the weights. Then, use that function in the final_grade_ranking as the key on which to sort the list. In [ ]: grades = { 'terri': [55,90,10], 'kerry': [88,66,77], 'sherry': [70, 90,10], 'jerry': [90, 60, 90], 'harry': [0, 100, weights [20,40,40] = In [ ]
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