To see what is range() function and recursion in python and its important uses.
It generates sequence of numbers in a given interval.
It starts its index position as zero, unless index position is declared explicitly.
Above code produce 0,1,2,3,4
Its very useful for generating loop sequence like pattern programs, prime numbers ,etc..
Which function is called by itself when the program is running, that is called recursive function.
Recursion works like a loop.
Source code(Floyd pattern):
#Get input from user
n = int(input
(“Enter the number of rows:”))
#make first loop sequence
for i in range(n+1):
#make second loop
for j in range(i):
#printing the pattern
Source code(Factorial program):
print(“Factorial using recursion******”)
#get input from user
n=int(input(“Enter the number:”))
#method calling statements
print(“the factorial of given number is:”,