- 1
Need help with this code for quadratic equation it says unsupported operand types
A = int(input()) B= int(input()) C=int(input()) Print ("x1 is ") Print ((-b+(((b^2 - (4*a*c)^0.5))/2*a)))
1 Odpowiedź
+ 4
First of all your error is that ^ is not used for square root. To do square root in python you can either use math.sqrt(x) or x**0.5.
Second, the quadratic equation is b + OR - so you need to have two variables. I.e
X = -b + (b**2 - 4*a*c)**0.5........
Y = -b - (b**...........