Community resourceWorksheet
J277 2.2.1 Selection
Part 4 of 7 · J277 2.2.1-2.2.2 · Programming fundamentals
Selection: choosing which statements run, and getting the boundaries right.
Students will:
- write an if statement with elif and else branches
- use indentation to show which statements belong to a branch
- handle boundary values correctly
- choose between separate ifs and a chain of branches
- write a program that sorts input into categories
Inside: 5 explanation cells, 3 runnable Python tasks, 2 multiple-choice questions and 2 written answers. 14 marks, about 45 minutes.
Series: J277 2.2.1-2.2.2 · Programming fundamentals, part 4 of 7.
Shared by Coding PathwayVerified teacher
- 12 cells
- About 45 minutes
- CC BY-SA 4.0
- Shared 17 Aug 2026
- Updated 9 Sept 2026
Preview
The whole resource, exactly as a class sees it. Answers and marking are held back.
Selection
Selection chooses which statements run according to a condition. Python uses if, optional elif branches and an optional else. Indentation shows which statements belong to each branch.
Building a decision
if condition:
# runs when condition is True
elif another_condition:
# runs when the first is False and this is True
else:
# runs when all earlier conditions are False
Trace from the top. As soon as one condition is true, its branch runs and the remaining alternatives are skipped.
The order matters. Test more specific or higher thresholds before broader ones when their ranges overlap. Boundary words matter too: at least 70 means >= 70.
Which keyword is used for a further condition after an initial Python if?
- Athen
- Brepeat
- Ccaseend
- Delif
score = 73
if score >= 70:
grade = "Distinction"
elif score >= 50:
grade = "Pass"
else:
grade = "Review"
print(grade)
What is output when the worked program uses score = 50?
- APass
- BReview
- CDistinction
- DNothing
Supported practice: a boundary decision
An online shop gives free delivery when an order total is £25 or more. Complete the decision so delivery becomes "free" when the rule is met and "paid" otherwise, then display the result.
The value £25 is an important boundary and must receive free delivery. The checks will also try totals below and above the boundary.
order_total = 25
# 1. Use selection to apply the free-delivery boundary.
# 2. Store either "free" or "paid" in delivery.
# 3. Display delivery.
Independent practice: three age categories
Write a three-way decision that stores "child" for ages below 13, "teen" for ages from 13 to 17, and "adult" for ages of 18 or above.
Use if, elif and else, store the chosen text in category, and display it. The order of the conditions matters because only the first true branch runs.
age = 15
# 1. Select and store the correct category.
# 2. Display category.
A theme park ride requires a height of at least 140 cm and a securely fastened restraint. Write the Python condition and explain why and is required.
Use the variable names `height` and `restraint_fastened`.
Students type their answer here.
The code checks if score > 50: to award a pass when the rule says '50 or more'. Identify the error, correct it and state one boundary test.
Use the exact comparison operator and a value that exposes the error.
Students type their answer here.
Exam habit
Underline threshold words such as more than, at least, below and no more than. Translate them carefully, then test the value immediately below, at and immediately above each boundary.
Selection runs one path according to a condition. In an if–elif–else structure, conditions are tested from the top and only the first true branch runs.