求阶乘:
方式一:递归求阶乘
def jiecheng(x):
if (x-1 ==0):
return x
x = x*jiecheng( x-1 )
return x
print(jiecheng(9))
方式而:匿名函数+reduce+range
from functools import reduce
print(reduce( lambda x,y:x*y,range(1,5))) # 求1-4的阶乘,根据所求相应改变