import math
def quadratic_equation(a, b, c):
t = b * b - 4 * a * c
if a == 0:
x1 = -c / b
return x1
elif t<0:
return 'none'
elif t >= 0:
x2 = (-b / (2 * a)) + math.sqrt(t / (4 * a * a))
x3 = (-b / (2 * a)) - math.sqrt(t / (4 * a * a))
return x2, x3
print quadratic_equation(2, 3, 0)
print quadratic_equation(1, -6, 5)
添加回答
举报
0/150
提交
取消