Sorting values into number, text or true/false

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

Sorting values into number, text or true/false

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. What data type is the value 12 (the age of a student)?
A Text
B Number
2. What data type is "Mia" (a person's name)?
A Text
B Number
3. What data type is the answer to "Is it raining?"
A Text
B True or false
4. Which value is text?
A "Hello"
B true
5. A house number like 42 is used to label a home, not to add up. What data type should it be?
A Text
B Number

Match the Pairs

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

Left columnRight column
1age = 11 AA name is text, because it is made of letters and sits inside quote marks.
2name = "Maya" BA house number is just a label for a place, so adding house numbers makes no sense. It is better stored as text.
3The question "Is it raining?" can only be answered yes or no, so its data type is true/false. CisRaining = True
4A postcode like 3000 is a label, not an amount. You never add postcodes, so it is text. Dpostcode = "3000"
5isRaining = "True" EThe true/false answer was put in quote marks, which turns it into text instead of a true/false value.
6houseNumber = 12 + 4 (to find the average house) FAn age is a number, because you can count with it and calculate with it.

Definitions

data type

Fill in the Blanks

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

1.
name = "Mia" # type: ____
2.
age = 11 # type: ______
3.
raining = True # type: __________
4.
postcode = "3000" # type: ____
5.
door = "12" # Quote marks mean the value is ____

Spot the Error

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

Question 1
A name = Mia
B age = 11
C raining = true
Question 2
A postcode = "3000"
B age = "11"
C total = age + 1
Question 3
A team = "Reds"
B goals = 3
C has_won = "true"
Question 4
A name = "Zoe"
B age = 12
C raining = false
D postcode = 2000
Question 5
A type("Mia") -> text
B type(11) -> text
C type(true) -> true/false

Answer Key

Sorting values into number, text or true/false
Section A: Quick Questions
Q1
B — Number
Q2
A — Text
Q3
B — True or false
Q4
A — "Hello"
Q5
A — Text
Section B: Match the Pairs
Q1
age = 11 → An age is a number, because you can count with it and calculate with it.
Q2
name = "Maya" → A name is text, because it is made of letters and sits inside quote marks.
Q3
The question "Is it raining?" can only be answered yes or no, so its data type is true/false. → isRaining = True
Q4
A postcode like 3000 is a label, not an amount. You never add postcodes, so it is text. → postcode = "3000"
Q5
isRaining = "True" → The true/false answer was put in quote marks, which turns it into text instead of a true/false value.
Q6
houseNumber = 12 + 4 (to find the average house) → A house number is just a label for a place, so adding house numbers makes no sense. It is better stored as text.
Section C: Definitions
Q1
data type — The kind of value you have. Look at what it is: a number to count or calculate with, text in quote marks, or an answer that is only true or false. A postcode is text, not a number.
Section D: Fill in the Blanks
Q1
name = "Mia" # type: text
Q2
age = 11 # type: number
Q3
raining = True # type: true/false
Q4
postcode = "3000" # type: text
Q5
door = "12" # Quote marks mean the value is text
Section E: Spot the Error
Q1
A — A name is text, so it needs quote marks. It should be name = "Mia". Without quotes the computer thinks Mia is something else.
Q2
B — An age is a number you can calculate with. Quote marks turn it into text, so age + 1 would not work. It should be age = 11.
Q3
C — A true/false answer is written without quote marks. With quotes, "true" is just text. It should be has_won = true.
Q4
D — A postcode looks like a number, but you never add or count with it. So it is text and needs quote marks. It should be postcode = "2000".
Q5
B — 11 has no quote marks and you can count with it, so it is a number. It should be type(11) -> number.