What are Python Turtles?

One of the strengths of Python is that we can pull in ready-made features to make building our own programs easier. Instead of figuring out how to do all of the nitty-gritty details ourselves, we can use a module that already contains the code we need. Think of a module like a plug-and-play attachment for your phone or computer. All you need to do to use a module is import it.

There are many modules in Python that provide very powerful features. Some of these can send email or fetch web pages. Others allow us to perform complex mathematical calculations.

In this chapter we use a module that allows us to create an object called a turtle that can be used to draw pictures.

Drawing turtle graphics is based on a very simple metaphor. Imagine you have a pet turtle who understands English. You give your turtle simple commands such as, “Go forward,” and, “Turn right.” As the turtle moves around, if its tail is down touching the ground, it will draw a line (leave a trail behind) as it moves. If you tell your turtle to lift up its tail, it can still move around but will not leave a trail.

Given it’s simplicity, you can still make some pretty amazing drawings with the turtle module.


Turtles are fun! As you use this book to practice Python and learn to think like a programmer, we will use turtles from time to time to liven things up.