Bird
0
0

What does the while True loop do in Python?

easy📝 Conceptual Q11 of 15
Python - While Loop

What does the while True loop do in Python?

AIt creates a loop that runs forever unless stopped by <code>break</code>.
BIt runs the loop only once.
CIt runs the loop a fixed number of times.
DIt causes a syntax error.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the meaning of while True

    The condition True is always true, so the loop will keep running forever.
  2. Step 2: Recognize how to stop the loop

    To stop this infinite loop, a break statement is used inside the loop when a condition is met.
  3. Final Answer:

    It creates a loop that runs forever unless stopped by break. -> Option A
  4. Quick Check:

    while True = infinite loop until break [OK]
Quick Trick: Remember: while True loops forever until break stops it [OK]
Common Mistakes:
MISTAKES
  • Thinking it runs only once
  • Assuming it runs a fixed number of times
  • Believing it causes a syntax error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes