Skip to main content
Python Code Completion Medium +20 XP

Exception Handling

Complete the error handling pattern.

PythonFill in the blank
try:
    result = 10 / 0
___ ZeroDivisionError:
    print("Cannot divide by zero")

Type the missing code

Show answer and explanation

Answer: except

The except keyword catches specific exceptions in Python's try/except pattern.

Hint: What keyword catches errors in Python?

What this challenge tests

Code Completion in Python: exceptions, error-handling.

Related challenges