Discuss / Python / 作业

作业

Topic source

defquadratic(a,b,c):

import math

    x=b**2-4*a*c

if x<0:

return("此方程无解")

elif x==0:

        anw=(-b)/(2*a)

return anw

else:

        x1=(-b+math.sqrt(x))/(2*a)

        x2=(-b-math.sqrt(x))/(2*a)

return x1,x2


  • 1

Reply