A Program to Find Factorial of a Number
In this example, we are giving a program to find the factorial of a number.
Program to find a factorial number:
def factorial(n):# Single line to find factorialreturn 1 if (n==1 or n==0) else n * factorial(n - 1);num = 5print("Factorial of",num,"is"factorial(num))
Output:
Factorial of 5 is 120