Skip to content

Instantly share code, notes, and snippets.

@adrianmarkperea
Created October 5, 2019 03:38
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 adrianmarkperea/9305052eac19052d0e43a64d8ddb30d9 to your computer and use it in GitHub Desktop.
Save adrianmarkperea/9305052eac19052d0e43a64d8ddb30d9 to your computer and use it in GitHub Desktop.
fruits = ['apples', 'oranges', 'bananas']
# yikes, archaic
for i in range(len(fruits)):
print(i, fruits[i])
# So much better
for i, fruit in enumerate(fruits):
print(i, fruit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment