Basic Data Types, online
Six activities your students do on their own devices. See who's finished, and their scores.
Learning
Understanding
Testing
Basic Data Types in one minute
What students need to know
Numbers with a decimal point are floats in Python. Text wrapped in quotes is a string (str) in Python.
A whole number without quotes is an integer. 42 has no decimal point — it's an integer.
Mistakes students make
- Line 2 has a stray quote. Should be: age = 15.
- Line 2 is missing quotes. Should be: city = "Melbourne".
- Line 3 uses a comma not a decimal point. Should be: height = 5.8.
- Line 3 tries to add an int and a string. score is an integer, name is a string -- they can't be added.
PREVIOUS · MODULE 4Variables
YOU ARE HERE · MODULE 5Basic Data Types
NEXT · MODULE 6Basic Arithmetic
What students will learn in this module
Every question in Module 5
Quick questions
- What type is
"Alice"?AStringBInteger - What type is
15?AStringBInteger - What type is
5.5?AFloatBInteger - Which is a string?A"100"B100
- What type is
42?AFloatBInteger
Key terms
Students type the meaning of:
name = "Alice"age = 15height = 5.5
Match the pairs
'25' + 1Match it to what it doesyear_born = 1989.0Match it to what it doesscore = 4.5Match it to what it doesname = 'Alice'Match it to what it doesprint(int('25'))Match it to what it doesprint(float('3.14'))Match it to what it doesFill in the blanks
name = _______
age = __
height = ___
score = ___("100")city = ___________
Spot the error
Question 1
Aname = "Alice"Bage = 15"Cprint(age)
Question 2
Ascore = 100Bcity = MelbourneCprint(city)
Question 3
Aname = 'Bob'Bage = 12Cheight = 5,8
Question 4
Aname = 'Alice'Bscore = 85Ctotal = score + nameDprint(total)
Question 5
Aname = 'Charlie'Bage = 15Cheight = 5.8Dcity = 'MelbourneEprint(name)
