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.
Print the numbers 1 to 10.
A quick 3-question quiz on this lesson — instant feedback.
Ready for more? These paid resources pick up where this lesson leaves off.
Project-based Python Foundations video courses — the perfect paid next step after these free lessons.
Browse on Udemy →Hand-picked Python Foundations books to master the fundamentals offline.
See on Amazon →Some links on this page are affiliate links: we may earn a commission at no extra cost to you. We only recommend tools we believe are genuinely useful.