Last active
September 8, 2015 18:45
-
-
Save rajanand/69a433ac9f2bd4b0b27f to your computer and use it in GitHub Desktop.
To find factorial in python using recursive function
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
#factorial in python using recursion | |
# visualize: http://go.rajanand.org/python_factorial_function | |
def fact(n): | |
if n==1: | |
return n | |
return n*fact(n-1) | |
print fact(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment