get factorial in python code example
Example 1: Find faculty of a number python
#Assumes n is possitive
def factorial(n):
return 1 if n <=1 else n*factorial(n-1)
Example 2: factorial in python
def fact(n):
return 1 if (n==0 or n==1) else n*fact(n-1)
fact(3)