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

Indentation

301.7 Maintainable Code

Practise exam questions

Maintainable Code — Note 2 of 4

Format to show structure.

What you need to know

Python uses indentation to define code blocks (inside if, for, while, def). Consistent indentation (usually 4 spaces) is required — incorrect indentation causes errors.

What to know

  • Python requires indentation — it is not optional
  • Use 4 spaces per level (standard convention)
  • Code inside if/for/while/def must be indented
  • Inconsistent indentation causes IndentationError

Code examples

Proper indentation
python
if score >= 50:
    print("Pass")    # indented = inside if
    grade = "C"
else:
    print("Fail")    # indented = inside else
    grade = "U"
← Previous noteMeaningful names301.7 Maintainable CodeNext note →Comments301.7 Maintainable Code

Back to Maintainable Code

Specification notes for programming are in Paper 2.

Maintainable Code

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