Python Learning Series · @onlysamarrr · Day 11 / 30
Day 11 teaches the while loop, break and continue. A while loop runs while its condition is True, break stops the loop immediately, and continue skips the current round and moves to the next one.
Phase: Beginner · Reels: 51/450 – 55/450
Day 11 teaches the while loop, break and continue. A while loop runs while its condition is True, break stops the loop immediately, and continue skips the current round and moves to the next one.
count = 0
while count < 3:
print("count:", count)
count += 1
for n in range(1, 10):
if n % 2 == 0:
continue
if n > 5:
break
print(n, end=" ")
print()
count: 0 count: 1 count: 2 1 3 5
Retry logic, menus and guessing games use while loops with break and continue.
Select (tick) an option, then tap Check answer to see instantly whether your answer is right or wrong, with an explanation. You can change your answer and check again.
Q1. What does break do inside a loop?
Q2. What does continue do?
Q3. What causes an infinite while loop?
| 51/450 | Concept | while loop basics |
| 52/450 | Live demo | break aur continue demo |
| 53/450 | Common mistake | Infinite loop galti |
| 54/450 | Quiz | Quiz: number guessing |
| 55/450 | Interview / real life | Interview: for vs while |