← Concepts
Loops
Repeating with for and while.
`for i in range(n):` repeats with i = 0, 1, ..., n-1. `while condition:` repeats until the condition is false.
Worked example
total = 0
for i in range(1, 6):
total += i
print(total) # 15Related challenges