Question: this is supposed to be in python 3 Definitions A two-level dictionary is analogous to a list-of-lists (aka 2D-list), except that it involves dictionaries rather

this is supposed to be in python 3this is supposed to be in python 3 Definitions A two-level dictionary

Definitions A two-level dictionary is analogous to a list-of-lists (aka "2D-list), except that it involves dictionaries rather than lists . A list-of-lists L is a list where each element L[someidx) is itself a list, and L[someidx] [anotheridx] gives us a value stored in L Analogously, a two-level dictionary D is a dictionary-of-dictionaries: D[somekey ] is itself a dictionary, and D[somekey ] [anotherkey ] gives us a value stored in the two-level dictionary D. In this example, somekey is called the first-level key and anotherkey is called the second-level key. In the examples below, DD is assumed to be the following two-level dictionary: Thus, we have: DDl bbb 1l ccc' is the value 'string4', while DDI'ccc'1l bbb'1 is string9 Expected Behavior Write a function update dict2 (dict2, key1, key2, value), where dict2 is a two-level dictionary; key1 is the first-level key; key2 is the second-level key; and value is a value to be stored at dict2[key1 [key21. This function should return a dictionary obtained by updating dict2 such that in the resulting dictionary, which we refer to as newdict2, the following holds: newdict2[keyl]key2]value

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!