Loops (for / while)
Iterating over sequences with for, generating numbers with range, conditional repetition with while, break and continue.
Simple enough for a 5-year-old to understand
for and range
for loops over each element of a sequence. range() generates a given number of repetitions.
for i in range(1, 4): print(i)🎯 Exercise & Practice
Test what you've learned — answer, write code, check instantly. (1 left)
🎯 Expected output: 1
2
3
4
5