QUESTION 5
10 points
Save Answer
G. Given a dictionary where the key is a student name and the value is a list of the major and a nested list of grades. For example graDict = {'Adam':
['Cyber', [70, 75, 87, 77]]).
26-28 [10pts]) Write a Python code segment that do with the data used in Example 4.6 and add the total and average at the end of each nested list. For example, the above
dictionary will be {'Adam': ['CS', [70, 75, 87, 77], [309, 77.25]]). Fill in the blank.
for stud in graDict.
sum = 0
grades = graDict[stud][
size = len(grades)
for scor in
sum += scor
avgG = sum/size
avg = float("{:.2f}".format(avgG))
graDict[stud].append([sum, avg])
For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac).