81.4k views
2 votes
You use _________ to delete an element from a dictionary.

erase
delete
del
remove

1 Answer

4 votes

Final answer:

To delete an element from a dictionary in Python, you use the del keyword.

Step-by-step explanation:

To delete an element from a dictionary in Python, you use the del keyword. By specifying the key of the element you want to delete, you can remove it from the dictionary. Here's an example:

my_dict = {'a': 1, 'b': 2}

del my_dict['a']

print(my_dict) # Output: {'b': 2}

User Mrebval
by
6.9k points