Hardware Reference
In-Depth Information
FIGURE 4-13
Using the
range
function to loop in Python
Other Python Turtle Module
Commands
Once you have mastered some Python Turtle basics to create simple shapes, you can
start to add extra lines of code to make your computer drawings more interesting.
Pen Up and Pen Down
Just as in Scratch, the Python
turtle
module includes code for the pen up and pen
down commands so that you can move the turtle cursor around the page without leav-
ing a line, just as if you were drawing a shape on a piece of paper with a pen. he code
is written as follows, surrounding the directional code.
alex.pendown()
alex.forward(100)
alex.penup()