Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

for loop

# example of forloop and return through factorial
def fact(m):# function factorial
    a=1
    for e in range(1,m+1):#we will be using for loop
        a*=e
    return a#return function
x= 5 # put the value in x eg, 5
d=fact(x)
print(d)

output:
120==5*4*3*2*1
-------------------------------------------------------------------------------
 
PREVIOUS NEXT
Tagged: #loop
ADD COMMENT
Topic
Name
8+4 =