💡 What You'll Learn

while loops repeat as long as a condition is True. Unlike for loops, you control when to stop by changing the condition inside the loop.

⚠️ Be careful! If the condition never becomes False, you'll get an infinite loop that never ends.
while_loop.py
1count = 0
2while count < 5:
3    print(count)
4    count = count + 1
📺 While loop demonstration
Click to run!

🎯 Your Challenges

1Double Each Step
Start at 1, double it each time until reaching 64
2Guess the Number
Simulate guessing until you get the right number
3Break Out
Use break to stop a loop early when a condition is met

📚 What You Learned