1 #coding=utf-8 2 #Version:python 3.6.0 3 #Tools:Pycharm 2017.3.2 4 _date_ = '2018/4/18/018 17:17' 5 _author_ = 'Hongyong' 6 7 def cal(n): 8 print(n) 9 if n == 0: 10 exit() 11 return cal(n-1) 12 13 cal(10)
E:ProgramDataAnaconda3python.exe D:/Python_proc/s14/week3/day2/递归函数.py 10 9 8 7 6 5 4 3 2 1 0 Process finished with exit code 0