Informatics Practices
Find errors and rewrite the same after correcting the following code:
d1.item()
Python Dictionaries
1 Like
Answer
The correct method to retrieve all key-value pairs from a dictionary is items(), not item().
The corrected code is:
d1.items()
Answered By
2 Likes
Related Questions
Find errors and rewrite the same after correcting the following code:
del d1(2)Find errors and rewrite the same after correcting the following code:
pop d1[4]Find errors and rewrite the same after correcting the following code:
d1.key()Find errors and rewrite the same after correcting the following code:
d1.value()