Created
September 19, 2021 14:18
-
-
Save ppeuchin/9b8a8525b1dc6b40e5591909ec58c5c5 to your computer and use it in GitHub Desktop.
A program that returns the factorial of a number
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
# using recursion | |
def factorial(x): | |
if x == 1: | |
return 1 | |
else: | |
return x * factorial(x - 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment