from functools import reduce ret = reduce(lambda x,y: x+y, [1.5, 2, 3]) print(ret) ret2 = reduce(lambda x, y: x+y, [1,2,3], 9) print(ret2) ret3 = reduce(lambda x,y: x+y, [1, 2, 3], 7) print(ret3)
from functools import reduce ret = reduce(lambda x,y: x+y, [1.5, 2, 3]) print(ret) ret2 = reduce(lambda x, y: x+y, [1,2,3], 9) print(ret2) ret3 = reduce(lambda x,y: x+y, [1, 2, 3], 7) print(ret3)
转载于:https://www.cnblogs.com/chenyibai/p/9491306.html