def answer(a,b,c):
delta = b**2 - (4*a*c)
if delta < 0:
print('Because delta is negative, This Quadratic equation have no real roots.')
print('But it has two distinct (non-real) complex roots.')
return 'No real roots'
elif delta == 0:
x = (-b)/2*a
print('The only root for this Quadratic equation is %.3f' % x)
return x
else:
x_1 = (-b+(math.sqrt(delta)))/(2*a)
x_2 = (-b-(math.sqrt(delta)))/(2*a)
print('The two different roots is %.3f and %.3f' % (x_1, x_2))
return x_1, x_2
青年小哲