Last active
August 29, 2015 14:07
-
-
Save akaptur/3528d9911054bd75eaf4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def countdown(n, times_called=[0]): | |
print times_called[0], " ", n, " " | |
times_called[0] += 1 | |
if n == 1: | |
return times_called | |
else: | |
try: | |
return countdown(n-1) | |
except RuntimeError: | |
print "\nexception at %s" % times_called[0]: | |
return countdown(n-1) | |
print(countdown(1010)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output: