Make Lesson 1 Task 4 more foolproof

This commit is contained in:
Stanislav Mykhailenko 2022-10-18 20:57:16 +03:00
parent 0d96e727fb
commit 8a65326755
GPG key ID: 1E95E66A9C9D6A36

View file

@ -17,6 +17,10 @@ except ValueError:
print("Invalid numbers entered.") print("Invalid numbers entered.")
sys.exit(1) sys.exit(1)
if not math.isfinite(a) or not math.isfinite(b) or not math.isfinite(c):
print("Invalid numbers entered.")
sys.exit(1)
if a == 0: if a == 0:
print("Not a quadratic equation.") print("Not a quadratic equation.")
sys.exit(2) sys.exit(2)