Discuss / Python / 打卡

打卡

Topic source

Mints_鱼酱

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

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

        raise TypeError('bad operand type')

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

    if a == 0:

        x1 = -c/b

        x2 = -c/b

        print(x1,x2)

    elif v >= 0:

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

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

        print(x1,x2)

    elif v < 0:

        print('该方程无解')


  • 1

Reply