Question: BlockPy: #427) Sum Dictionary The following function sum_dictionary is meant to consume a dictionary of lists and return a dictionary of numbers representing the sum

 BlockPy: #427) Sum Dictionary The following function sum_dictionary is meant to

BlockPy: #427) Sum Dictionary The following function sum_dictionary is meant to consume a dictionary of lists and return a dictionary of numbers representing the sum of the elements in the list. For example, in the function call below, the dictionary "Module 1": 23, "Module 2": 22, "Module 3": 31 should be returned. However, the function definition has had all of its code moved to before its definition. Rearrange the lines of code before the definition to be inside the definition, and correct their indentation. Do not add, remove, or change any of those lines. Console Feedback: 'Module 3': 2) UnboundLocalError: local variable 'new Srw$ refe on line 11 UnboundLocalError Run 11 Blocks ++ Split! /Text| Reset Upload- E History 1 for key, values in a_dictionary.items): 3 for value in values: 4 new[key] = e 5 new[key]new[key value 6 return new 7 def sum_dictionary(a_dictionary): pass 1e print sum_dictionary( "Module 1": [1e, 5, 3, 5], Module 2": [7, 3, 4, 5, 3] "Module 3": [1e, 12, 4, 3, 2] 14 ))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!