Created
March 11, 2016 04:13
-
-
Save bedekelly/486a301d50a9ec558966 to your computer and use it in GitHub Desktop.
The original version of a tail-recursive countdown.
This file contains hidden or 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(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