This chapter introduces the reader to iteration including the “for” loop and the “while” loop. Computers are very good at doing repetitive tasks, often called iteration in Computer Science lingo. Chapter three shows the reader how to iterate over sequences in Python like strings, lists, and files. In addition, the guess and check pattern is presented again in this chapter in a format that can be used to guess and check assumptions about all elements of a sequence.
Mutability of data and the accumulator pattern are important ideas that are described in this chapter along with examples and practice problems that help the reader understand and apply these concepts.
KeywordsString Operator Space Character Range Function String Class Practice Problem
- 15.Wikipedia. W. edwards deming, 2010. [Online; accessed 1/29/2010; http://en.wikipedia.org/wiki/William_Deming].