Chapter 4. Loops Are Fun (You Can Say That Again)
We’ve used loops since our very first program to draw repeating shapes. Now it’s time to learn how to build our own loops from scratch. Whenever we need to do something over and over again in a program, loops allow us to repeat those steps without having to type each one separately. Figure 4-1 shows a visual example—a rosette made up of four circles.
Figure 4-1. A four-circle rosette pattern
Let’s think about how we might write a program to draw four circles overlapping as shown. As you saw in Chapter 2, Turtle’s
circle() command draws a circle with the radius we specify inside its parentheses. Those ...