Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code this as in python and dont do print out statements to look like this problem i need an actual code that does this program
code this as in python and dont do print out statements to look like this problem i need an actual code that does this program ... please code with the right intendation.
CSc 120: Update a 2-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: . Alist-of-lists L is a list where each element L[ someidx) is itself a list; and LIaomeidx) 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 DI somekey]Ianotherkey] gives us a value stored in the two-level dictionary D. In this example, somekey is called the first-leve key and anotherkey is called the second-level key. In the examples below, DD is assumed to be the following two-level dictionary: bbb' Cstring4, ddd string5 ece 'string6, 'Estring'. ccc { .aaa . ; .string 8., .bbb. ; .string9. } Thus, we have: DD bbb' cec' is the value string4', while DD ccbbb' is string9 Expected Behavior Write a function update dict2(dict2, keyl, key2, value), where diet2 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[key1key21. This function should return a dictionary obtained by updating dict2 such that in the resulting dictionary, which we refer to as newdictz, the following holds newdict2[ key1keyz- value. Examples DD is the two-level dictionary shown above (under Definitions) 1. update dict2 (DD, 'aaa,'cce,12) return value: 2. update_dict2 (DD, 'aaa', 9g,string17) return value: 3. update dict2(DD, 'ggg', 'aaa, 'string17") return valueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started