Factorial function : Function Define « Function « Python






Factorial function

Factorial function
 

def factorial(n):
    result = n
    for i in range(1,n):
        result *= i
    return result


print factorial(10)
           
         
  








Related examples in the same category

1.A function definitionA function definition
2.Power functionPower function
3.Define simple function in PythonDefine simple function in Python
4.A function that writes the Fibonacci series to an arbitrary boundaryA function that writes the Fibonacci series to an arbitrary boundary
5.Define a function in PythonDefine a function in Python
6.Function call