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

Choosing types

All topicsPractise exam questions
Knowledge organiser

Data Types and Casting

301.4b

Select correct data types.

What you need to know

Choosing the right data type matters for correctness and efficiency. Use int for counting, float for measurements, str for text, and bool for yes/no decisions.

Key points

  • Use int for quantities you count (lives, score)
  • Use float for measurements (height, price)
  • Use str for any text or mixed characters
  • Use bool for flags and conditions

Code examples

Choosing types
python
lives = 3          # int — count of lives
height = 1.75      # float — measurement
postcode = "SW1"   # str — contains letters
is_admin = False   # bool — yes/no flag