Questions & AnswersPython Programming

grades = [    # First line is descriptive header. Subsequent...

Question
Asked by wakinbami on coursehero.com

# grades = [    # First line is descriptive header. Subsequent...

# First line is descriptive header. Subsequent lines hold data
['Student', 'Exam 1', 'Exam 2', 'Exam 3'],
['Ken', '100', '90', '80'],
['Pat', '88', '99', '111'],
['Sam', '45', '56', '67'],
['Jon', '59', '61', '67']
]

Question:
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['Ken']['Exam 1'] == 100.

My Solution so far:
CODE:
###
### YOUR CODE HERE
###
for L in grades[1:]:
grade_dicts[L[0]] = dict(zip(assignments, [int(g)
for g in L[1:]]))

My Output:
{'Ken': {'Exam 1': 100, 'Exam 2': 90, 'Exam 3': 80}}

What I should be getting:
{'Ken': {'Exam 1': 100, 'Exam 2': 90, 'Exam 3': 80},
'Pat': {'Exam 1': 88, 'Exam 2': 99, 'Exam 3': 111},
'Sam': {'Exam 1': 45, 'Exam 2': 56, 'Exam 3': 67},
'Jon': {'Exam 1': 59, 'Exam 2': 61, 'Exam 3': 67}}

## Answer & Explanation

Solved by verified expert
Answered by thecodersatish on coursehero.com
``sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem i``

10,000 step-by-step explanations

<pre><code class="language-python">sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipis</code></pre>

## Step-by-step explanation

sectetur adipiscing elit. Nam

sect

sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a m

sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante

## Get unstuck with a CliffsNotes subscription

Unlock every step-by-step explanation, download literature note PDFs, plus more.