Skip to content

Instantly share code, notes, and snippets.

@plavjanik
Created June 16, 2022 04:02
Show Gist options
  • Select an option

  • Save plavjanik/7b530a134050872c4410c7902218a199 to your computer and use it in GitHub Desktop.

Select an option

Save plavjanik/7b530a134050872c4410c7902218a199 to your computer and use it in GitHub Desktop.
Looping over a collection
colors = ["cyan", "magenta", "yellow", "black"]
# ❌
for i in range(len(colors)):
print(colors[i])
# ✔️
for color in colors:
print(color)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment