- 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)))

17th Apr 2019, 4:42 PM
Azino Oreva
Azino Oreva - avatar
1 Resposta
+ 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**...........
17th Apr 2019, 5:53 PM
Sam Stoltenberg
Sam Stoltenberg - avatar