← Python Foundations
5 / 27
Lesson 5 — Loops
Repeating work
A for loop runs the same block once for each item in a sequence. range(5) produces 0, 1, 2, 3, 4 — note it stops before 5.
Why it matters: loops let you process a list of any size in a few lines instead of copying code over and over.
Tip: to count 1 to 10, use range(1, 11) — the start is included, the end is not.
Want it another way?
Task
Print the numbers 1 to 10, one per line.
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
Test your knowledge
A quick 3-question quiz on this lesson — instant feedback.