Answer:
The function in Python is as follows:
def factorial(n):
if n == 1 or n == 0:
return n
else:
return n*factorial(n-1)
Step-by-step explanation:
This defines the function
def factorial(n):
This represents the base case (0 or 1)
if n == 1 or n == 0:
It returns 0 or 1, depending on the value of n
return n
If n is positive, then this passes n - 1 to the factorial function. The process is repeated until n = 1
else:
return n*factorial(n-1)