标签:product 递归 class turn pre iter 尾递归 print def
def fact(n):
return fact_iter(n,1)
def fact_iter(num,product):
if num==1:
return product
return fact_iter(num-1,num*product)
print fact(10)
3628800
标签:product 递归 class turn pre iter 尾递归 print def
原文地址:http://blog.51cto.com/13959448/2315720