Bird
0
0

Which of the following is the correct syntax to use continue inside a for loop in Python?

easy📝 Syntax Q3 of 15
Python - Loop Control
Which of the following is the correct syntax to use continue inside a for loop in Python?
Afor i in range(5): continue
Bfor i in range(5): if i == 2: continue
Cfor i in range(5) continue if i == 2:
Dfor i in range(5): if i == 2 break
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax for using continue in a loop

    The continue statement must be inside a conditional block to skip specific iterations.
  2. Step 2: Identify correct Python syntax

    for i in range(5): if i == 2: continue correctly uses if i == 2: continue inside the loop.
  3. Final Answer:

    for i in range(5): if i == 2: continue -> Option B
  4. Quick Check:

    Correct continue syntax = B [OK]
Quick Trick: Use continue inside if-block in loops [OK]
Common Mistakes:
MISTAKES
  • Placing continue outside loop
  • Using break instead of continue
  • Incorrect indentation or syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes