I am trying to create a simple program to sole for the roots of a quadratic equation in python, but my code is not working. Here is what I have so far:
from math import *
def qf(a, b, c):
print((-b+sqrt(b*b-4*a*c))/(2*a));
print((-b-sqrt(b*b-4*a*c))/(2*a));
while(True):
qf(input("A: "), input("B: "), input("C: "))
And here are the errors I get when evaluating:
Traceback (most recent call last):
File "qf.py", line 6, in <module>
qf(input("A: "), input("B: "), input("C: "))
File "qf.py", line 3, in qf
print((-b+sqrt(b*b-4*a*c))/(2*a));
ValueError: math domain error
What errors have I made, and how can I fix them?