For loops and range

for x in something: runs the block once for each item of a list, string, range or any other iterable. There is no for (i = 0; i < n; i++) in Python.

range(stop) counts from 0 up to, but not including, stop. range(start, stop) sets the start, and a third argument sets the step, which can be negative. Most off-by-one bugs come from forgetting that stop is left out.

A range doesn't build a list. It makes numbers as you go, so range(10**9) costs no memory.

Looping over a string gives one character at a time.

Run it, then make it count down from 10 to 0 in twos.