尾递归
时间:2015-01-29 19:15:53
收藏:0
阅读:196
http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/00137473836826348026db722d9435483fa38c137b7e685000
尾递归是 递归的一种
>>> def fact(n): return fact_iter(0,1,n) >>> def fact_iter(product,counter,max): if counter>max: return product return fact_iter(product+counter,counter+1,max) >>> fact(2) 3
评论(0)