My dictionary looks like this:
my_dict = {
'0': ['1'].
'3': ['2'].
'1': ['0', '9', '3'].
'4': ['1', '4'].
}
User will input a key and value. My function will delete that value from key, value pairs.
def deleteVal (my_dict, key_val, val):
# write your function here
If any user removes a value from a key-value pair that has only 1 value, it will remove the entire key. For example: if user remove value 1
from 0
, the function will delete entire 0
key as it doesn't have any value left.
How can I do that?