Even numbers
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
This one builds on a lesson you haven't finished yet. Do that lesson first:
Python Basics · Counting loops →
Even numbers
Print the even numbers from 2 to 20, one per line.
range can take a third number, the step: range(0, 10, 3) counts 0, 3, 6, 9. Start at the first even number and step by 2.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
Print the even numbers from 2 to 20, one per line. Use range with a step: range(start, stop, step).
Click Run to see the output here.