I am finding it difficult to iterate through a dictionary in python.
I have already finished learning via CodeAcademy and solo learn but still find it tough to go th
# In Python 3.x
hash={'a': 1, 'b': 2}
for k in hash:
print (str(k) + "," + str(hash[k]))
# OR
for key, value in hash.items():
print (str(key) + ',' + str(value))
# OR
for key, value in {'a': 1, 'b': 2}.items():
print (str(key) + ',' + str(value))
# OR
for tup in hash.items():
print (str(tup[0]) + ',' + str(tup[1]))