Quadratic Formula with Exception Handling

Let's start with our if-elif-else version of our program

Our conditions (if-elif-else statements, and their variations) explictly check states of discrim and a. We are actively checking to prevent an error from occurring in a fragile part of our program. What if we can passively react to problems when occur?

Introducing try-except

"Try this code first, except if something fails do this instead"

Checking for ZeroDivisionError

This is just to demonstrate what one can do, but in the end I prefer using our previous version where we had if a < 0: as our guard check.

Multiple Exceptions