Discuss / Python / 第二题

第二题

Topic source

s丢pid

#1 Created at ... [Delete] [Delete and Lock User]
from functools import reducedef prod(L):    def f(x1,x2):        return x1*x2    return reduce(f,L)#测试print('3 * 5 * 7 * 9 =', prod([3, 5, 7, 9]))if prod([3, 5, 7, 9]) == 945:    print('测试成功!')else:    print('测试失败!')

  • 1

Reply