Looping Through a Dictionary

How do you loop through all the keys in a dictionary?

Loop through a dictionary to access just the keys. This is the default behavior when looping through a dictionary.

How do you loop through all the values in a dictionary?

You can also access just the values in a dictionary with values().

How do you loop through all the key-value pairs in a dictionary?

Use the items() methods to work with both keys and values.