17.4. Single and Multiple Turtles¶
Run the code to see what it draws.
Run the code to see what it draws.
This works because zari
is a turtle, and each statement gets executed, one right after the other. If we introduce another turtle and another name, it doesn’t work the same
Run the code to see what it draws.
Every turtle object has its own attributes like its current position and color. So, when we created chad his position was different from zari’s. Turtles start off in the center of the drawing space when they are first created.
Mixed up programs
The following program has one turtle, “jamal”, draw a capital L in blue and then another, “tina”, draw a line to the west in orange as shown to the left. The program should do all set-up, have “jamal” draw the L, and then have “tina” draw the line. Drag the blocks of statements from the left column to the right column and put them in the right order. Then click on Check to see if you are right. You will be told if any of the lines are in the wrong order or are the wrong blocks.
The following program has one turtle, “jamal”, draw a line to the north in blue and then another, “tina”, draw a line to the east in orange as shown to the left. The program should import the turtle module, get the window to draw on, create the turtle “jamal”, have it draw a line to the north, then create the turtle “tina”, and have it draw a line to the east. Drag the blocks of statements from the left column to the right column and put them in the right order. Then click on Check to see if you are right. You will be told if any of the lines are in the wrong order or are the wrong blocks.