当前位置: 代码迷 >> 综合 >> 【Python】reduce()--2
  详细解决方案

【Python】reduce()--2

热度:89   发布时间:2023-11-22 08:09:53.0

Describe

Answer

from functools import reducedef mul(x,y):return x*ydef prod(L):return reduce(mul,L)
print(prod([3,5,7,9]))

Output

945Process finished with exit code 0