CBSE Class 11 Informatics Practices Question 35 of 66

Dictionary — Question 7

Back to all questions
7
Question

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