In this chapter, you learned the following:
Repeating a block of code is a fundamental way to control a program’s behavior. A for loop can be used to iterate over the items of a list, the characters of a string, and a sequence of integers generated by the built-in function range.
The most general kind of repetition is the while loop, which continues executing as long as some specified Boolean condition is true. However, the condition is tested only at the beginning of each iteration. If that condition is never false, the loop will be executed forever.
The break and continue statements can be used to change the way loops execute.
Control structures like loops and conditionals can be nested inside one another to any desired depth.