Python Programming - Dictionaries - Discussion

Discussion Forum : Dictionaries - General Questions (Q.No. 15)
15.
How do you iterate over the key-value pairs in a dictionary?
for key in dictionary:
for key, value in dictionary.iter_items():
for key, value in dictionary.items():
for key, value in dictionary.get_pairs():
Answer: Option
Explanation:
The items() method is used to iterate over key-value pairs in a dictionary.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.