公共和儿媳

Discuss / Python / 第二题

第二题

Topic source

233333

#1 Created at ... [Delete] [Delete and Lock User]
def prod(L):
    res = 1
    for i in L:
        res = res * i
    return res

print('3 * 5 * 7 * 9 =', prod([3, 5, 7, 9]))
if prod([3, 5, 7, 9]) == 945:
    print('测试成功!')
else:
    print('测试失败!')

别人让你用reduce函数


  • 1

Reply