Hii guys now we are learning backward iteration in python
Backward Iteration it is a iterating a sequence of function,collection or reverse order of function. It may be from first to last or from last to first. This is useful when we need to access elements in oposite order of their original argument.
Backward iteration in python…
In backward iteration this particular task we can perform by using while loop
we are going to take a reverse of a given numbers so, now we have a example
we given the p value as starting from the initialised number ‘P’ (4) and printing the numbers in reverse order until 0 by using while loop
P = 4 print("reversed numbers are : ",end="") while(P>=0): print(P, end=" ") P -= 1
output:
reversed numbers are : 4 3 2 1 0