Title: For Statement
Course: CPS 120: Introduction to Computer Science ~ Master (Aug/2015) OLD > Section: Learning Units

Python For statement:

- Is a statement with an index variable, a range, and one or two blocks of code.
- At the start of each loop, the index variable takes on the next value in the range.
- Loops the number of times equal to the number values in the range.
- Is a form of definite iteration – we know exactly how many times the first block will execute.
- The first block may run 0 or more times.

<block>
is the same as
statement-1;
statement-2;
…
statement-n;

There are two layouts which you will explore on the next pages.