Loops Are Fun (You Can Say That Again) 59
and w six times each. At v, we’re still drawing a circle with a
radius of 100. At w, though, we’re turning only 60 degrees each
turn, or one-sixth of 360 degrees, so we get six circles around the
center of the screen this time, as shown in Figure 4-2.
Figure 4-2: A rosette of six circles
The rosette with six circles is even prettier than the one with
four circles, and thanks to our for loop, we didn’t have to write
any more lines of code to get six circles than we did to get four—we
just changed two numbers! Because we varied those two numbers,
you may be tempted to replace them with a variable. Let’s give in
to that temptation. Let’s give the user the power to draw a rosette
with any number of circles.
i proving m our rosette program
with user input
In this section, we’ll use the turtle.numinput() function that we
saw in Chapter 3 (see ColorSpiralInput.py on page 47) to write
a program that asks the user to enter a number and then draws a
rosette with that number of circles. We’ll set the user’s number as
the size of our range() constructor. Then, all we have to do is divide