GET NEW FUZZES to support Computer Science! Donate $1 Learn More

Advanced

Third Grade


Programming concept covered:

Variables

Time: 45-55 minutes

Lesson Materials

  • Vocab and image cards
  • Paper
  • Pencils
  • Two envelopes
  • A place to track questions
  • Kodable on-screen (web, desktop, iPad, or Android)
    Available at Kodable.com/download
Download Teaching Materials

Print Lesson Plan

Get a free teacher account

Objectives


  1. Students will be able to identify variables and values.
  2. Students will be able to store values.
  3. Students will be able to change the values in a defined variable.
  4. Students will be able to connect variables to foundational programming concepts (sequence, conditions, loops, functions).

Vocabulary


  • Variable: A variable stores information in a program and controls the output of the program (what the user sees).

  • Value: A value is the information being stored in a variable and can be written as text (strings) or numbers (integers).

  • String: A variable that holds a group of characters, like a word or phrase.

  • Integer: A value written and stored as a number. Integers are often called “ints” and can be used to store values and run loops in a program.

  • Array: An array is an ordered list of variables and includes both strings and integers.

  • Program: A set of instructions (given to a computer in code from a programmer) that performs a specific task when carried out by a computer.

  • Code: The language that programmers use and create to tell computers what to do.

  • Command: Instruction given by a person (programmer) that tells a computer to do something.

Direct Instruction (I do)


Review:
Review what a program is, how programs run effectively (sequence), what a programmer does, and how code allows programmers to communicate with computers. Talk about elements of programming that allow programmers to save time and build more complex, dynamic programs (loops and functions).
Use the Sequence, Loops, and Functions vocab cards and images to guide review.

Introduce: 
T (say): “We know that programmers communicate with computers by using commands in a language called code. This tells the computer what to do. Computers follow these instructions in order to execute a task.

This is all done ‘behind the scenes’ and the only one who sees this code is the programmer. When we play a game or visit a website we don’t see code, or the communication happening between the program and the computer.”

Think, Pair, Share

“Think about your favorite app, game, or website. What does it look like? Talk to your partner about what you see as the user- the person visiting the website or playing the game.” Prompt students as needed: Colors, characters, size, words, images, etc  

T (say): “In programming, programmers use something called variables in their code. Variables store information in a program. You can think of variables like a box or a container with a name on them, related to the things inside. These items inside are called values, which can be stored as text or numbers.  When you use a variable in a program, you’re able to control the output of the program, or what a user sees.

There are different types of variables that are used in different situations: strings, integers, and arrays.  Strings are used when the value is a group of characters, like a word or a phrase. Integers are used when the value is a whole number, like 0, 1, 5, or -5.  Arrays are an ordered list of variables and are used to group related variables together.

Variables allow programmers to easily store, find, and change information, as well as reuse values in a program. Variables can change, and strings, integers, and arrays make it easy for programmers to read and change values that are assigned to different variables throughout a program.

An easy way to think about variables in our everyday lives is to think about names of people we know. Names are like string variables because they are made up of characters (letters).  Think about the way your brain stores people’s names: a name is a value that your brain uses to identify a person. Variables have values that can change, just like a person can have nicknames, or their last name can change if the get married.

Today, we are going to practice changing values that are associated with a string variable!"

Guided Practice

In a class game of “10 Questions”, students will input ideas (values) into an envelope (variable) to practice changing values associated with a variable.

Activity Materials

  1. Paper for each student
  2. Pencil for each student
  3. Two labeled envelopes: “violetFuzzThought” and “future_violetFuzz Thought”
  4. A place to track number of questions (white board, smart board, chalkboard, chart paper, etc.)

Activity

T (say): “violetFuzz is thinking of something that she wants you to guess. She’s only going to give you 10 questions to try and guess what it is. Can you figure out what the value of the variable is in 10 questions or less?
”

 Ask each student to write down a common noun (person, place, or thing) on their piece of paper and keep it hidden. Encourage all students to choose an object that everyone would be familiar with. Examples might include a flag, a turtle, a rose, the Stanley Cup, Las Vegas, or President Obama.

Collect all of the variable suggestions and place them into the envelope labeled “future_violetFuzzThought.” Choose one piece and place it in the envelope labeled “violetFuzzThought.”

Select one student to be violetFuzz and begin playing “10 questions.” “Violet” reads the (value) in the envelope labeled “violetFuzzThought” (variable) silently. After the student has read the value, the guessing begins!

Students take turns and ask “yes” or “no” questions in an attempt to figure out what the value of violetFuzzThought is. Record each guess, keeping track of the number of guesses that are used until the limit of 10 is reached. If a student correctly guesses the value before then, they become violetFuzz for the next game and choose the next value (from the variable future_violetFuzzThought).

Otherwise, the value is revealed and the original violetFuzz may choose the next student to be violetFuzz. Repeat as many rounds as necessary or time allows for.

Independent Practice

Students independently practice the concept on their devices in Asteroidia Celestial Strings, "String Beans" 5.1-5.5

Exit Ticket: Meteor Shower

Students write down what they learned or one question they have from the lesson. Once all students have written their response, everyone crumples their paper into a ball, which represents a meteor. On your count, students toss their responses into the air, creating a “meteor shower.”

Each student must find a classmate’s meteor to read and respond to.

enter your email address and we'll deliver it to you right away!