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

Literals vs variables

301.1 Output and Sequence

Practise exam questions

Output and Sequence — Note 2 of 3

Output both fixed text and variable values.

What you need to know

A literal is a fixed value written directly in the code (like "hello" or 42). A variable is a named container whose value can change. You can print both in the same statement.

What to know

  • A literal is a value typed directly: "hello", 42, 3.14
  • A variable stores a value that can change: name = "Alice"
  • print() can mix literals and variables using commas
  • Changing a variable does not affect previous output

Code examples

Literals vs variables
python
name = "Alice"
print("Hello", name)
print("The number is", 7)
← Previous noteBasic print / output301.1 Output and SequenceNext note →Sequence execution301.1 Output and Sequence

Back to Output and Sequence

Specification notes for programming are in Paper 2.

Output and Sequence

Note 2 of 3

  1. 1Basic print / output
  2. 2Literals vs variables
  3. 3Sequence execution
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).