Question: Write 3 functions in the starter code below such that: add to_dictl: takes a dictionary, a key, a value and adds the key value pair








Write 3 functions in the starter code below such that: add to_dictl: takes a dictionary, a key, a value and adds the key value 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 dictionary.. Hint: Use try-except. tind-key(dictt, key): takes dictionary and key and prints value coresponding to the key trom the dictionary, printrvalue", value). It key is not tound, then prints: .Key not tound." Hint: Use try-except
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
