We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 305d1f9 commit bd269f2Copy full SHA for bd269f2
pygorithm/math/factorial.py
@@ -0,0 +1,19 @@
1
+"""
2
+Author: OMKAR PATHAK
3
+Created On: 22 August 2017
4
5
+
6
+def factorial(number):
7
+ ''' This function calculates the factorial of a number '''
8
+ if not isinstance(number, int):
9
+ raise Exception('Enter an integer number to find the factorial')
10
+ if number == 1 or number == 0:
11
+ return 1
12
+ else:
13
+ return number * factorial(number - 1)
14
15
+def get_code():
16
+ """
17
+ returns the code for the factorial function
18
19
+ return inspect.getsource(factorial)
0 commit comments