Technology and Computer Science Computer Science
Variables and Data Types
Students read an original passage on variables and the four basic data types, then answer 11 questions (two multiple choice) that ask them to classify values, pick valid variable names and trace short Python-style code by hand.
THE GOAL
What students will learn
Students explain what a variable is, identify integers, floats, strings and Booleans, follow variable naming rules, and trace short Python-style programs by hand to predict their output.
BEFORE THE BELL
Get ready
Copy the reading and worksheet (pages 3-5) for each student. Write the warm-up question on the board before class.
KEEP THE PLAN CLOSE
Your teacher guide
Teacher directions only. Student worksheets and the answer key are in the complete PDF.
VARIABLES AND DATA TYPES
Grades 7-10 | 45 minutes | SP-CS-021
THE GOAL
Students explain what a variable is, identify integers, floats, strings and Booleans, follow variable naming rules, and trace short Python-style programs by hand to predict their output.
BEFORE THE BELL
Copy the reading and worksheet (pages 3-5) for each student. Write the warm-up question on the board before class.
- Student reading (page 3)
- Worksheet (pages 4-5)
- Pencils
STEP BY STEP
1. (5 min) Warm-up: Post this question: "A video game has to remember your name, your score and whether you have a key. Which of those are words, which are numbers, and which are yes-or-no?" Students write their answers.
2. (12 min) Read: Hand out the reading. Students read silently and write the data type in the margin next to each example value in paragraphs 3 and 6.
3. (18 min) Worksheet: Students complete questions 1-11. For tracing questions, tell them to write each variable's value on scrap paper line by line, like a scoreboard.
4. (5 min) Partner check: Partners compare answers to the tracing questions (6-9). If they disagree, they trace the code together one line at a time.
5. (5 min) Exit ticket: Students answer the exit ticket at the bottom of the worksheet. Collect everything in one stack.
NOTES FOR YOU
- You do not need to know how to code. The answer key gives every output, and the tracing method (write each value after each line) is all students need.
- The most common mistake: thinking "5" + "3" equals 8. In Python, numbers inside quotation marks are strings, so they are joined to make "53".
- Students who already code may mention other languages. That is fine; today's rules match Python 3.
EXIT TICKET (read aloud or post)
Give one example value of each data type: integer, float, string and Boolean.
EARLY FINISHERS
Early finishers write a five-line program that stores a pet's name, age, weight and whether it is vaccinated, labeling each variable's data type in a comment.
PAGES TO COPY: only pages marked STUDENT PAGE in the complete PDF. Answers are on the last teacher page.