CBSE Class 11 Informatics Practices Question 36 of 66

Dictionary — Question 8

Back to all questions
8
Question

Question 3(f)

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

d1.key()
Answer

The correct method to retrieve all keys from a dictionary is keys(), not key().

The corrected code is:

d1.keys()