Skip to content

Commit 866e7ef

Browse files
committed
Takes user input and calculates the factorial
1 parent 9451b9b commit 866e7ef

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Patterns/factorial_calculation.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# recursively finds the factorial of a number
2+
def factorial(number):
3+
if number == 0:
4+
return 1
5+
else:
6+
return factorial(number - 1) * number
7+
8+
print(factorial(20))

0 commit comments

Comments
 (0)