In [13]:
from functools import reduce
def fact(n):
"""
Returns the factorial of the given positive number.
If the given number is negative returns 0
Inputs:
@n: The number to calculate
Outputs:
The Factorial
"""
if n > 0:
fact_lamba = lambda x, y: x * y
return reduce(fact_lamba, range(1,n+1))
return 0
In [ ]: