Python Fundamentals / Loops
Lesson 16 of 38
while loops
A while loop repeats while its condition is True. Make sure something inside changes, or it will loop forever.
Key points
- Check the condition each time round
- Update the variable inside
- Ctrl+C stops a runaway loop
count = 3
while count > 0:
print(count)
count -= 1
print("Go!")Quiz · +10 XP
What stops an infinite loop in the terminal?
Log in to save progress and earn XP.