Skip to content

Instantly share code, notes, and snippets.

@bedekelly
Created March 11, 2016 04:13
Show Gist options
  • Select an option

  • Save bedekelly/486a301d50a9ec558966 to your computer and use it in GitHub Desktop.

Select an option

Save bedekelly/486a301d50a9ec558966 to your computer and use it in GitHub Desktop.
The original version of a tail-recursive countdown.
def countdown(a, b):
"""Count down from a to b, printing the numbers, and return b."""
print(a)
if a == b:
return b
else:
return countdown(a-1, b)
x = countdown(10000, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment