0
I know that if the root is less than zero it will not exist, but, something happens, even if I implement that if the delta value is less than zero is to write the error it still continues showing "Math Domain error" I do not know the reason. I leave the code down here for 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")
Start by fixing the indentation so that you play 100% with the code as you have written it, as well as placing the Imports you are using
– Isac