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
Sign in to make a reply
长日将尽
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