This post may contain affiliate links.
Variables are a very important basic concept of coding. In this activity, we will show you how to teach young children about variables using a fun ‘Mad-Libs’ like game. I remember absolutely loving ‘Mad Libs’ as a child, and I can’t wait to share this fun way to get kids thinking about coding at an early age! This nursery rhyme coding game is super easy and fun and I’m sure your kids will love it.
What is a variable?
You can think of a variable in computer programming as being like a container. It stores information, or data so that computers can easily retrieve it later. In this activity, we will represent each variable with a jar as it will help us to remember that variables can store things.
What is a Value?
A value is a word for the information stored in a variable. Variables store values and values can include different types of information such as letters, numbers, or words.
Nursery Rhyme Coding Game
In the game, students will be given four nursery rhymes with blank spaces where words are missing. They are our variables and students will need to come up with values (words) to include as options in the rhyme.
- 3 jars
- Paper scraps for students to write words on
- Printouts of the nursery rhyme (pdf here)
How to play the Nursery Rhyme Coding Game:
There are three variables in our nursery rhyme game. These are:
We could easily call these variables X, Y, and Z however the names we have chosen help us to remember what kind of value to store in a variable.
Label all three jars with the variable names ‘noun’, ‘verb’, and ‘adjective’.
Have students come up with a list of values for each of the three variables. Each value can be written on a scrap piece of paper and thrown into the variable jar.
Examples of values for the variable ‘adjective’
Download the nursery rhymes here. Students read through the nursery rhymes. Each time they reach a variable in the story, they can draw a value out of the variable jar. The sillier the results the better!
Extra Challenge Ideas:
- Try using more complex stories with different variables to make this exercise even more challenging!
- Have students come up with their own nursery rhyme, poem, or story.
Pin for Later!
Katie is mom of two rambunctious boys and a self-proclaimed super nerd. With a background in neuroscience, she is passionate about sharing her love of all things STEM with her kids. She loves to find creative ways to teach kids computer science and geek out about coding and math. You can find her blogging at Teach Your Kids Code.