Community resourceWorksheet

OCR H446 2.2.1 Control structures in OCR and Python

Part 1 of 14 · H446 2.2.1 · Programming techniques

OCR H446 2.2.1 expects students to move between OCR's exam reference language and Python, where the same loop can carry different boundaries. This worksheet builds the sequence, selection and iteration model first, makes the FOR and range boundary difference explicit, then asks students to construct control flow from a stated requirement.

Students will:

  • identify sequence, selection and iteration in a described requirement
  • translate OCR exam reference language loop boundaries into the equivalent Python range
  • trace a timetable algorithm and record how its state changes on each pass
  • write Python selection that assigns values across several discrete cases
  • recommend a loop type when the number of attempts is not known in advance and justify it

Inside: 7 explanation cells, 2 multiple-choice questions, 1 fill-in-the-blanks cell, 2 written answers, 2 Python tasks and 1 trace table. 16 marks, about 25 to 35 minutes.

Series: H446 2.2.1 · Programming techniques, part 1 of 14.

Shared by Coding PathwayVerified teacher

  • 15 cells
  • About 30 minutes
  • CC BY-SA 4.0
  • Shared 31 Aug 2026
  • Updated 3 Sept 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

Control structures in OCR and Python

A community festival uses algorithms to build a timetable and manage queues. The same underlying control structures appear with different surface notation.

By the end, you will be able to

  • identify sequence, selection and iteration
  • translate common OCR ERL and Python structures
  • trace loop bounds and decisions
  • choose a structure from required behaviour

Reactivate: variables, comparisons and arithmetic operators.

Syntax bridge

PurposeOCR ERLPython
selectionIF ... THEN / ELSEIF / ELSE / ENDIFif / elif / else with indentation
count loopFOR i = 1 TO 5 ... NEXT ifor i in range(1, 6):
pre-condition loopWHILE ... ENDWHILEwhile ...:
post-condition loopREPEAT ... UNTIL conditionuse a loop whose condition is tested after one pass

Loop bounds must be read from the stated language; Python's range stops before its second argument.

Worked model: read behaviour before syntax

Requirement: process slots 1 to 4 and add even slot numbers.

OCR ERL uses FOR slot = 1 TO 4, so 4 is included. Python needs range(1, 5) because the stop value is excluded. Both versions visit 1, 2, 3, 4.

For a trace, create columns for slot, condition and total. Predict the number of iterations before filling values. This catches the common range-bound error.

Guided choice routine: Does it choose? → selection. Does it repeat a known count? → FOR. Unknown count with test first? → WHILE. Must run once before testing? → REPEAT-UNTIL.

Worked example: selection with switch/case

Use switch/case when one expression is compared with several discrete values. OCR ERL writes switch zone: followed by labelled cases and an optional default. In suitable Python versions, match zone: with case clauses expresses the same decision shape; an if/elif chain is also a valid Python implementation.

switch zone:
    case "stage":
        fee = 12
    case "workshop":
        fee = 8
    default:
        fee = 0
endswitch

For zone = "workshop", the second label matches, so fee becomes 8 and the other routes do not run. default handles values that match no named case.

Written answer4 marks

Write the Python selection that assigns the same fees using match/case or an equivalent if/elif/else chain.

Cover stage, workshop and the default outcome. Preserve the three fee values.

Students type their answer here.

Multiple choice1 mark

Which description best defines sequence?

  • AExecuting instructions in a stated order
  • BChoosing one path from several
  • CRepeating instructions until a condition
  • DCalling a function from itself
Trace table6 marks

Trace this OCR ERL timetable algorithm.

Enter a value only when it changes. Keep the listing's order.

Use one row for each pass through the loop. Fill in a box only when that value changes on that row, and leave the rest blank.

AlgorithmExam reference language
  1. total = 0
  2. for slot = 1 to 4
  3. if slot MOD 2 == 0 then
  4. total = total + slot
  5. else
  6. total = total + 1
  7. endif
  8. next slot
  9. print(total)
Trace table with 4 columns
Rowtotalslotslot MOD 2 == 0Output
1
2
3
4
5
6
7
8
Multiple choice1 mark

A queue check must run at least once and then repeat until the queue is empty. Which structure most directly expresses this?

  • AFOR loop
  • BREPEAT-UNTIL loop
  • CWHILE loop
  • DSwitch/case
Worked example
age = 17
has_pass = True
if age >= 16 and has_pass:
    zone = "stage"
elif age >= 16:
    zone = "help desk"
else:
    zone = "family area"
print(zone)

Write a festival rule

Complete the function. Return 'full' when capacity is zero or less, 'few' when fewer than 10 places remain, and 'open' otherwise.

Coding task4 marks
def entry_status(places_remaining):
    pass
Written answer2 marks

A program keeps requesting a valid ticket code, but the number of attempts is not known in advance. Recommend a loop type and justify it.

State when its condition is checked and why that matches the scenario.

Students type their answer here.

Checkpoint

Complete the control-structure summary from memory. There is no answer bank, and correctness is withheld until teacher review.

Fill in the blanks4 marks
Instructions executed in a stated order use checkpoint gap 1. Choosing a route uses checkpoint gap 2. A FOR loop is normally checkpoint gap 3 controlled, while WHILE and REPEAT-UNTIL are checkpoint gap 4 controlled.

Review your understanding

Before submitting, check that you can explain the main distinction in your own words, apply it in an unfamiliar context and justify the resulting behaviour or consequence.