Zero to four
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 →
Zero to four
Print the numbers 0, 1, 2, 3, 4, one per line, using range(5).
⚠️ range(5) starts at 0 and stops before 5 — five numbers, none of them 5. That is the same rule as a slice.
Print the numbers 0, 1, 2, 3, 4, one per line, using range(5).
Click Run to see the output here.