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