Discuss / Python / 交作业

交作业

Topic source

长日将尽

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

def mul(*args):

    if len(args)==0:

        raise TypeError('至少传一个参数')

    sum=1

    for n in args:

        if not isinstance(n,(int,float)):

            raise TypeError('bad operand type')

        sum=sum*n

    return sum


  • 1

Reply