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:]: 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
Step: 1
The error you encountered in the buildgradedicts function may be d...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