Advertisement
here2share

# recursive_limit_of_999.py

Jan 20th, 2020
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. # recursive_limit_of_999.py
  2.  
  3. def recursive(limit, n=0):
  4.     if n >= limit:
  5.         return n
  6.     return recursive(limit, n + 1)
  7.  
  8. for z in [998,50,999]:
  9.     try:
  10.         print recursive(z)
  11.     except:
  12.         print z, '!!! RuntimeError: Maximum Recursion Depth Exceeded'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement