Lesson 14: Handling Errors

No code is perfect. try and except prevent the program from crashing when something goes wrong.

Catching the error

If you divide by zero, disaster happens. But not with try!

try: print(1/0) except: print("Oops!")

Your Objective

Handle the text-to-number conversion error.

main.py
Initializing Python Environment...