Bird
0
0

Which of the following is the correct syntax to use break inside a for loop?

easy📝 Syntax Q12 of 15
Python - Loop Control

Which of the following is the correct syntax to use break inside a for loop?

for i in range(5):
    ___
    print(i)
Abreak if i == 3
Bif i == 3: break
Cbreak: if i == 3
Dif break i == 3
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct Python syntax for conditions

    Python uses if condition: followed by indented code.
  2. Step 2: Place break inside the if block

    The correct way is if i == 3: break to stop loop when i equals 3.
  3. Final Answer:

    if i == 3: break -> Option B
  4. Quick Check:

    Correct if-break syntax = C [OK]
Quick Trick: Use 'if condition: break' inside loops [OK]
Common Mistakes:
MISTAKES
  • Writing break before if
  • Using colon after break
  • Incorrect order of if and break

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes