Turtle Art Challenge
Recreate six drawings with Python turtle commands — loops do the hard work.
Turtle commands (API)
- forward(n)
- Draw a line n units ahead.
fd(n)is the short name. - backward(n)
- Move n units backwards, drawing as it goes.
- right(deg)
- Turn clockwise by deg degrees.
rt(deg)for short. - left(deg)
- Turn anticlockwise.
lt(deg)for short. - penup()
- Lift the pen — movement no longer draws.
- pendown()
- Put the pen back down.
- goto(x, y)
- Move straight to a point. The turtle starts at (0, 0).
- home()
- Return to (0, 0) facing right.
- setheading(deg)
- Point in an absolute direction: 0 is right, 90 is up.
- color(name)
- red, blue, green, yellow, orange, purple, pink, cyan, white, black, grey — or a #hex value.
- width(n)
- Line thickness, 1 to 20.
- circle(r)
- Draw a circle of radius r (an arc with
circle(r, degrees)). - say(x)
- Print a message to the console while you debug.
How to play
Each level shows a faint grey outline: that is the drawing you have to reproduce. The turtle starts in the middle of the canvas facing right. Write Python in the editor, press Draw, and your strokes are animated onto the canvas in blue. Match the ghost and the level is complete.
The first drawing is a square, and the whole idea of the game is visible in it. You could write eight lines:
forward(100)
right(90)
forward(100)
right(90)
forward(100)
right(90)
forward(100)
right(90)
…or you could notice the repetition and write the version a programmer writes:
for _ in range(4):
forward(100)
right(90)
By the flower level that difference stops being cosmetic. Twelve squares at twelve angles is 96 commands by hand, or five lines with a loop inside a loop:
for _ in range(12):
for _ in range(4):
forward(60)
right(90)
right(30)
The angle rule worth remembering
Beginners nearly always use the wrong angle on the triangle. The turtle does not turn by the interior angle of the shape (60° for an equilateral triangle) — it turns by the exterior angle, and the exterior angles of any closed shape add up to 360°. So a triangle turns 360 / 3 = 120° at each corner, a square 360 / 4 = 90°, a pentagon 72°. The five-pointed star is the exception that proves the rule: the path wraps around the centre twice, so the turn is 720 / 5 = 144°.
What you practise
- Loops — counted repetition with
range(), and the loop counter as data (forward(i * 6)). - Nested loops — the clearest visual demonstration of an inner loop running completely for every outer step.
- Decomposition — most players end up writing
def square(size):and calling it, which is exactly the right instinct. - Debugging by observation — when the drawing is wrong you can see which command misbehaved.
Frequently asked questions
Is this the real Python turtle module?
It is a faithful subset with the same command names — forward, right, penup, goto, circle and so on — running on a real Python interpreter in your browser. Code you write here reads exactly like turtle code on a desktop; the desktop module simply has more options.
How is my drawing checked?
Your strokes and the target are both rasterised onto the same grid and compared. You pass when at least 90% of the target is covered and no more than 15% of your lines fall outside it, so small wobbles are fine but a different shape is not.
What if I draw the right shape in the wrong place?
Position matters, because every level starts the turtle at the same point facing right. If your shape is correct but offset, check for an extra move before the drawing starts.
Which Python concepts does turtle graphics teach?
Loops above all: a square is four repeats, a flower is a loop inside a loop. You also meet the counter variable (forward(i * 6) in the spiral), functions, and the geometry fact that the exterior angles of any closed shape add up to 360°.
Can I draw my own pictures?
Yes — delete the starter code and experiment. The canvas rescales to fit whatever you draw. For bigger projects, the Coding Python app runs the full standard library on your phone.