Whole numbers as a data type

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

Whole numbers as a data type

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which one is a whole number?
A 7
B 7.5
2. Is 0 a whole number?
A No, it is not a number
B Yes, 0 is a whole number
3. A class has 24 students. Which data fits best?
A 24 (a whole number)
B 24.5 (a decimal)
4. Which of these is NOT a whole number?
A 3.5
B 250
5. Your game character has some lives left. Which value makes sense?
A 2.75 lives
B 3 lives

Match the Pairs

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

Left columnRight column
1score = 250 Astudents = 28
2lives = 0 BStores a whole number, 250, in a variable called score
3A whole number counts things like students in a class Cheight = 1.5
4A number with a decimal part is not a whole number D3.5 has a decimal part, so it is not a whole number. Use 3 for lives.
5lives = 3.5 # whole number EZero is a whole number, so this means the player has no lives left
6Zero is not a whole number FWrong. Zero has no fraction or decimal part, so 0 is a whole number.

Definitions

whole number

Fill in the Blanks

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

1.
students = 28 print(________)
2.
lives = _ # no lives left
3.
score = 10 score = score _ 1 print(score)
4.
lives = 3 lives = lives _ 1 print(lives)
5.
score = 250 _____(score) # 250 is a whole number

Spot the Error

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

Question 1
A # lives are whole numbers
B lives = 3
C lives = lives - 0.5
D print(lives)
Question 2
A # count the students
B boys = 11
C girls = 13
D total = boys + girls + 0.5
E print(total)
Question 3
A score = 0
B points = '250'
C print(score + points)
Question 4
A # no goals scored yet
B goals = 'zero'
C print(goals)
Question 5
A cats = 3.5
B dogs = 2
C print(cats + dogs)

Answer Key

Whole numbers as a data type
Section A: Quick Questions
Q1
A — 7
Q2
B — Yes, 0 is a whole number
Q3
A — 24 (a whole number)
Q4
A — 3.5
Q5
B — 3 lives
Section B: Match the Pairs
Q1
score = 250 → Stores a whole number, 250, in a variable called score
Q2
lives = 0 → Zero is a whole number, so this means the player has no lives left
Q3
A whole number counts things like students in a class → students = 28
Q4
A number with a decimal part is not a whole number → height = 1.5
Q5
lives = 3.5 # whole number → 3.5 has a decimal part, so it is not a whole number. Use 3 for lives.
Q6
Zero is not a whole number → Wrong. Zero has no fraction or decimal part, so 0 is a whole number.
Section C: Definitions
Q1
whole number — A number with no fraction or decimal part, like 0, 7 or 250. We use whole numbers to count things, such as scores, lives or students. 3.5 is not a whole number.
Section D: Fill in the Blanks
Q1
students = 28 print(students)
Q2
lives = 0 # no lives left
Q3
score = 10 score = score + 1 print(score)
Q4
lives = 3 lives = lives - 1 print(lives)
Q5
score = 250 print(score) # 250 is a whole number
Section E: Spot the Error
Q1
C — Taking away 0.5 leaves a decimal. Lives are counted, so they stay whole numbers. It should be lives = lives - 1.
Q2
D — You cannot have half a student. Counting students uses whole numbers, so the extra + 0.5 should be removed.
Q3
B — Quote marks turn 250 into text. A whole number is typed with no quotes, so it should be points = 250.
Q4
B — Zero is a whole number, so we type the digit 0. The word 'zero' in quotes is text. It should be goals = 0.
Q5
A — We count cats as whole numbers. 3.5 has a decimal part, so it is not a whole number. It should be cats = 3.