没有根的时候答案的代码不会报错吗
import math
def quadratic_equation(a, b, c):
t = math.sqrt(b*b-4*a*c)
if t>0:
x1 = (-b+t)/(2*a)
x2 = (-b-t)/(2*a)
return x1,x2
elif t == 0:
x1 = x2 = -b/(2*a)
return x1,x2
else:
return("null")
print quadratic_equation(2, 3, 0)
print quadratic_equation(1, -6, 5)