I know that if the root is less than zero it will not exist, but, something happens, even though I implement that if the delta value is less than zero it is to write the error it still continues showing "math domain error "I do not know the reason. I leave the code below for a better judgment.
a = float(input("Insira um valor para A: "))
b = float(input("Insira um valor para B: "))
c = float(input("Insira um valor para C: "))
d = b ** 2 - 4 * a * c
print("Delta: ",d)
delta = math.sqrt(d)
print("Raiz quadrada de delta: ",delta)
if d > 0:
x1 = (-b + delta)/ (2*a)
x2 = (-b - delta)/ (2*a)
print("X1 = ", x1, "X2 = ", x2)
elif d == 0:
x = -b / (2*a)
print("Valor de x = ",x)
elif d < 0:
print("Essa raiz é menor do que zero")