Write a python function to calculate factorial of a given number


Topic: Write a python function to calculate factorial of a given number

Solution

def factorial(n):
    fact = 1
    for num in range(2, n + 1):
        fact = fact * num
    return(fact)



List all Python Programs