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

Knowledge organisers / Variables and Constants

Naming conventions

All topicsPractise exam questions
Knowledge organiser

Variables and Constants

301.3d

Use meaningful identifiers.

What you need to know

Variable names should describe what they store. Python uses snake_case (lowercase with underscores) for variables and functions. Good names make code self-documenting.

Key points

  • Use descriptive names: total_score not ts
  • Use snake_case: player_name not playerName
  • Cannot start with a number or use spaces
  • Avoid single letters except for loop counters (i, j)

Code examples

Good vs bad names
python
# Good
player_name = "Alice"
total_score = 95

# Bad
p = "Alice"
ts = 95