CBSE Class 11 Informatics Practices Question 33 of 66

Dictionary — Question 5

Back to all questions
5
Question

Question 3(c)

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

del d1(2)  
Answer

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

The corrected code is:

del d1[2]