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

Constants

301.3 Variables and Constants

Practise exam questions

Variables and Constants — Note 2 of 4

Values that do not change.

What you need to know

A constant is a value that should not change while the program runs. Python has no built-in constant keyword, so by convention we use UPPER_CASE names to signal that a value should not be modified.

What to know

  • Constants are values that stay the same: VAT_RATE = 0.2
  • Use ALL_CAPS naming by convention
  • Python does not enforce constants — it's a convention
  • Constants make code easier to update and understand

Code examples

Constants convention
python
VAT_RATE = 0.2
MAX_LIVES = 3

price = 50
total = price + (price * VAT_RATE)
print(total)  # 60.0
← Previous noteDeclare variables301.3 Variables and ConstantsNext note →Tracing variables301.3 Variables and Constants

Back to Variables and Constants

Specification notes for programming are in Paper 2.

Variables and Constants

Note 2 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).