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
| Purpose | OCR ERL | Python |
|---|---|---|
| selection | IF ... THEN / ELSEIF / ELSE / ENDIF | if / elif / else with indentation |
| count loop | FOR i = 1 TO 5 ... NEXT i | for i in range(1, 6): |
| pre-condition loop | WHILE ... ENDWHILE | while ...: |
| post-condition loop | REPEAT ... UNTIL condition | use 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.
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.
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 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.
total = 0for slot = 1 to 4if slot MOD 2 == 0 thentotal = total + slotelsetotal = total + 1endifnext slotprint(total)
| Row | total | slot | slot MOD 2 == 0 | Output |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 | ||||
| 6 | ||||
| 7 | ||||
| 8 |
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
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.
def entry_status(places_remaining):
passA 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.
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.