Created
June 8, 2020 07:24
-
-
Save abhi923/1f78b8cce1a1ae4e4f1bd25ffc275f83 to your computer and use it in GitHub Desktop.
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
def factorialFun(n): | |
if n < 0: | |
return None | |
if n < 2: | |
return 1 | |
product = 1 | |
for i in range(2, n + 1): | |
product *= i | |
return product | |
for n in range(1, 6): # testing | |
print(n, factorialFun(n)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment