a_dict = {'apple':'red', 'grass':'green', 'sky':'blue'}
for key in a_dict:
print key # for the keys
print a_dict[key] # for the values
# Loop through dictionary in key order
di = {'b': 2, 'c': 3, 'a': 1}
for k, v in sorted(di.items()):
print(k, v)
# a 1
# b 2
# c 3
#traversing dictionary function
d={1:'one',2:'two',3:'three',4:'four'}
print(d)
for i in d:
print(i,d[i])