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.

Grades 7-1045 minutesSP-CS-021

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.

READY WHEN YOU ARE

Take the plan with you.

Teacher copy — includes the answer key.

The complete PDF includes welcome pages, substitute directions, student worksheets, and answers. Give students only the worksheet pages. Check the page labels before you print or share.

Download complete teacher PDF

Opens the PDF in a new tab. Use its print controls to select the student pages you need.

Download teacher phone guide

A readable guide that opens offline in your browser. Student worksheets and answers are not included.

Free lesson · SP-CS-002Guide ↓PDF ↓

QUICK ANSWERS

In short:

This free 45-minute Computer Science sub plan for grades 7-10 teaches variables and data types: integers, floats, strings and Booleans, plus naming rules and how assignment works. Students read a short passage and trace Python-style code by hand on 11 questions, with no computers needed. Answer key included.

Frequently asked questions

What are the four basic data types in Python?

Integers (whole numbers like 42), floats (decimal numbers like 3.5), strings (text in quotation marks like "hello") and Booleans (True or False).

Why does "5" + "3" equal "53" in Python?

Quotation marks make them strings, and the + sign joins strings end to end instead of adding them. Without quotation marks, 5 + 3 gives 8.

Can a substitute teach this coding lesson without knowing how to program?

Yes. It is paper-only, students trace code by hand, and the answer key gives the exact output for every tracing question.

What grade level is Variables and Data Types for?

It is written for grades 7-10 in Technology and Computer Science (Computer Science).

How long does Variables and Data Types take?

Plan on about 45 minutes. The teacher guide breaks the period into timed steps a substitute can follow.

What does the substitute need to prepare?

Copy the reading and worksheet (pages 3-5) for each student. Write the warm-up question on the board before class.

Does this lesson need technology?

None. Paper and pencil only. Students trace code by hand; no computers needed.

Is there an answer key?

Yes. The free complete PDF (6 pages) includes substitute directions, the student pages, and a teacher answer key on pages marked TEACHER PAGE.