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 lessonRead 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
- Safe DivisionBeginner
- Fix the Number ConverterIntermediate
- Input Validator with raiseIntermediate
- Safe Dictionary LookupAdvanced
- Build a Safe CalculatorAdvanced
All Python exercises · 50 practice problems · Error Handling quiz