Created
March 13, 2015 18:12
-
-
Save alexandre/04e1a3e03ee56b3cc2ad to your computer and use it in GitHub Desktop.
An example of python doctest
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 factorial(number): | |
| """Return the factorial of the parameter 'number' | |
| :number: an int object. | |
| :returns: an int object. | |
| >>> factorial(5) | |
| 120 | |
| """ | |
| return ((number <= 1 and 1) or number * factorial(number - 1)) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To test it, just run: