How do I iterate over dicts in Python with standard library only?

In Python, you can easily iterate over dictionaries using built-in methods of the standard library. This allows you to access keys, values, or both in a straightforward manner.
Python, iterate, dictionaries, standard library, keys, values
# Example of iterating over a dictionary in Python my_dict = {'a': 1, 'b': 2, 'c': 3} # Iterating over keys for key in my_dict: print(key) # Iterating over values for value in my_dict.values(): print(value) # Iterating over key-value pairs for key, value in my_dict.items(): print(f'{key}: {value}')

Python iterate dictionaries standard library keys values