Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

factorial python for loop

#Factorial 
'''factorial n! - n* n-1*n-2..1'''

def fac_iterative_method(n):
    fac = 1
    for i in range(n):
        fac = (fac * (i+1))
        print('fac of',i+1,'=',fac)
        
number = int(input('enter the number'))
fac_iterative_method(number)
Comment

PREVIOUS NEXT
Code Example
Python :: python gt index in for cycle 
Python :: numpy style docstrings 
Python :: taking string input from user in python 
Python :: equivalent of ament_index_python in noetic 
Python :: what is ycor in python turle 
Python :: import tknter 
Python :: individuare stella polare con piccolo carro 
Python :: pages.User Settings.user: (fields.W342) Setting unique=True on a Foreign Key 
Python :: using-len-for-text-but-discarding-spaces-in-the-count 
Python :: python f string columns 
Python :: python input with space 
Python :: pause program python 
Python :: how to loop through files in a directory python 
Python :: plotly title font size 
Python :: converting a string to a dictionary in python 
Python :: ellipsis in python as index 
Python :: wonsan 
Python :: matplotlib set y lim 
Python :: python gzip 
Python :: how to change the favicon in flask 
Python :: python tkinter change label text 
Python :: how to set screen brightness automatically depending on battery percentage using python 
Python :: in 2002 elon musk age 
Python :: how to make basic inventory setup in python 
Python :: chiffre cesar python 
Python :: pandas dataframe aggregations 
Python :: yapf ignore line 
Python :: pandas dataframe select rows not in list 
Python :: pandas add a column with loc 
Python :: cv2 waitkey 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =