Question: For Georgia Tech CSE 6040 Notebook 1 Part 2 more_exercise, I got an error for on expected output. Please advise. Exercise 3 (grade_dicts_test: 2 points).

For Georgia Tech CSE 6040 Notebook 1 Part 2 more_exercise, I got an error for  on expected output. Please advise.

Exercise 3 (grade_dicts_test: 2 points). Complete the function build_grade_dicts, again taking grades as a parameter and returning new dictionary, grade_dicts, that maps names of students to dictionaries containing their scores. Each entry of this scores dictionary should be keyed on assignment name and hold the corresponding grade as an integer. For instance, grade_dicts['Thorny']['Exam 1'] == 100. You may find solutions to earlier exercises useful for completing this one. Feel free to use them!

def build_grade_dicts(grades):
   grade_dicts = dict()
   for i in grades[1:]:
       grade_dicts[i[0]] = dict(zip(assignments, [int(j) for j in i[1:]]))    
   return grade_dicts


In [68]: def build_grade_dicts (grades): grade_dicts dict() for i in grades [1:]:
[{"metadata":{"trusted":true,"nbgrader":{"schema_version":1,"grade":false,"solution":true,"locked":false,"grade_id":"grade_dicts"},"collapsed":true},"cell_type":"code","source":"def build_grade_dicts(grades):\n    grade_dicts = dict()\n    for i in grades[1:]:\n        grade_dicts[i[0]] = dict(zip(assignments, [int(j) for j in i[1:]]))    \n    return grade_dicts","execution_count":68,"outputs":[]}]
grade_dicts[i[0]] return grade_dicts = = dict(zip(assignments, [int(j) for j in i[1:]])) The

In [68]: def build_grade_dicts (grades): grade_dicts dict() for i in grades [1:]: grade_dicts[i[0]] return grade_dicts = = dict(zip(assignments, [int(j) for j in i[1:]])) The demo cell below should display {'Thorny': {'Exam 1': 100, 'Exam 2': 90, 'Exam 3': 80}, 'Mac': {'Exam 1': 88, 'Exam 2': 99, 'Exam 3': 111}, 'Farva': {'Exam 1': 45, 'Exam 2': 56, 'Exam 3': 67}, 'Rabbit': {'Exam 1': 59, 'Exam 2': 61, 'Exam 3': 67}, 'Ursula': {'Exam 1': 73, 'Exam 2': 79, 'Exam 3': 83}, 'Foster': {'Exam 1': 89, 'Exam 2': 97, 'Exam 3': 101}} In [69]: grade_dicts = build_grade_dicts (grades) grade_dicts Out [69]: {'Thorny': {'Exam 1': 100, 'Exam 2': 90, 'Exam 3': 80}, 'Mac': {'Exam 1': 88, 'Exam 2': 99, 'Exam 3: 111}, 'Farva': {'Exam 1': 45, 'Exam 2': 56, 'Exam 3': 67}, 'Rabbit': {'Exam 1': 59, 'Exam 3': 67}, 'Ursula': {'Exam 1': 73, 'Exam 3': 83}, 'Foster': {'Exam 1': 89, 'Exam 3': 101}} 'Exam 2': 61, 'Exam 2': 79, 'Exam 2': 97,

Step by Step Solution

3.34 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The error you encountered in the buildgradedicts function may be d... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!