Python Turtle – Draw the number 2

In this post we will be creating a Python script to draw the number ‘2’ using the turtle library. The turtle library enables us to a virtual canvas where one can draw an endless number of shapes and pictures. It is especially useful for beginners, children and programmers wanting to have some fun – The library is limited only by imagination.

See the snippet of Python code below where we use the Python turtle library to draw the number ‘2’.

import turtle

# Create a turtle object
t = turtle.Turtle()

# Move the turtle to the starting point
t.goto(100, 0)

#Draw bottom horizontal line

#Draw diagonal line

#Draw top curve, 200)

# Hide the turtle

# Exit the turtle window

The above would output the following to a canvas and leave it open.

Python Turtle - Draw number 2

If you do create your own, please do share with us as we would love to see!

Take a look at some of our other content around the Python programming language by clicking here.

Leave a Reply