Discuss / Python / 作业更正

作业更正

Topic source
s=b*b-4*a*c
if not isinstance(a+b+c,(int,float)):
    raise TypeError('wrong operand type')
if a==0:
    return -c/b
elif s<0:
    return None
elif s==0:
    return -b/2*a
else:
    return (-b+math.sqrt(s))/(2*a), (-b-math.sqrt(s))/(2*a)

  • 1

Reply