💡 What You'll Learn
for loops repeat code a specific number of times. Use range(n) to loop n times, or iterate through items in a list. The loop variable changes each iteration!
for_loop.py
1for i in range(5):
2 print("Count:", i)
📺 Watch the loop run!
Click to see the loop!
🎯 Your Challenges
1Count by 2s
Use range(0, 10, 2) to count 0, 2, 4, 6, 8
2Countdown
Count down from 5 to 1, then "Blastoff!"
3Sum Numbers
Add up numbers 1 to your chosen number
📚 What You Learned
for i in range(n):loops n times (0 to n-1)range(start, stop, step)for custom loops- The loop variable (i) changes each iteration
- Indentation defines the loop's code block