Bird
0
0

Identify the error in this code:

medium📝 Debug Q7 of 15
Python - Data Types as Values
Identify the error in this code:
if True
    print("Yes")
AMissing colon after if condition
BTrue should be lowercase
CIndentation error in print statement
Dprint statement missing parentheses
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of if statement

    Python requires a colon ':' after the condition in an if statement.
  2. Step 2: Identify missing colon

    The code has 'if True' without a colon, causing a syntax error.
  3. Final Answer:

    Missing colon after if condition -> Option A
  4. Quick Check:

    If statements need ':' after condition [OK]
Quick Trick: Always put ':' after if condition [OK]
Common Mistakes:
MISTAKES
  • Omitting colon after if
  • Thinking True is lowercase
  • Ignoring indentation rules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes