Falsche Antworten für quadratische Gleichungen
Ich habe mich gefragt, ob mir jemand sagen könnte, warum mein Python-Code zum Lösen quadratischer Gleichungen nicht funktioniert. Ich habe es durchgesehen und keine Fehler gefunden.
print("This program will solve quadratic equations for you")
print("It uses the system 'ax**2 + bx + c'")
print("a, b and c are all numbers with or without decimal \
points")
print("Firstly, what is the value of a?")
a = float(input("\n\nType in the coefficient of x squared"))
b = float(input("\n\nNow for b. Type in the coefficient of x"))
c = float(input("\n\nGreat. now what is the c value? The number alone?"))
print("The first value for x is " ,(-b+(((b**2)-(4*a* c))* * 0.5)/(2*a)))
print("\n\nThe second value for x is " ,(-b-(((b * * 2)-(4*a*c))** 0.5)/(2*a)))
Wenn a = 1 b = -4 und c = -3, erwarte ich -1 und 4, erhalte aber 5,5 und 0,5