KnowledgeBoat Logo
|

Informatics Practices

Find errors and rewrite the same after correcting the following code:

del d1(2)  

Python Dictionaries

1 Like

Answer

In Python, to delete an element from a dictionary, we should use square brackets [], not parentheses ().

The corrected code is:

del d1[2]

Answered By

1 Like


Related Questions