Skip to content

Instantly share code, notes, and snippets.

@nunenuh
Created May 5, 2019 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nunenuh/1b29ce884ab720baf6425fc05f8be33a to your computer and use it in GitHub Desktop.
Save nunenuh/1b29ce884ab720baf6425fc05f8be33a to your computer and use it in GitHub Desktop.
Idiomatic Python
# Looping Over Collection Forward
colors = ["red", "green", "blue"]
# bad
for i in range(len(colors)):
print(colors[i])
# good
for color in colors:
print(color)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment