Question
How can I print the items in a dictionary?
Answer
To print
all of the items in a dictionary at once, we can use the dictionary’s .items()
method. To do this, we simply write print dictionary_name.items()
.
This will display all of the dictionary’s keys and values as tuples in no particular order.