正在加载图片...
The Cascade Function 1 def cascade(n): Global frame func cascade(n)[p=G] 1fn<10: 2 print(n) cascade 4 else: 5 :print(n): f1:cascade [p=G] 6 cascade(n//10) 47 print(n) n123 8 。中。。t。。。 9 cascade(123) f2:cascade [p=G] 12 Each cascade frame is Return value None from a different call to cascade. Output Base cas∥ f3:cascade【p=G] 123 n 1 Until the Return value Return 12 value None appears,that call has 1 not completed. 12 Any statement can...... appear:before:or after the recursive call.The Cascade Function Each cascade frame is from a different call to cascade. Until the Return value appears, that call has not completed. Any statement can appear before or after the recursive call. Output 123 12 1 12 Base case
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有