Step: Loops: for with range()
Loops: for with range()
range(start, stop) generates integers from start up to (not including) stop — perfect for counting loops.
Why it matters: range() avoids allocating an actual list of numbers just to loop over them.
Example: list(range(1, 4)) is [1, 2, 3].
Your turn: sum the integers 1 through 5 with for i in range(1, 6): total += i.
Pitfall: range(1, 6) stops before 6 — a classic off-by-one if you expect it to include 6.
Your code:Expected output:
Step 10 of 18