Discuss / Python / 作业

作业

Topic source

容蟹屡

#1 Created at ... [Delete] [Delete and Lock User]

    if not isinstance(a+b+c,(int,float)):

        raise TypeError('bad operand type')

    if b**2-4*a*c<0:

        print('no answer')

    else:

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

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

    return x1,x2

#  /2*a 和 /(2*a)要区分


  • 1

Reply