Bird
0
0

Which of the following is the correct syntax for a while True loop in Python?

easy📝 Syntax Q3 of 15
Python - While Loop

Which of the following is the correct syntax for a while True loop in Python?

Awhile True: print('Hello')
Bwhile (True) print('Hello')
Cwhile True print('Hello')
Dwhile True: print('Hello')
Step-by-Step Solution
Solution:
  1. Step 1: Check Python loop syntax

    Python requires a colon after the while condition and indented block inside the loop.
  2. Step 2: Identify correct indentation and colon usage

    while True: print('Hello') uses colon and indents print statement correctly.
  3. Final Answer:

    while True:\n print('Hello') -> Option A
  4. Quick Check:

    Correct syntax = while True: print('Hello') [OK]
Quick Trick: Always use colon and indent after while [OK]
Common Mistakes:
MISTAKES
  • Missing colon after while
  • No indentation inside loop
  • Using parentheses incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes