def factorial(n): if n == 0 or n == 1: return 1 else: return n * factorial(n - 1) # Example usage num = 2 print(f"Factorial of {num} is {factorial(num)}")
To embed this project on your website, copy the following code and paste it into your website's HTML: