πŸŸ₯
Coding🧸 Ages 4-6Beginner 5 min read

Patterns and Coding

A warm early-years coding lesson about patterns: spot, copy, and make patterns with colors, shapes and sounds, and see how patterns connect to real code. With quiz.

Key takeaways

  • A pattern is something that repeats in the same order again and again
  • We can find patterns in colors, shapes, sounds, and movements
  • Spotting and copying patterns helps us guess what comes next
  • Coders use patterns to make computers repeat things

What is a pattern?

A pattern is something that happens again and again, in the same order.

Look around you. Can you see stripes on a shirt? Squares on a floor? Those are patterns!

Here is a color pattern:

πŸ”΄ πŸ”΅ πŸ”΄ πŸ”΅ πŸ”΄ πŸ”΅

Red, blue, red, blue, red, blue. The two colors take turns. That is a pattern, because it keeps going the same way.

Patterns are everywhere

Patterns are not only colors. We can hear them and feel them too.

  • Shapes: ⭐ πŸ”Ί ⭐ πŸ”Ί ⭐ πŸ”Ί
  • Sounds: clap, clap, stomp, clap, clap, stomp
  • Days: morning, night, morning, night
  • Animals: a zebra has black, white, black, white stripes!

When you brush your teeth every morning, that is a pattern too. Up, down, up, down.

Spot what comes next

The fun part of patterns is guessing what comes next. When you know the order, you can guess!

Look at this:

🟑 🟒 🟑 🟒 🟑 ___

What goes in the empty spot? The colors go yellow, green, yellow, green. After yellow comes green! 🟒

Try this one with a sound pattern:

πŸ₯ πŸ₯ πŸ”” πŸ₯ πŸ₯ ___

Drum, drum, bell, drum, drum... the next one is a bell! πŸ””

You did it! You found the pattern.

Make your own pattern

Now it is your turn to be the pattern maker.

  1. Find two or three things. Maybe a spoon and a fork. Or two crayons.
  2. Put them in a row: spoon, fork, spoon, fork.
  3. Keep going! Spoon, fork, spoon, fork.
  4. Now make it longer or change it: spoon, spoon, fork, spoon, spoon, fork.

You can make a pattern with anything. Your toys. Your socks. Even claps and jumps!

Patterns and coding

Here is a secret. Patterns are a big part of coding.

When we code, we tell a computer what to do, step by step. Sometimes we want the computer to do the same thing again and again. That is just like a pattern!

Think about this clapping pattern: clap, clap, stomp. Doing it three times means: clap, clap, stomp, clap, clap, stomp, clap, clap, stomp.

Instead of saying it three times, a coder can say: "do clap, clap, stomp β€” 3 times." That short way of saying "do it again" is one of the first big ideas in coding. You can learn more in what is coding and loops and repeats.

Smart computers, like the ones that use AI, are also very good at spotting patterns. That is how a computer can guess what picture you drew!

Try it: the pattern walk

Take a walk around your home or your garden with a grown-up. Your job is to be a pattern detective. πŸ”

  • Can you find stripes? (Maybe a towel or a flag.)
  • Can you find a pattern of squares? (Maybe a window or a tile.)
  • Can you make a sound pattern with your feet? Step, step, hop!

Every time you find a pattern, say it out loud: "red, white, red, white!" The more you look, the more patterns you will see.

Patterns help your brain get ready to be a coder. Well done, pattern detective!

Quick quiz

Test yourself and earn XP

What is a pattern?

Red, blue, red, blue, red... what comes next?

Clap, clap, stomp, clap, clap, stomp. What comes after the next two claps?

Why do coders like patterns?

FAQ

It is written for young children aged about 4 to 6, with a grown-up nearby to help and play along.

Patterns teach children to notice what repeats. In coding, computers repeat steps too, so spotting patterns is a first coding skill.