Generate factorial

Kites GarbKites Garb
1 min read
def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)

# Example usage
print(factorial(5))  # Output: 120
0
Subscribe to my newsletter

Read articles from Kites Garb directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kites Garb
Kites Garb