Loops

Loops repeat work. `for` walks a sequence; `range(n)` gives 0…n-1.

A common pattern is to accumulate a running total inside the loop, updating a variable each pass. `range(a, b)` counts from a up to (but not including) b.

total = 0
for i in range(4):
    total = total + i

More lessons in Control flow & functions