Assign a Name to a Turtle

Learning Objectives:

Names can be more than numbers and strings. They can also be turtles or “screens” (a space on the page where a turtle can draw). You can also call things like turtles and screens objects. Objects in programming are the things that do the action in a program. Objects can have attributes and behavior. An example of an attribute is a position and an example of a behavior is the ability to go forward.

We have seen the example below once before. It allows us to use the turtle library, creates a space for a turtle object to draw on, creates a turtle object and names it alex, asks alex to go forward by 150 pixels, asks alex to turn left 90 degrees, and asks alex to go forward 75 pixels.

What does a left turn of 90 mean?

When we ask a turtle to turn left, it will turn left based on the direction it is currently heading. A turtle object keeps track of its heading (direction it is facing). Use the figure below to help you understand how much the turtle will turn if asked to turn left 90 degrees and it is currently heading east (0 degrees).

shows what a turn of each degrees means for left and right turns

Figure 1: The amount of turn for specified degrees for left and right turns

Mixed up programs

Note

The following problem has a Help Me button. You can click on the Help Me button after you have made at least 3 full and distinct attempts to solve the problem to make the problem easier.

You have attempted of activities on this page