Bird
0
0

Find the error in this code snippet:

medium📝 Debug Q14 of 15
Python - Exception Handling Fundamentals
Find the error in this code snippet:
try:
    print(10 / 2)
except ZeroDivisionError
    print('Error')
ANo error in the code
BWrong exception type used
CMissing colon after except statement
DMissing try keyword
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax of except statement

    The except line lacks a colon at the end, which is required in Python.
  2. Step 2: Confirm other parts are correct

    try keyword and exception type are correct; only colon is missing.
  3. Final Answer:

    Missing colon after except statement -> Option C
  4. Quick Check:

    except line must end with colon [OK]
Quick Trick: Always put colon after except statement [OK]
Common Mistakes:
  • Forgetting colon after except
  • Assuming wrong exception type causes syntax error
  • Thinking try keyword is missing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes