Make Lesson 1 Task 4 more foolproof
This commit is contained in:
parent
0d96e727fb
commit
8a65326755
1 changed files with 4 additions and 0 deletions
|
@ -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)
|
||||||
|
|
Reference in a new issue