Bird
0
0

You want to print numbers from 0 to 9 but skip multiples of 3. Which code correctly uses loop control?

hard📝 Application Q8 of 15
Python - Loop Control
You want to print numbers from 0 to 9 but skip multiples of 3. Which code correctly uses loop control?
Afor i in range(10): if i % 3 == 0: break print(i)
Bfor i in range(10): if i % 3 == 0: continue print(i)
Cfor i in range(10): if i % 3 == 0: pass print(i)
Dfor i in range(10): if i % 3 == 0: print(i)
Step-by-Step Solution
Solution:
  1. Step 1: Understand requirement

    Skip multiples of 3, print others from 0 to 9.
  2. Step 2: Analyze options

    for i in range(10): if i % 3 == 0: continue print(i) uses continue to skip multiples of 3, printing others correctly.
  3. Final Answer:

    for i in range(10): if i % 3 == 0: continue print(i) -> Option B
  4. Quick Check:

    Use continue to skip unwanted values [OK]
Quick Trick: Use continue to skip unwanted loop items [OK]
Common Mistakes:
MISTAKES
  • Using break stops all loops
  • Using pass does not skip
  • Printing inside if only

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes