Back to blog
Back to blog
Python
Draw Rainbow Art with Python Turtle
Turn a few lines of code into spinning rainbow spirals using Python's built-in drawing robot.
Mia 12 September 2026 5 min read
Turtle is a tiny robot that lives inside Python. You tell it to move forward and turn, and it leaves a trail of colour behind it.
Wake up the turtle
python
1import turtle
2
3pen = turtle.Turtle()
4pen.speed(0)
5pen.pensize(3)
Spin a rainbow spiral
Each time around the loop the turtle picks the next colour, walks a bit further and turns just past a right angle. That small extra turn is what makes the spiral swirl.
python
1colors = ["red", "orange", "gold", "green", "blue", "purple"]
2
3for step in range(120):
4 pen.color(colors[step % len(colors)])
5 pen.forward(step * 2)
6 pen.right(91)
7
8turtle.done()
Tiny changes, huge difference
- Change right(91) to right(121) for a triangle flower.
- Swap the colour list for your favourite team colours.
- Use pen.circle(step) instead of forward for bubble art.
Try it yourself
Make an art generator that looks different every time you run it.
- 1Import the random module at the top of your file.
- 2Pick the turn angle with random.randint(80, 130).
- 3Print the angle you used so you can save your favourites.
- 4Screenshot your best spiral and show it to a friend.
Keep going
Python
Learn Python Basics in One Afternoon
Print your first message, store information in variables and make the computer repeat things for you.
Adam20 Sept 2026 · 6 min
MinecraftPython
Redstone Is Really Just Computer Logic
Doors, traps and secret bases: learn AND, OR and NOT gates by building them out of redstone.
Nora14 Aug 2026 · 5 min
PythonWeb Dev
Debugging Like a Pro (Even When You Are 10)
Errors are not failures, they are clues. Here is the routine real developers use to squash bugs.
Adam28 Jul 2026 · 4 min