1# Iterate over dictionary using enumerate()
2
3mydict = {
4 "one": 1,
5 "two": 2,
6 "three": 3
7}
8
9# You can replace `index` with an underscore to ignore the index
10# value if you don't plan to use it.
11for index, item in enumerate(mydict):
12 print(f"{item}: {mydict.get(item)}")
13
14# OUTPUT:
15# one: 1
16# two: 2
17# three: 3
1>>> for key, value in a_dict.items():
2... print(key, '->', value)
3...
4color -> blue
5fruit -> apple
6pet -> dog