Certainly! Here’s a Python function to calculate the factorial of a number using recursion:
```python
def factorial(n):
"""Calculate the factorial of a number n using recursion."""
if n < 0:
raise ValueError("Factorial is not defined for negative numbers")
elif n == 0 or n == 1:
return 1
else:
return n * factorial(n - 1)
# Example usage:
# print(factorial(5)) # Output: 120
```
In this function, we


