← 🐍 Python Foundations5 / 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.
Task
Print the numbers 1 to 10.
Keep going with Python Foundations
Ready for more? These paid resources pick up where this lesson leaves off.
UdemyBestsellers
Top-rated Python Foundations courses
Project-based Python Foundations video courses — the perfect paid next step after these free lessons.
Browse on Udemy →AmazonReader picks
Best Python Foundations books
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.