CBSE Class 11 Computer Science Question 49 of 88

Tuples and Dictionary — Question 14

Back to all questions
14
Question

Question 12(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]