为什么b^-4ac大于0,输出还是none?求大神指导
import math
def quadratic_equation(a, b, c):
if b**b-4*a*c>=0:
o=math.sqrt(b * b - 4 * a * c)
return (-b+o) / (2*a),(-b-o) /(2*a)
else:
return 'None'
print quadratic_equation(1, -6, 5)
None
import math
def quadratic_equation(a, b, c):
if b**b-4*a*c>=0:
o=math.sqrt(b * b - 4 * a * c)
return (-b+o) / (2*a),(-b-o) /(2*a)
else:
return 'None'
print quadratic_equation(1, -6, 5)
None
2019-12-11
举报