5.5. Single and Multiple Turtles

You may remember this example as well.

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

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 below. 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 Me 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.

../_images/TwoTurtles1N.png

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 below. 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 Me 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.

../_images/TwoTurtlesLN.png

Note

Discuss topics in this section with classmates.

Show Comments
You have attempted of activities on this page