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
A three-way selection for assigning a grade The condition score at least 70 is tested first. True selects Distinction. False leads to score at least 50. True selects Pass and false selects Review. Only one result is reached. score ≥ 70? True False Distinction score ≥ 50? True False Pass Review

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.

Multiple choice1 mark

Which keyword is used for a further condition after an initial Python if?

  • Athen
  • Brepeat
  • Ccaseend
  • Delif
Worked example
score = 73
if score >= 70:
    grade = "Distinction"
elif score >= 50:
    grade = "Pass"
else:
    grade = "Review"
print(grade)
Multiple choice1 mark

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.

Coding task3 marks
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.

Coding task3 marks
age = 15

# 1. Select and store the correct category.
# 2. Display category.
Written answer3 marks

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.

Written answer3 marks

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 ifelifelse structure, conditions are tested from the top and only the first true branch runs.