Editor

Predict the Output

Beginner · Predict the output · from Python Try-Except: Handle Errors Without Crashing

From the lesson: Python Try-Except: Handle Errors Without Crashing

Imagine a trapeze artist performing high above the ground. No matter how skilled they are, there's always a safety net below. If they slip, the net catches them and they can climb back up and try again.

Read the lesson

Read the code below carefully and predict what it will print. Type the exact output.

try:
    print("A")
    x = int("hello")
    print("B")
except ValueError:
    print("C")
else:
    print("D")
finally:
    print("E")
# Type what the code above would print:
# (use print statements for each line of output)

More Try-Except exercises

All Python exercises · 50 practice problems · Error Handling quiz