Skip to content

Instantly share code, notes, and snippets.

@akaptur
Created September 29, 2014 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akaptur/e4644b765139a876c968 to your computer and use it in GitHub Desktop.
Save akaptur/e4644b765139a876c968 to your computer and use it in GitHub Desktop.
frame counter
def depth_one(n):
def depth_two(n):
def countdown(n, times_called=[0]):
times_called[0] += 1
if n == 0:
return times_called
else:
try:
return countdown(n-1)
except RuntimeError:
return countdown(n-1)
# return times_called
return countdown(n)
return depth_two(n)
print depth_one(10)
print depth_one(100)
print depth_one(1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment