Bird
0
0

Which of these is the correct way to start a while loop in Python?

easy📝 Syntax Q3 of 15
Python - For Loop
Which of these is the correct way to start a while loop in Python?
Awhile i < 5 {}
Bwhile (i < 5)
Cwhile i < 5:
Dwhile i < 5 then
Step-by-Step Solution
Solution:
  1. Step 1: Recall Python while loop syntax

    Python uses 'while condition:' with a colon and indentation.
  2. Step 2: Compare options with correct syntax

    Only while i < 5: uses colon and no extra symbols, matching Python syntax.
  3. Final Answer:

    while i < 5: -> Option C
  4. Quick Check:

    Correct while loop syntax = 'while condition:' [OK]
Quick Trick: While loops end with a colon and indent [OK]
Common Mistakes:
MISTAKES
  • Missing colon
  • Using braces instead of colon
  • Adding 'then' keyword

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes