08/10/2024
🚀 Ready for a code challenge? Try writing a Python function that calculates the factorial of a number! Share your solution in the comments below! 💻
Here is code
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
# Test the function
print(factorial(5))