Skip to content

Instantly share code, notes, and snippets.

@plavjanik
Last active June 16, 2022 04:01
Show Gist options
  • Select an option

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

Select an option

Save plavjanik/eb244afa008948151e0a7b36ff0a1f50 to your computer and use it in GitHub Desktop.
Looping over a range of numbers
# ❌
i = 0
while i < 6:
print(i)
i += 1
# ❌
for i in [0, 1, 2, 3, 4, 5]:
print(i)
# ✔️
for i in range(6):
print(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment