0Pricing
Coding for Kids · Lesson

A Colorful Pattern

Make turtle art.

A Colorful Pattern is a free Coding for Kids lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Coding for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Make Turtle Art! 🎨🐢

Today we become real artists! 🖼️ We'll combine colors, shapes, and loops to make a beautiful PATTERN.

A pattern is something that repeats in a cool way. Let's create masterpieces! 🤩

import turtle

t = turtle.Turtle()
t.speed(0)
t.circle(50)

Spinning Squares 🟦🌀

Let's draw a square, turn a little, and repeat! The squares spin into a flower pattern. 💠

We draw a square (4 sides) inside a loop that turns each time.

import turtle

t = turtle.Turtle()
t.speed(0)
for i in range(12):
    for s in range(4):
        t.forward(80)
        t.right(90)
    t.right(30)

A Loop Inside a Loop! 🔁🔁

Whoa, did you see TWO loops? 😮 The inside loop draws one square. The outside loop spins it around!

This is called a loop inside a loop. Super powerful for patterns! 💪

import turtle

t = turtle.Turtle()
t.speed(0)
for i in range(6):
    for s in range(3):
        t.forward(90)
        t.right(120)
    t.right(60)

Add Rainbow Colors! 🌈

Let's pick a new color each time the pattern spins. 🎨

We make a list of colors and use colors[i] to pick one each loop.

import turtle

t = turtle.Turtle()
t.speed(0)
colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple']
for i in range(6):
    t.pencolor(colors[i])
    t.circle(70)
    t.right(60)

A Rainbow Spiral 🌀🌈

Spirals are magic! We go forward a little MORE each time and turn. 🌪️

Watch it grow bigger and bigger in rainbow colors!

import turtle

t = turtle.Turtle()
t.speed(0)
colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple']
for i in range(60):
    t.pencolor(colors[i % 6])
    t.forward(i * 2)
    t.right(59)

What Is i % 6?

That funny i % 6 gives the remainder when dividing by 6. It goes 0,1,2,3,4,5,0,1,2... 🔄

This lets us cycle through our 6 colors forever! The rainbow never runs out! 🌈

for i in range(8):
    print(i % 3)

A Field of Stars ⭐⭐⭐

Let's spin a star around! A star turns 144 degrees at each point.

Draw a star, turn a bit, repeat. A galaxy of stars! 🌌

import turtle

t = turtle.Turtle()
t.speed(0)
t.pencolor('gold')
for i in range(10):
    for p in range(5):
        t.forward(60)
        t.right(144)
    t.right(36)

Fill the Pattern With Color 🪣

Remember begin_fill and end_fill? Let's fill our spinning triangles! 🔺

Each triangle gets poured full of color as it spins. Gorgeous! 💜

import turtle

t = turtle.Turtle()
t.speed(0)
t.fillcolor('violet')
for i in range(8):
    t.begin_fill()
    for s in range(3):
        t.forward(70)
        t.right(120)
    t.end_fill()
    t.right(45)

Add a Background 🖼️

A dark background makes bright colors POP! ✨

Use turtle.bgcolor('black') and watch your neon pattern glow! 🌟

import turtle

turtle.bgcolor('black')
t = turtle.Turtle()
t.speed(0)
colors = ['cyan', 'magenta', 'yellow', 'lime']
for i in range(40):
    t.pencolor(colors[i % 4])
    t.forward(i * 3)
    t.right(91)

Tip: Speed 0 Is Fastest 🏎️

Patterns have LOTS of lines. To see them quickly, always use t.speed(0)! 💨

That's the fastest setting. Your art appears in a flash! ⚡

import turtle

t = turtle.Turtle()
t.speed(0)
for i in range(36):
    t.forward(100)
    t.right(170)

Create Your Masterpiece! 🎨🌟

Now make YOUR pattern! Change the colors, the number of repeats, and the turn angle. 🤩

Try different numbers in right(...) and range(...). Every change makes new art! 🖼️

import turtle

turtle.bgcolor('navy')
t = turtle.Turtle()
t.speed(0)
colors = ['white', 'pink', 'cyan']
for i in range(50):
    t.pencolor(colors[i % 3])
    t.forward(i * 2)
    t.right(89)

Quick Check ✅

Final brain teaser of the course! 🧠🎨

You're a Turtle Artist! 🏆🎨

AMAZING work! You finished Colorful Shape Art! 🎉 You learned:

  • Loops inside loops make patterns 🔁🔁
  • Color lists with colors[i % 6] for rainbows 🌈
  • Spirals grow with forward(i * 2) 🌀
  • Backgrounds make colors POP ✨

You can now make any pattern you imagine! Keep creating! 🤩🐢

Frequently asked questions

Is the “A Colorful Pattern” lesson free?

Yes — the full text of “A Colorful Pattern” is free to read here on the web, and the Coding for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Coding for Kids course, upgrade to CoddyKit PRO.

What will I learn in “A Colorful Pattern”?

Make turtle art. You practise Coding for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Coding for Kids?

No prior experience is required. Coding for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “A Colorful Pattern” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Coding for Kids lesson?

Yes. Every Coding for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Turtle Colors
  2. Filling Shapes
  3. Many Shapes
  4. A Colorful Pattern
← Back to Coding for Kids