Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedcode 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 value

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics Of A Networked World Semantics For Grid Databases First International Ifip Conference Icsnw 2004 Paris France June 2004 Revised Selected Papers Lncs 3226

Authors: Mokrane Bouzeghoub ,Carole Goble ,Vipul Kashyap ,Stefano Spaccapietra

2004 Edition

3540236090, 978-3540236092

More Books

Students also viewed these Databases questions