Question: Wire 3 functions in the starter code below such that: add_to_dict takes a dictionary, a key, a value and adds the key ve pair to
Wire 3 functions in the starter code below such that: add_to_dict takes a dictionary, a key, a value and adds the key ve pair to the dictionary. If key is already in dictionary then it displays the error message: "Error Key already exists. Returns dictionary remove_from_dict takes a dictionary and key and removes the key from the dictionary, Returns dictionary. If no such key is found in the dictionary then it prints "No such key exists in the actionary. Hint Use try except ind keylakett keyk takes dictionary and key and prints value corresponding to the key from the dictionary: pex"Value: " value. It key is not found then prints Key not found Hint Use try except Example: Menu add a remover indika Key rich Value: 1 Morelly Menu add a remover, tinata Key Meza Value 2 More linn alireza, 21. trich
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
