from functools import reduce
# 连续的计算
list_x = [1,2,3,4,5,6]
r = reduce(lambda x,y,z:x+y+z,list_x)
print(r)
这个代码是报错的
Traceback (most recent call last):
File “F:/python/workSpace/imoocTest/twl/imooc_reduce.py”, line 5, in
r = reduce(lambda x,y,z:x+y+z,list_x)
TypeError: () missing 1 required positional argument: ‘z’