Outline for May 4, 2009
Reading: §8.1–8.3
- Reviewing for loops
- Syntax of a for loop
- Use of range(low, high, inc)
- Use of a list
- Example: for.py
- Indefinite loops
- while loop syntax
- while loops that are equivalent to for loops (see
while.py)
- Infinite loops
- Interactive loops
- Continuing loop depends on input (see
inter.py)
- Sentinel loops
- Loop continues until a special value (sentinel)
is reached (see
sent.py)
- File loops
- Loop continues until end of file reached (see
fileloop.py)
- Nested loops
- One loop inside another (see
internest.py,
fileloopnest.py)