value = dict_a.pop(key)
my_dict.pop('key', None)
my_dict = {31: 'a', 21: 'b', 14: 'c'}
print(my_dict.pop(31))
print(my_dict)
# welcome to softhunt.net
# Creating a Dictionary
Dictionary = {0: 'Softhunt', 1: '.net', 2: 'By Ranjeet', 'user': 'Greetings to you'}
print("Dictionary", Dictionary)
# Deleting a key
# using popitem() method
pop_element = Dictionary.popitem()
print('
Dictionary after deletion: ' + str(Dictionary))
print("The arbitrary pair returned is: " + str(pop_element))
# welcome to softhunt.net
# Creating a Dictionary
Dictionary = {0: 'Softhunt', 1: '.net', 2: 'By Ranjeet', 'user': 'Greetings to you'}
print("Dictionary", Dictionary)
# Deleting a key
# using pop() method
pop_element = Dictionary.pop(2)
print('
Dictionary after deletion: ' + str(Dictionary))
print('Value associated to poped key is: ' + str(pop_element))
famous_museums = {'Washington': 'Smithsonian Institution', 'Paris': 'Le Louvre', 'Athens': 'The Acropolis Museum'}
famous_museums.pop('Athens')
print(famous_museums) # {'Washington': 'Smithsonian Institution', 'Paris': 'Le Louvre'}