阶乘
方法1 2 3
def recur_fac(num,res=1): if num == 1: return res res = res * num return recur_fac(num - 1,res) print(recur_fac(12)) from functools import reduce print(reduce(lambda x , y :x * y,range(1,13))) def factor(num): n = 1 for i in range(2,num+1): n *= i return n print(factor(5))