CBSE Class 11 Computer Science Question 51 of 88

Tuples and Dictionary — Question 16

Back to all questions
16
Question

Question 12(e)

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

d1.item()
Answer

The correct method to retrieve all key-value pairs from a dictionary is items(), not item().

The corrected code is:

d1.items()