Think Python: How to Think Like a Computer Scientist

(singke) #1

Chapter 7. Iteration


This chapter is about iteration, which is the ability to run a block of statements repeatedly.
We saw a kind of iteration, using recursion, in “Recursion”. We saw another kind, using a
for loop, in “Simple Repetition”. In this chapter we’ll see yet another kind, using a while
statement. But first I want to say a little more about variable assignment.

Free download pdf