As you’ve learned, loops are mighty, and they are not trivial. That is why all the remaining chapters of the book are dedicated to understanding loops better. Let’s proceed to some more difficult exercises.
Choosing Text
First, you will return to the exercise with text repetition from the previous chapter and improve on it.
Task
In the section “Choosing the Number of Repetitions,” the user was allowed to vary the number of repetitions of a given sentence. Now you will allow the user to vary the sentence itself (see Figure 21-1).