Beginner : QUADROOT

I am wondering why my code is marked as wrong answer when i submit. If anyone can help throw some light on it, would be appreciated.

Python3 code:

a = float(input())
b = float(input())
c = float(input())
x1 = (-b+(((b**2)-(4*a*c))**1/2))/(2*a)
x2 = (-b-(((b**2)-(4*a*c))**1/2))/(2*a)

The **(power) operator has higher precedence than /(division) operator. So your equation is evaluating as (b²-4ac)/2 instead.

But its interesting that i am getting the correct output for the inputs(including the sample testcase provided)… In theory you do seem to be correct… and with the correction the answer has got correct from the codechef system… thanks!!

Try input x²+6x+5=0. Previous version would output wrong.