Discuss / Python / 提交“定义函数”作业 2021-8-13

提交“定义函数”作业 2021-8-13

Topic source

    if not isinstance(a,(int,float)) and not isinstance(b,(int,float)) and not isinstance(c,(int,float)) and a!=0:

        raise TypeError('bad operand type')

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

        return

    else:

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

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

        return x,y


  • 1

Reply