From 8a6532675521a36b9a7162f5769be44da9d1b68e Mon Sep 17 00:00:00 2001 From: Stanislav Mykhailenko Date: Tue, 18 Oct 2022 20:57:16 +0300 Subject: [PATCH] Make Lesson 1 Task 4 more foolproof --- Lesson_1/task4.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lesson_1/task4.py b/Lesson_1/task4.py index 1bad800..3180016 100644 --- a/Lesson_1/task4.py +++ b/Lesson_1/task4.py @@ -17,6 +17,10 @@ except ValueError: print("Invalid numbers entered.") 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: print("Not a quadratic equation.") sys.exit(2)