1 #!/usr/bin/env python
2 #encoding: utf-8 3 4 def func(arg1,arg2,stop): 5 if arg1 == 0: 6 print (arg1,arg2) 7 arg3 = arg1 + arg2 8 print (arg3) 9 if arg3 < stop: 10 func(arg2,arg3,stop) 11 12 func (0,1,100000000000) 13 14 ''' 15 def func(arg1,arg2,stop): 16 if arg1 == 0: 17 print(arg1) 18 print(arg2) 19 20 arg3 = arg1 + arg2 21 print (arg3) 22 func(arg2, arg3, stop) 23 func (0,1,30) 24 '''
递归的实现条件 1:函数内自己调用自己,2:有明确的退出条件,要不会死循环,报错