Knowledge organisersData Types
Integer, Real/Float, Boolean, Character and String
A data type defines what kind of data a variable can hold and what operations can be performed on it. The five main data types are integer (whole numbers), real/float (decimals), Boolean (True/False), character (a single symbol), and string (a sequence of characters). Choosing the correct data type ensures efficient storage and correct processing.
int): whole numbers with no decimal point, e.g. 5, -20, 0. Use for counts, year groups, DoorActiveTime = 100.javelinThrow = 18.2.bool): only TWO possible values, True or False; used for conditions, logic, and flags (e.g. DoorSensorActive, SystemArmed).char): a single letter, digit, or symbol, e.g. 'A', '5', '#'. NOT acceptable when the question expects String.str): a sequence of characters, e.g. "Hello", "Super-Team", "+449999999999". Use for names, text, identifiers, phone numbers.123 as an integer and "123" as a string are different; they are stored and used differently.teamName → String, yearGroup → Integer, javelinThrow → Real/Float.True/False). If there are 3+ options (win/loss/draw), Boolean is NOT suitable — use String or Integer.EmergencyPhoneNumber → String, UserName → String, DoorSensorActive → Boolean, DoorActiveTime → Integer.age = 16 # Integer
height = 1.75 # Float (real)
passed = True # Boolean
grade = "A" # String
initial = "J" # String (Python has no char type)
print(type(age)) # <class 'int'>
print(type(height)) # <class 'float'>
print(type(passed)) # <class 'bool'>