statements + python provides built-in functionenumerate()that can be used to simplify this codefor , in enumerate( )statements enumerate(screates an iterator that simply returns sequence of tuples ( [ ])( [ ])( [ ])and so on another common looping problem concerns iterating in parallel over two or more sequences--for examplewriting loop where you want to take items from different sequences on each iteration as followss and are two sequences while len(sand len( ) [itake an item from [itake an item from statements + this code can be simplified using the zip(function for examples and are two sequences for , in zip( , )statements zip( ,tcombines sequences and into sequence of tuples ( [ ], [ ])( [ ], [ ])( [ ] [ ])and so forthstopping with the shortest of the sequences and should they be of unequal length one caution with zip(is that in python it fully consumes both and tcreating list of tuples for generators and sequences containing large amount of datathis may not be what you want the function itertools izip(achieves the same effect as zip(but generates the zipped values one at time rather than creating large list of tuples in python the zip(function also generates values in this manner to break out of loopuse the break statement for examplethis code reads lines of text from file until an empty line of text is encounteredfor line in open("foo txt")stripped line strip(if not strippedbreak blank linestop reading process the stripped line to jump to the next iteration of loop (skipping the remainder of the loop body)use the continue statement this statement tends to be used less often but is sometimes useful when the process of reversing test and indenting another level would make the program too deeply nested or unnecessarily complicated as an examplethe following loop skips all of the blank lines in filefor line in open("foo txt")stripped line strip(if not strippedcontinue skip the blank line process the stripped line lib fl ff