def prod(x,y): return x * y print(reduce(prod,[1,3,5,6,8]))
个人比较喜欢精简代码,以下一行代码版: print(reduce(lambda x,y:x * y,[1,3,5,6,8]))
Sign in to make a reply
莉莉娅的小暖炉
def prod(x,y): return x * y print(reduce(prod,[1,3,5,6,8]))
个人比较喜欢精简代码,以下一行代码版: print(reduce(lambda x,y:x * y,[1,3,5,6,8]))