CGP, PG Online, and more
Amazon amazon.co.uk
Python Books
Beginner to advanced Python
Amazon amazon.co.uk
Raspberry Pi Kits
For programming projects
Amazon amazon.co.uk
Fastmail โ€” Private Email
Privacy-first email with no ads and no tracking
fastmail.com
Dynadot โ€” Domain Registration โ†’
Register or transfer domains with free SSL and affordable pricing
dynadot.com
Zen Internet โ€” UK Broadband โ†’
Award-winning UK broadband with no data caps and great customer service
zen.co.uk
CS Revision Guides

Programming Fundamentals

Year 1 / ASYear 2 / A-Level All Boards (AQA, Edexcel, OCR, WJEC, CCEA) AQA

A-Level Computer Science revision: Programming Fundamentals. Learning objectives, key points, worked examples and practice questions across AQA, Edexcel, OCR, WJEC and CCEA.

Fastmail

๐Ÿ“Œ Key Points

Key Fact: Data types: int, float, bool, char, string; type casting; constants vs variables
Key Fact: Selection: if/elif/else, switch/case (match in Python 3.10+); nested conditions
Key Fact: Iteration: for (definite), while (indefinite), do-while (at least once); break/continue
Key Fact: Functions: definition, call, parameters (positional, keyword, default), return, recursion
Key Fact: Scope: local, global, nonlocal; shadowing; modules and imports
Key Fact: String: len, index, slice, split, join, replace, format, f-strings, regex basics
Key Fact: File: open/close, read/write modes, with statement, try/except/else/finally

๐ŸŽฏ Learning Objectives

  • Use variables, constants, and data types (integer, real, boolean, character, string)
  • Implement control structures: sequence, selection (if/else, switch), iteration (for, while, do-while)
  • Design and use functions/procedures: parameters (value/reference), return values, scope
  • Handle input/output: file I/O, exceptions, validation
  • Apply string manipulation: concatenation, slicing, searching, formatting
  • Use random number generation and libraries

๐Ÿ’ก Worked Example

Exam-Style Question

Question: Write a function that reads a file of integers and returns the median

Model Answer:

def median_from_file(filename): with open(filename) as f: nums = sorted(int(line.strip()) for line in f if line.strip()) n = len(nums) if n == 0: return None mid = n // 2 return nums[mid] if n % 2 else (nums[mid-1] + nums[mid]) / 2

โ“ Practice Questions

Model answers are being added progressively - questions marked ✗ don't have one yet. Cross-check with your teacher or the official mark scheme.

Questions:

  • Write a program that validates email format using regex✗ answer coming soon
  • Implement a recursive factorial function✗ answer coming soon
  • Create a menu-driven calculator with functions✗ answer coming soon
  • Write a function to count word frequencies in a text file✗ answer coming soon
  • Handle division by zero with try/except✗ answer coming soon

๐ŸŽฌ Video Resources

๐Ÿ“„ Past Papers & Exam Resources

๐Ÿ”— Further Reading & Resources

๐Ÿ“š Lesson Plan (50 minutes)

  1. Starter (5 min): Recall prior knowledge of programming fundamentals with quick questions.
  2. Teaching (15 min): Work through each of the learning objectives, explaining principles step by step.
  3. Key points review (5 min): Revisit the key points together, confirming understanding.
  4. Worked example (10 min): Model the example question: Write a function that reads a file of integers and returns the median. Solution: def median_from_file(filename): with open(filename) as f: nums = sorted(int(line.strip()) for line in f if line.strip()) n = len(nums) if n == 0: return None mid = n // 2 return nums[mid] if n % 2 else (nums[mid-1] + nums[mid]) / 2
  5. Practice (10 min): Students attempt the practice questions independently; circulate and support.
  6. Plenary (5 min): Review answers and address misconceptions.

๐Ÿ  Homework

  • Write a program that validates email format using regex
  • Implement a recursive factorial function
  • Create a menu-driven calculator with functions
  • Write a function to count word frequencies in a text file
  • Handle division by zero with try/except

๐Ÿงพ Assessment

Check practice answers against the model answer; use the built-in practice questions as formative assessment.

๐ŸŽ“ Smart Lesson (Guided)