CBSE Class 11 Informatics Practices Question 40 of 66

Dictionary — Question 12

Back to all questions
12
Question

Question 3(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()