Untitled

Anonymous
plain_text
01/31/2024 7:20 AM
308 B
18
Indexable
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}")
Editor is loading...
Leave a Comment