# Using the pop() method removed_value = my_dict.pop('city') print(removed_value) # Output: New York print(my_dict) # Output: {'name': 'Alice', 'age': 26, 'email': '
[email protected]'} # Using the del statement del my_dict['email'] print(my_dict) # Output: {'name': 'Alice', 'age': 26} # Using the popitem() method (removes the last inserted key-value pair) my_dict.popitem() print(my_dict) # Output: {'name': 'Alice'}