[Tutor] enumerate over Dictionaries

Animesh Bhadra animeshb.social at gmail.com
Thu Jul 4 13:02:16 EDT 2019


Hi All,
My python version is 3.6.7
I need help to understand this piece of code?

rainbow ={"Green": "G", "Red": "R", "Blue": "B"}
# ennumerate with index, and key value
fori, (key, value) inenumerate(rainbow.items()):
print(i, key, value)


This gives a output as always:-

0 Green G
1 Red R
2 Blue B


Does this means that the Dict is ordered? or it is implementation dependent?


Thanks & Regards,
Animesh.







More information about the Tutor mailing list