Discuss / Python / 第二题

第二题

Topic source

_Ljj110719

#1 Created at ... [Delete] [Delete and Lock User]
def product(L):
    def multiply(x, y):
        return x*y
    return reduce(multiply, L)
>>> L = [1, 2, 3, 4]
>>> print(product(L))
24

供参考,求指正

_Ljj110719

#2 Created at ... [Delete] [Delete and Lock User]
from functools import reduce

  • 1

Reply