/* */ Click to Join Live Class with Shankar sir Call 9798158723

Python for loop statement


A the for in statement is a looping statement used in python to iterate over a sequence of objects, i.e go through each item in a sequence hear by sequence we mean just an ordered collection of items .

Syntax of python for in


for var in sequence:

   statement


How for Loop Works in python

the first element of the sequence is assigned to the variable written after for and then the statements are executed nest the second element of the sequence is assigned to the variable and then the statement are executed second time. in theis way for each element of the sequence the statement are excuted onece so the for loop is executed as many time as there are number of elements in the sequence.

Note:- All statements and instructions in a program are built with tokens.