1a_dict = {"color": "blue", "fruit": "apple", "pet": "dog"}
2
3# Will loop through the dict's elements (key, value) WITHOUT ORDER
4for key, value in a_dict.items():
5 print(key, '->', value)
1d = {'x': 1, 'y': 2, 'z': 3}
2for key in d:
3 print key, 'corresponds to', d[key]
1a_dict = {"color": "blue", "fruit": "apple", "pet": "dog"}
2for key in a_dict:
3 print(key, '->', a_dict[key])
4
5# Output:
6# color -> blue
7# fruit -> apple
8# pet -> dog