iterate over dictionary using integer code example
Example 1: python loop through dictionary
new_list = [something(key, value) for key, value in a_dict.items()]
Example 2: how to iterate over dictionary in python
>>> for key, value in a_dict.items():
... print(key, '->', value)
...
color -> blue
fruit -> apple
pet -> dog