Discuss / Python / 交作业

交作业

Topic source

C❤️M

#1 Created at ... [Delete] [Delete and Lock User]
def mul(*args):    r = 1    if len(args) == 0:        raise TypeError('bad operand type')    elif len(args) == 1:        return args[0]    for inx in args:        if not isinstance(inx, (int, float)):            raise TypeError('bad operand type')        r = r * inx    return r

  • 1

Reply