为什么运行成功,输出错误?
import math
def quadratic_equation(a, b, c):
t=math .sqrt(b*b-4*a*c)
if b*b-4*a*c>0:
x=(-b+t)/2*a
y=(-b-t)/2*a
return x,y
elif b*b-4*a*c==0:
x=y=-b/2*a
return x,y
print quadratic_equation(2, 3, 0)
print quadratic_equation(1, -6, 5)
import math
def quadratic_equation(a, b, c):
t=math .sqrt(b*b-4*a*c)
if b*b-4*a*c>0:
x=(-b+t)/2*a
y=(-b-t)/2*a
return x,y
elif b*b-4*a*c==0:
x=y=-b/2*a
return x,y
print quadratic_equation(2, 3, 0)
print quadratic_equation(1, -6, 5)
2020-01-09
举报