# TODO """ Your equation has no root. """ import math def compute(a, b, c): d = (b*b - 4*a*c) if d > 0: type = 2 x1 = (-b + math.sqrt(d) ) / (2*a) x2 = (-b - math.sqrt(d) ) / (2*a) elif d == 0: type= 1 x1 = -b / (2*a) x2 = x1 -3 elif d < 0: type = 0 x1 = 0 x2 = 0 return type, x1, x2 a = eval(input()) b = eval(input()) c = eval(input()) t, x1, x2 = compute(a, b, c) if t == 0: print('Your equation has no root.') elif t == 1: print(x1) elif t == 2: print(x1, end=', ') print(x2)
Category: Python