Intro to Python: Variables & Data Types
Practice Worksheet
Grades: 6–8 Subject: Computer Science / ICT
Student Name: ____________________ Grade: ____________________
Section A: Understanding Variables
1. What is a variable in Python?
__________________________________________________________________________________________
__________________________________________________________________________________________
2. Why do we use variables in programming?
__________________________________________________________________________________________
__________________________________________________________________________________________
3. Write one rule for naming variables in Python.
__________________________________________________________________________________________
__________________________________________________________________________________________
Section B: Identify the Data Type
Value Data Type
10
3.14
"Hello"
True
"25"
Section C: Match the Variable to Its Value
# Answer Variables Values
1. age A. “Python”
2. price B. False
3. language C. 12
4. is_student D. 9.99
Created by Nawaz Bashir Page 1 of 3 © Personal classroom use only
Section D: Predict the Data Type
x = 15
y = "School"
z = 2.5
a = False
Variable Data Type
x
y
z
a
Section E: Spot the Error
Circle the incorrect variable name and explain why:
student_name 2marks totalMarks
Explanation:
__________________________________________________________________________________________
__________________________________________________________________________________________
Section F: Challenge Question
What will be the data type of result and why?
result = "10"
Answer:
__________________________________________________________________________________________
__________________________________________________________________________________________
Created by Nawaz Bashir Page 2 of 3 © Personal classroom use only
ANSWER KEY (For Teacher Reference Only)
Section A:
1. A variable stores data in a program.
2. To store and reuse values.
3. Cannot start with a number / no spaces.
Section B:
10 – int
3.14 – float
"Hello" – string
True – boolean
"25" – string
Section C:
1–C, 2–D, 3–A, 4–B
Section D:
x – int
y – string
z – float
a – boolean
Section E:
2marks is incorrect (starts with a number)
Section F:
string - The value "10" is enclosed in quotation marks, so Python treats it as text rather than a number.
More Computer Science worksheets available in my TPT store.
Created by Nawaz Bashir Page 3 of 3 © Personal classroom use only