You can download this code by clicking the button below.
This code is now available for download.
Calculates the factorial of a given non-negative integer, which is defined as n! = n * (n-1) * (n-2) * ... * 1.
Technology Stack : Recursive call
Code Type : Recursive function
Code Difficulty : Intermediate
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)