Question: using python Write a function that takes a dictionary and a list of keys as 2 parameters. It removes the entries associated with the keys
using python

Write a function that takes a dictionary and a list of keys as 2 parameters. It removes the entries associated with the keys from the given dictionary Your function should not print or return anything. The given dictionary should be modified after the function is called Note: it means that you can't create another dictionary in your function. Since dictionaries are mutable, you can modify them directly def remove_keys (dict, key_list) "" "Remove the key, value pair from a given list: >>>d"keyl" "valuel", "key2" "value2", "key3" :"value3", "key4": "value4" >> keys-"keyl", "key3","key5" >>>remove keys (d, keys) >>>print (d) 'key2' 'value2','key4': 'value4' >>>d11:1, 2: [, 3, "key3": ["vl", "v2") >>>keys [2.0] >>> remove_keys (d, keys) >>print (d) (1: 1, 'key3': ['v1", 'v2')) >>>d 'a': 7, 7: 'a', 'seve >> keys-['a', 7, 'seventy >>>remove keys (d, keys) >>>print (d) "seven' 'a','7':'7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
