Let’s walk through this step-by-step so it’s crystal clear:
Iteration breakdown:
-
i = 1 → not divisible by 3 or 4 → print 1
-
i = 2 → not divisible by 3 or 4 → print 2
-
i = 3 → divisible by 3 → skip (no print)
-
i = 4 → divisible by 4 → skip (no print)
-
i = 5 → not divisible by 3 or 4 → print 5
-
i = 6 → divisible by 3 → skip (no print)
-
i = 7 → not divisible by 3 or 4 → print 7
Output:
1 2 5 7
✅ The continue statement is the key here — it jumps to the next loop iteration without executing the print() for that value.


0 Comments:
Post a Comment