CBSE Class 11 Computer Science Question 56 of 88

Tuples and Dictionary — Question 21

Back to all questions
21
Question

Question 12(j)

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

d1.clears()  
Answer

The correct method to clear all elements from a dictionary is clear(), not clears().

The corrected code is:

d1.clear()