Discuss / Python / 测试通过111

测试通过111

Topic source

你是谁

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

def mul(*x):

    if len(x)==0:

       raise TypeError("参数不能为空")

    else:

       sum = 1

       for value in x:

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

               raise TypeError("参数类型有误")

           else:

            sum = sum*value

    return sum


  • 1

Reply