Looping through a dictionary requires two steps: first you need to iterate over its keys using either a for loop or while loop; then you need to access each element’s value using its associated key inside the loop body. For example:
my_dict = {‘key1’: ‘value1’, ‘key2’: ‘value2’}
for key in my_dict:
print(my_dict[key]).