Learning goals

  • Import the drawing module with a short name.
  • Explain how Python runs instructions in order.
  • Use a command to move a turtle forward.

Python Turtle lets you draw by giving instructions to a small arrow called a turtle. The turtle carries a pen. When it moves with the pen down, it draws a line.

A Python program is a list of instructions. Python follows them from top to bottom. In this example, the program imports the drawing module as otto and tells the turtle to move forward:

import turtle as otto

otto.forward(42)

We use the drawing module turtle and give it the short name otto. This lets us run drawing commands with otto. The command otto.forward(42) moves the turtle forward by 42 units.

A new turtle starts in the middle of the drawing area and faces to the right. Its position and direction change as it moves and turns.

Summary

Code What it does
import turtle as otto Makes drawing commands available under the short name otto.
otto.forward(distance) Moves the turtle forward by distance units.