Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
230 B
2
Indexable
Never
def factorial(n):
    if n == 0 or n == 1:
        return 1
    else:
        return n * factorial(n - 1)

# Example: Calculate factorial of 5
number = 5
result = factorial(number)
print(f"The factorial of {number} is: {result}")
Leave a Comment