为什么计算结果和答案不同?
import math
def quadratic_equation(a, b, c):
x1=(-b+math.sqrt(b**2-4.0*a*c))/2.0*a
x2=(-b-math.sqrt(b**2-4.0*a*c))/2.0*a
return x1,x2
print quadratic_equation(2, 3, 0)
print quadratic_equation(1, -6, 5)
代码可以运行,但是答案提示错误
import math
def quadratic_equation(a, b, c):
x1=(-b+math.sqrt(b**2-4.0*a*c))/2.0*a
x2=(-b-math.sqrt(b**2-4.0*a*c))/2.0*a
return x1,x2
print quadratic_equation(2, 3, 0)
print quadratic_equation(1, -6, 5)
代码可以运行,但是答案提示错误
2020-02-27
举报