Bird
0
0

What is the output of this code?

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

    The loop runs i from 0 to 3. When i is 2, continue skips printing.
  2. Step 2: Identify printed values

    Values printed are 0, 1, and 3 because 2 is skipped.
  3. Final Answer:

    0 1 3 -> Option A
  4. Quick Check:

    Continue skips i=2 print [OK]
Quick Trick: Continue skips printing i=2, so 2 is missing [OK]
Common Mistakes:
MISTAKES
  • Including 2 in output
  • Skipping 3 mistakenly
  • Confusing continue with break

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes