Revise Computing
Revision notesQuestionsFor schools
Log inStart revising free
Revision notesQuestionsFor schoolsLog in
GCSE Computer Science/Supplementary programming practice/Maintainable Code

Tidy code comparison

301.7 Maintainable Code

Practise exam questions

Maintainable Code — Note 4 of 4

Improve messy examples.

What you need to know

Tidy code uses meaningful names, consistent indentation, and helpful comments. You should be able to read messy code and rewrite it following best practices without changing its behaviour.

What to know

  • Rename single-letter variables to descriptive names
  • Add consistent indentation (4 spaces)
  • Add comments to explain purpose of sections
  • Remove unnecessary blank lines or clutter
  • Keep line length reasonable

Code examples

Messy → tidy
python
# MESSY
x=int(input())
if x>10:
 print("big")

# TIDY
user_number = int(input("Enter a number: "))
if user_number > 10:
    print("That number is big")
← Previous noteComments301.7 Maintainable CodeNext topic →Comparison operators301.8 Boolean Expressions

Back to Maintainable Code

Specification notes for programming are in Paper 2.

Maintainable Code

Note 4 of 4

  1. 1Meaningful names
  2. 2Indentation
  3. 3Comments
  4. 4Tidy code comparison
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).