I have made a program for 2nd degree equations:
import math
print()
print("****Fórmula para ecuación de 2º Grado****")
print()
a = int(input("Introduzca primer miembro ="))
b = int(input("Introduzca segundo miembro ="))
c = int(input("Introduzca tercer miembro ="))
y = b ** 2 - 4 * a * c
math.sqrt(y)
r = math.sqrt(b ** 2 - 4 * a * c)
print(r)
x = (-b + r) / (2 * a)
print(x)
pause = input()
However, I get this error:
error: Traceback (most recent call last): File "C:/Users/USUARIO/PycharmProjects/PY1/Ecuacion.py", line 9, in <module>
math.sqrt(y) ValueError: math domain error
What is the mistake I am making?