Created
June 16, 2014 11:36
-
-
Save mashcom/e55cc1635601efc5d2fe to your computer and use it in GitHub Desktop.
calculate factorials in python.
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
# calculate factorial | |
# @author: Mashoko Blessing | |
# @http://www.facebook.com/blessing.mashcom | |
# @mashcom digimedia http://www.hookd-up.com | |
#email: bmashcom@hotmail.com | |
def factorial(x): | |
if(x==0): | |
return 1 | |
else: | |
return x*factorial(x-1) | |
print("please enter the number you want to do a factorial for \n") | |
x= input() | |
print(factorial(int(x))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment