Bird
0
0

Find the error in this code:

medium📝 Debug Q6 of 15
Python - While Loop
Find the error in this code:
count = 5
while count > 0
    print(count)
    count -= 1
AIndentation error in print statement
BMissing colon after while condition
Ccount variable not initialized
DWrong decrement operator
Step-by-Step Solution
Solution:
  1. Step 1: Check while loop syntax

    Python requires a colon : after the while condition.
  2. Step 2: Identify missing colon

    The code misses colon after while count > 0, causing syntax error.
  3. Final Answer:

    Missing colon after while condition -> Option B
  4. Quick Check:

    While loop syntax error = missing colon [OK]
Quick Trick: Always put colon after while condition [OK]
Common Mistakes:
MISTAKES
  • Forgetting colon after while
  • Incorrect indentation
  • Using wrong operators

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes