Bird
0
0

What is the output of this code?

medium📝 Predict Output Q5 of 15
Python - Loop Control
What is the output of this code?
for i in range(3):
    if i == 1:
        continue
    print(i)
A0 1 2
B1 2
C0 2
D0 1
Step-by-Step Solution
Solution:
  1. Step 1: Trace loop with continue

    Loop i=0,1,2; when i=1, continue skips print.
  2. Step 2: Identify printed values

    Prints 0 and 2 only, skips 1.
  3. Final Answer:

    0 2 -> Option C
  4. Quick Check:

    continue skips iteration = 0 2 [OK]
Quick Trick: continue skips current loop step [OK]
Common Mistakes:
MISTAKES
  • Printing skipped value
  • Confusing continue with break
  • Printing all values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes