Some time you may faced a situation where you need to execute a block of code
several number of times. Programming languages provide control statements with
repetition statements known as loops, which repeat an action.
Two types of loop
- Definite loop
- Indefinite loop
: In this type, action is repeated predefined number of times.
: In this type, action is repeated until the program determines that it need to stop
In this page we will study about for
Before explaining the loop you should be acquainted with function range()
It generates lists containing arithmetic progressions.
range(start-value, end-value, difference between the values)
Description of image
So you have understood from example how function range()
Python has another range function called xrange()
xrange(start-value, end-value, difference between the values)
allowing the memory to be freed,
when the range list is not in use beacuse xrange()
populates its range list whenever it is accessed by means of such as for
In next page you will see for