Created
October 4, 2015 14:55
-
-
Save poros/bdc4b1d21fe504b8940e to your computer and use it in GitHub Desktop.
Loop over a collection and indexes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in range(len(colors)): | |
print i, colors[i] | |
for i, colors in enumerate(colors): | |
print i, colors | |
# retuns enumerate object, not a list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment