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 35 to 50 minutes.
Series: H446 2.2.1 · Programming techniques, part 1 of 14.
Shared by Coding PathwayVerified teacher
- 15 cells
- About 45 minutes
- CC BY-SA 4.0
- Shared 31 Aug 2026
- Updated 1 Oct 2026
Preview
The whole resource, exactly as a class sees it. Answers and marking are held back.
Control structures in OCR and Python
Control structures determine the order in which a program runs its instructions. Sequence runs instructions in order. Selection chooses a route from a True or False condition. Iteration repeats instructions. The examples use OCR Exam Reference Language (ERL) and Python so that you can compare behaviour before concentrating on syntax.
By the end, you will be able to
- identify sequence, selection and iteration
- use IF, ELSEIF, ELSE and switch/case selection
- distinguish count-controlled and condition-controlled iteration
- read, trace and write equivalent OCR ERL and Python structures
One idea, different notation
| Behaviour | OCR ERL | Python |
|---|---|---|
| choose between routes | IF ... THEN / ELSEIF / ELSE / ENDIF | if / elif / else with indentation |
| select from named values | switch ... case ... default | match ... case, or if / elif |
| repeat a known number of times | FOR i = 1 TO 5 ... NEXT i | for i in range(1, 6): |
| test before each repetition | WHILE ... ENDWHILE | while ...: |
| run once, then test | REPEAT ... UNTIL condition | a loop arranged so the test occurs after the first pass |
A FOR loop is normally count-controlled. WHILE and REPEAT-UNTIL are condition-controlled, but a condition-controlled loop can still imitate a count loop by using an initial counter, a condition and an update. Always read the stated language carefully: OCR's FOR upper bound is included, while Python's range stop value is excluded.
Worked model: decide the behaviour first
Requirement: process slots 1 to 4 and add the even slot numbers.
OCR ERL uses FOR slot = 1 TO 4, so 4 is included. Python needs range(1, 5) because 5 is excluded. Both versions visit 1, 2, 3 and 4.
The same count could be controlled by a condition:
slot = 1
while slot <= 4
...
slot = slot + 1
endwhile
This works only if the counter is initialised, tested and updated correctly. A FOR loop expresses this fixed count more directly.
Choice routine: Does it choose a route? → selection. Is the number of repetitions known? → FOR. Is repetition controlled by a changing condition? → WHILE or REPEAT-UNTIL. Must the body run at least once? → 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 ticket scanner must ask for a code at least once and keep asking until the code is valid. Recommend a loop structure and justify it.
State when the condition is checked and connect that timing to the required first attempt.
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.