Drawings with repeated patterns can be created using for
. To repeat a piece of code three times, the code to be repeated should be indented neatly under for [1..3]
. What does it look like if it is repeated 5 or 6 times, or just once or twice?
You can number each dot by using a loop variable x
, if you change the loop to say for x in [1..6]
, then, after drawing a dot, add the command label x
. What is the value of x
each time the code repeats?
How would we make a bracelet with more than six beads? When the turtle makes a full circle, it will make a total of 360 degrees of turns. With six beads, that is 360/6=60 degrees per bead. For twenty beads, that would be 360/20=18 degrees per bead.