The data type decides what you can do

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

The data type decides what you can do

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which value can you sensibly multiply?
A 7 * 3
B "Mia" * "Leo"
2. Which operation makes sense for text?
A Dividing "sun" by "shine"
B Joining "sun" and "shine" to make "sunshine"
3. What do you get if you join the text "4" and the text "5"?
A "45" (text)
B 9 (number)
4. What do you get from the sum 4 + 5 when both are numbers?
A 9
B 45
5. Which type of value can be tested to see if it is true or false?
A A name, like "Mia"
B A true/false value, like isRaining

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
17 * 3 AJoining text does not add. Because "5" and "3" are text, they join to make the text "53". Use the numbers 5 + 3 to get 8.
2"Sam" + "my" B10 + 5
3Numbers can be calculated with, so you can add them to get a total. C9 > 4
4True or false values can be tested, such as checking if one number is bigger than another. DYou cannot sensibly multiply two names. Multiplying is for numbers, not text. To put names together, join them instead.
5"Mia" * "Leo" EJoins two pieces of text together to make the text "Sammy".
6"5" + "3" gives 8 FMultiplies two numbers and gives the number 21, because numbers can be calculated with.

Definitions

data type

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
print(6 _ 7)
2.
print("Sam" _ "Lee")
3.
print(9 _ 4)
4.
score = 9 print(_____ + 1)
5.
print(____(42))

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A score = 12
B score = "12"
C total = score + bonus
D print(total)
Question 2
A first = "Mia"
B last = 7
C full = first + " " + last
D print(full)
Question 3
A is_raining = "True"
B if is_raining:
C print("Take an umbrella")
Question 4
A age = 11
B older = age > "10"
C print(older)
Question 5
A pets = 3
B fish = 4
C total = pets + fish
D print("Pets: " + total)

Answer Key

The data type decides what you can do
Section A: Quick Questions
Q1
A — 7 * 3
Q2
B — Joining "sun" and "shine" to make "sunshine"
Q3
A — "45" (text)
Q4
A — 9
Q5
B — A true/false value, like isRaining
Section B: Match the Pairs
Q1
7 * 3 → Multiplies two numbers and gives the number 21, because numbers can be calculated with.
Q2
"Sam" + "my" → Joins two pieces of text together to make the text "Sammy".
Q3
Numbers can be calculated with, so you can add them to get a total. → 10 + 5
Q4
True or false values can be tested, such as checking if one number is bigger than another. → 9 > 4
Q5
"Mia" * "Leo" → You cannot sensibly multiply two names. Multiplying is for numbers, not text. To put names together, join them instead.
Q6
"5" + "3" gives 8 → Joining text does not add. Because "5" and "3" are text, they join to make the text "53". Use the numbers 5 + 3 to get 8.
Section C: Definitions
Q1
data type — The kind of value something is. It decides what you can do with it: calculate with numbers, join text together, or test true and false values.
Section D: Fill in the Blanks
Q1
print(6 * 7)
Q2
print("Sam" + "Lee")
Q3
print(9 > 4)
Q4
score = 9 print(score + 1)
Q5
print(type(42))
Section E: Spot the Error
Q1
B — The quote marks make "12" text, and text cannot be added to the number 8. It should be score = 12 so it stays a number.
Q2
B — Here last is a number, so it cannot be joined to the other text values. A surname is text, so it should be last = "Chen".
Q3
A — With quote marks, "True" is only text, not a true/false value. It should be is_raining = True with no quotes.
Q4
B — You cannot sensibly compare the number 11 with the text "10". The test should compare two numbers: age > 10.
Q5
D — The + sign cannot join text to a number. Turn the number into text first with str(total).