Python学习第五天——递归函数
程序员文章站
2022-09-26 19:55:16
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) ......
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:\ProgramData\Anaconda3\python.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
上一篇: 现在过得怎么样逼B