January 2017
Intermediate to advanced
606 pages
14h 1m
English
3.2 Iteration (for and while Statements)
The functions that we have developed so far had the property that each instruction in a function was executed exactly once. Further, the instructions in these functions were executed in the order in which they appeared in the functions. Such functions are called straight line functions. However, real life problems would usually require non-sequential and repetitive execution of instructions. Python provides various control structures for this purpose. In this chapter, we will study the following control structures with suitable examples: if, for, and while.
control structures are used for non-sequential and repetitive execution ...