def product(*y):
if not y:
raise TypeError #当参数为空时,返回错误
else:
s = 1
for i in y:
s = s * i
return s
def product(x,*y): for i in y: x = x * i return x
Sign in to make a reply
landingguymmm
def product(*y):
if not y:
raise TypeError #当参数为空时,返回错误
else:
s = 1
for i in y:
s = s * i
return s