In [ ]:
格式:reduce( func, seq[, init] )
In [ ]:
reduce( func, [1, 2, 3] ) = func( func(1, 2), 3)
In [3]:
from functools import reduce
n = 5
print('{}'reduce(lambda x, y: x * y, range(1, n + 1))) # 1 * 2 * 3 * 4 * 5