There are five main data types that are used at GCSE, and as a part of your course (and later your exam) you will be expected to understand how they work and when it is most appropriate to use them. Creating practice programs on a regular basis is the best way to do this – although we are introducing data types this week, we will be referring back to each of these five types regularly throughout the course.
The video below has been included for those of you who have already been programming in Python for a while – this was originally in week 2 of the course. If you are brand new to programming, please skip this! – (We’ll come back to this later)
The definitions below will give you the basic knowledge needed to use these data types, but I strongly recommend that you complete the full Data Types section to give you more information and practical ways to apply your knowledge.
Char – a single character (symbol)
String – one or more characters, often forming a word or phrase
Integer – a whole number
Real – a decimal number (aka. a float)
Boolean – a special type that only holds either True or False
Activity
Try using the python below to test the data types of each piece of code (you can change & run the code directly on this webpage – to save any code that you change, either copy it into your own coding program or use the python editor above:
#the names that I've used for the variables below are not good practice! They have been named this way to hide the data types from you
variable1 = 'a'
variable2 = "Hello"
variable3 = 42
variable4 = 42.5
variable5 = True
#try adding more print lines to check the data type of each variable
print(type(variable1))
PythonDiscussion
Add to the discussion in the “Comments” section above – identify the different data types that we use everyday. Try to add an example that hasn’t been suggested yet.