Write a python program to Remove the Given Key from a Dictionary


Topic: Write a python program to Remove the Given Key from a Dictionary

Solution

d = {'a':1,'b':2,'c':3,'d':4}
key= 'd'
if key in d: 
    del d[key]
else:
    print("Key not found!")
    exit(0)



List all Python Programs