Revise Computing
Revision notesQuestionsFor schools
Log inStart revising free
Revision notesQuestionsFor schoolsLog in
GCSE Computer Science/Supplementary programming practice/Variables and Constants

Declare variables

301.3 Variables and Constants

Practise exam questions

Variables and Constants — Note 1 of 4

Create named storage.

What you need to know

A variable is created by assigning a value with =. Python does not need a keyword like 'var' — the variable is created the moment you first assign to it.

What to know

  • Use = to assign: age = 15
  • The variable is created on first assignment
  • You can reassign: age = 16 overwrites the old value
  • Variables hold one value at a time

Code examples

Declaring variables
python
name = "Alice"
age = 15
score = 89.5
print(name, age, score)
← Previous topicOperator precedence301.2 Arithmetic OperatorsNext note →Constants301.3 Variables and Constants

Back to Variables and Constants

Specification notes for programming are in Paper 2.

Variables and Constants

Note 1 of 4

  1. 1Declare variables
  2. 2Constants
  3. 3Tracing variables
  4. 4Naming conventions
Topic overview

© 2026 Revise Computing · revisecomputing.co.uk

Privacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).