capypad
0 day streak
python / beginner
Snippet

Looping with range()

The range() function generates a sequence of numbers, which is commonly used to run a loop a specific number of times.

snippet.py
python
1
2
for i in range(3):
print("Iteration", i)
Breakdown
1
range(3)
Generates a sequence of integers starting from 0 up to (but not including) 3.