标签:actor enter second tab fir head text factorial recursion
目录
def factorial(n):
if n==0:
return 1
return factorial(n-1)*n
f(4)=f(3)*4
f(3)=f(2)*3
f(2)=f(1)*2
f(1)=1
the result of executionf(4)=1*2*3*4
def factorial(n,acc=1):
if n==0:
return acc
return factorial(n-1,n*acc)
The First Column | The Second Column |
---|---|
tail | [tel]尾部 |
recursion | 递归[ri‘kesion] |
factorial | 阶乘 |
acc | accumulation 叠加器 |
python_factorial_tail recursion
标签:actor enter second tab fir head text factorial recursion
原文地址:https://www.cnblogs.com/hugeng007/p/9362833.html