I am writing a script that solves a Quadratic equation. What I am doing wrong and why? The error I get is:
Traceback (most recent call last):
File "/home/matthew/Desktop/QuadraticSolver.py", line 5, in <module>
c1 = (b * -1) + math.sqrt(((b*b) - 4*a*c) / 2*a)
ValueError: math domain error
Here is the code:
import math
a = input("Please enter A: ")
b = input("Please enter B: ")
c = input("Please enter C: ")
c1 = (b * -1) + (math.sqrt(((b*b) - 4*a*c) / 2*a))
c2 = (b * -1) - (math.sqrt(((b*b) - 4*a*c) / 2*a))
print c1
print c2
Thanks
Matthew