Skip to content

Selection: If, Elif, ElseActivities & Teaching Strategies

Active learning works well here because conditional logic is best understood through immediate feedback and debugging. Students need to see how tiny changes affect program flow, which is hard to grasp from reading alone. Pairing and group work let them test predictions, correct mistakes, and build confidence with real code outcomes.

Year 8Computing4 activities20 min45 min

Learning Objectives

  1. 1Design a Python program that uses if, elif, and else statements to provide different outputs based on user input.
  2. 2Analyze the logical conditions within a program to predict its execution path.
  3. 3Evaluate the effectiveness of selection structures in solving specific programming problems.
  4. 4Compare the outcomes of programs using simple if statements versus those with if-elif-else chains.
  5. 5Create nested selection statements to model more complex decision-making processes in a program.

Want a complete lesson plan with these objectives? Generate a Mission

30 min·Pairs

Pair Programming: Quiz Grader

Pairs write a program that takes a quiz score input and uses if-elif-else to output grades: A for 90+, B for 80-89, etc. They test with various scores, then swap to improve each other's code. End with pairs presenting one edge case.

Prepare & details

Design a program that uses selection to provide different responses based on user input.

Facilitation Tip: During Pair Programming: Quiz Grader, circulate and ask each pair to verbalize the condition they are testing before they run the code.

Setup: Group tables with puzzle envelopes, optional locked boxes

Materials: Puzzle packets (4-6 per group), Lock boxes or code sheets, Timer (projected), Hint cards

RememberApplyAnalyzeRelationship SkillsSelf-Management
45 min·Small Groups

Small Groups: Nested Decision Trees

Groups build a text adventure game with nested if statements for choices like 'left' or 'right' paths, including elif for invalid inputs. They run simulations, record paths taken, and refine for better user experience.

Prepare & details

Evaluate the importance of logical conditions in controlling program flow.

Facilitation Tip: For Small Groups: Nested Decision Trees, provide a blank flowchart template so students can map logic before coding.

Setup: Group tables with puzzle envelopes, optional locked boxes

Materials: Puzzle packets (4-6 per group), Lock boxes or code sheets, Timer (projected), Hint cards

RememberApplyAnalyzeRelationship SkillsSelf-Management
20 min·Whole Class

Whole Class: Code Critique Relay

Project student code snippets with selection errors on the board. Class votes on fixes in a relay: one student suggests indentation change, next tests condition logic. Discuss as a group why the code now works.

Prepare & details

Analyze how nested selection statements mirror complex human decision-making.

Facilitation Tip: In the Whole Class: Code Critique Relay, rotate roles every five minutes to keep all students engaged in spotting and fixing errors.

Setup: Group tables with puzzle envelopes, optional locked boxes

Materials: Puzzle packets (4-6 per group), Lock boxes or code sheets, Timer (projected), Hint cards

RememberApplyAnalyzeRelationship SkillsSelf-Management
25 min·Individual

Individual: Condition Challenges

Students complete worksheets with buggy code blocks using if-elif-else, such as sorting numbers into categories. They predict outputs, code fixes, and verify by running in Python.

Prepare & details

Design a program that uses selection to provide different responses based on user input.

Facilitation Tip: For Individual: Condition Challenges, give students five minutes to annotate the code with expected outputs before attempting to run it.

Setup: Group tables with puzzle envelopes, optional locked boxes

Materials: Puzzle packets (4-6 per group), Lock boxes or code sheets, Timer (projected), Hint cards

RememberApplyAnalyzeRelationship SkillsSelf-Management

Teaching This Topic

Teach conditionals as a conversation between program and user. Start with a single if-else to build trust in the structure, then introduce elif as a way to narrow choices, not add more ifs. Emphasize tracing: students should read code aloud like a story, predicting outcomes before executing. Avoid rushing to complex examples; mastering simple chains first prevents later confusion with nested logic.

What to Expect

Students will confidently write if-elif-else chains that match inputs to expected outputs. They will trace conditions step-by-step, explaining why only one branch runs and how indentation controls execution. Programs will run without syntax errors and produce predictable results for varied inputs.

These activities are a starting point. A full mission is the experience.

  • Complete facilitation script with teacher dialogue
  • Printable student materials, ready for class
  • Differentiation strategies for every learner
Generate a Mission

Watch Out for These Misconceptions

Common MisconceptionDuring Pair Programming: Quiz Grader, students often assume each elif opens a new branch, leading to multiple prints. Watch for pairs who test inputs that should satisfy only one condition.

What to Teach Instead

Ask pairs to trace their code on paper first, drawing arrows to show which branch runs for each input before they run it.

Common MisconceptionDuring Whole Class: Code Critique Relay, students forget colons or misalign indentation, treating errors as logic mistakes. Watch for groups who skip syntax fixes and focus only on changing conditions.

What to Teach Instead

Set a three-minute timer for syntax-only debugging rounds where teams fix indentation and colons before discussing logic.

Common MisconceptionDuring Small Groups: Nested Decision Trees, students default to == in all conditions, including ranges. Watch for groups who write if score == 50 instead of if score >= 50.

What to Teach Instead

Display a list of operators on the board and ask each group to justify their choice in one sentence before coding.

Assessment Ideas

Exit Ticket

After Individual: Condition Challenges, collect each student’s annotated code and ask them to write one sentence explaining why the else clause is necessary for inputs that don’t meet any condition.

Quick Check

During Small Groups: Nested Decision Trees, pause the activity and present a projected code snippet with an if-elif-else chain. Ask each group to predict the output for three different inputs and hold up their answers on mini-whiteboards.

Discussion Prompt

After Whole Class: Code Critique Relay, pose the discussion prompt: 'When might you need elif instead of multiple ifs?' Have students share scenarios and vote on the clearest example before moving to the next task.

Extensions & Scaffolding

  • Challenge: Ask students to modify their quiz grader so it also prints the percentage score using elif for grade boundaries (e.g., 80+ = A, 60+ = B).
  • Scaffolding: Provide pre-written elif chains with missing conditions or operators, so students fill in the correct comparisons.
  • Deeper exploration: Introduce elif with Boolean operators (and, or) to create compound conditions for advanced grading scenarios.

Key Vocabulary

SelectionA control flow statement that allows a program to execute different blocks of code based on whether a condition is true or false.
If statementExecutes a block of code only if a specified condition evaluates to true.
Elif statementChecks another condition if the preceding if or elif condition was false. Stands for 'else if'.
Else statementExecutes a block of code if all preceding if and elif conditions in the structure evaluate to false.
Boolean expressionAn expression that evaluates to either True or False, used as the condition in selection statements.

Ready to teach Selection: If, Elif, Else?

Generate a full mission with everything you need

Generate a Mission