The weird thing is that my code works perfectly fine but if coefficient A is bigger than 1 my code doesn’t work properly I rechecked my code but I couldn’t find a bug.
This is my code-
A= float(input("Coefficient A="))
B= float(input("Coefficient B="))
C= float(input("Coefficient C="))
y = B**2-4*A*C
y2 = -B-y**0.5
y3 = -B+y**0.5
x = y2/ 2*A
x1 = y3/2*A
print("The answer is x=",x,"or",x1)
>Solution :
You forgot parenthesis around 2*A when computing x and x1. Try to do:
x = y2/ (2*A)
x1 = y3/ (2*A)