def product(*args): if len(args) ==0: raise TypeError('bad type') m = 1; for n in args: m = n*m; return m;
或者
def product(x,*args): m = x; for n in args: m = m*n return m
Sign in to make a reply
wenyizhen
def product(*args): if len(args) ==0: raise TypeError('bad type') m = 1; for n in args: m = n*m; return m;