Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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


image
[{"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":[]}]
image

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

find all matrices A (a) A = 13 (b) A + A = 213

Answered: 1 week ago