Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

def factorial python

def factorial(n):            # Define a function and passing a parameter
        fact = 1                 # Declare a variable fact and set the initial value=1 
        for i in range(1,n+1,1): # Using loop for iteration
            fact = fact*i            
        print(fact)              # Print the value of fact(You can also use "return")

factorial(n) // Calling the function and passing the parameter
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #def #factorial #python
ADD COMMENT
Topic
Name
4+3 =