Professional Documents
Culture Documents
Datatypes
Datatypes
**
* variable
operand
+ Value
/ - %
print Python operator
STARTER – WILL THIS PROGRAM RUN?
OBJECTIVES
You Could: Explain the datatype of any given data and give
examples for it
• Datatypes are the different types of data you can have
WHAT ARE in Python.
DATATYPES ? • Think of it like putting things in containers, liquids
must be put in glasses/bottles, rice in a pot and so on
Data Types
Think back to when we learned about Variables.
A variable is like a box. Each box has a name, and we can store a
value in each box.
When we store a value in a Python program, we need to know
the data type of that value.
name=‘Monty’ “Monty”
What type of
data is
print(name) “Monty” ?
na m e
WHAT ARE DATATYPES ?
• For example, if you want to store your age in a
variable, you need to use Integers.
• But if you want to store your name in a variable, is an
Integer useful ?
‘Qatar’
‘W’
68.95
57
TASK 1 – SAMPLE ANSWER
Data Datatype
Identify the datatype of the given data. True Boolean
‘Qatar’ String
‘W’ String
68.95 Float
57 Integer
type()
• In Python, the type() function will print the datatype of the variable you wish
to know. Use print along with type() to get the output on the screen
print(type(10))
57 Integer
TASK 2A
Data Datatype
‘m’ Boolean
Draw lines to match the data with its
correct datatype. 79 String
False Float
19.99 String
TASK 2A - ANSWER
Data Datatype
‘m’ Boolean
Draw lines to match the data with its
correct datatype. 79 String
False String
19.99 Integer
TASK 2B
Boolean
Float
String
TASK 2B – SAMPLE ANSWER
Boolean
True, False
Float 5.5 , 3.200
String
‘Al Arqam’, ‘i’
TASK 2C
Fill in the table below. One example is done for you:
Data Example Data Type
Age 13 Integer
Name
Test tomorrow?
Y/N
Weight
Price
TASK 3– SAMPLE ANSWER
Data Example Data Type
Age 13 Integer
Name ‘Dana’ String
Test tomorrow? ‘Y’ String
Y/N
Weight 24.59 Float
Price 19.99 Float
KEYWOR
D S
Plenary String
Float
Boolean
Integer
Quizizz Quiz
https://quizizz.com/admin/quiz/65127de75a1
48a5c951095b3?source=quiz_share
KEYWOR
D S
Plenary String
Float
Boolean
Integer
3
Float
3.0
“3” String
“3.0” String
RECAP
Remember:
• String holds alphanumeric data (text, numbers and
punctuation) as text
• Integer holds whole numbers
• Float holds numbers with a decimal point
• Boolean holds True or False only