Revise Computingrevisecomputing.co.uk
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates

Knowledge organisers / Data Types and Casting

Common data types

All topicsPractise exam questions
Knowledge organiser

Data Types and Casting

301.4a

int, real, bool, char, string.

What you need to know

Every value in Python has a data type. The most common are int (whole numbers), float (decimals), str (text), and bool (True/False). Use type() to check.

Key points

  • int: whole numbers like 5, -3
  • float: decimals like 3.14, -0.5
  • str: text in quotes like "hello"
  • bool: True or False
  • type() returns the data type of a value

Code examples

Data types
python
age = 15          # int
price = 9.99      # float
name = "Alice"    # str
passed = True     # bool
print(type(age))  # <class 'int'>