Discuss / Python / 算是出来了吧

算是出来了吧

Topic source

李大耗

#1 Created at ... [Delete] [Delete and Lock User]
k = b*b-4*a*c
x = (-b)/(2*a)
x1 = (-b+math.sqrt(b*b-4*a*c))/(2*a)
x2 = (-b-math.sqrt(b*b-4*a*c))/(2*a)
if k <0:
    return'该方程无解'
elif k == 0:
    return x
else:
    return x1,x2

  • 1

Reply