diff options
Diffstat (limited to 'data/math/factorial')
-rw-r--r-- | data/math/factorial | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/data/math/factorial b/data/math/factorial index bbe5a20..c5b9ce7 100644 --- a/data/math/factorial +++ b/data/math/factorial @@ -1,5 +1,6 @@ import time + def factorial_recursive(number): """ Define a factorial function in recursive flavor """ result = 1 @@ -8,6 +9,7 @@ def factorial_recursive(number): print 'factorizing: ', number, ' result: ', result return result + def factorial_iterative(number): """ Define a factorial function in iterative flavor """ result = 1 @@ -16,6 +18,7 @@ def factorial_iterative(number): print 'factorizing: ', i, ' result: ', result return result + def calculate(number, type): """ Calculate factorial using recursive and iterative methods """ start = time.time() |