The other looping mechanism in Python comes to us in the form of the for statement. Unlike the traditional conditional looping for statement found in mainstream third generation languages (3GLs) like C, Fortran, or Pascal, Python’s for is more akin to a
scripting language’s iterative foreach loop.
Iterative loops index through individual elements of a set and terminate when all the items are exhausted. Python’s for statement iterates only through sequences, as indicated in the general syntax here:
for items in sequence: statement1; statement2; . . statementN
>>> nameList = ['Walter', "Nicole", 'Steven', 'Henry'] >>> for eachName in nameList: print eachName Walter Nicole Steven Henry