Choose exam board for KS4 Computer Science (GCSE)
Choose exam board for KS4 English
Choose exam board for KS4 French
Choose exam board for KS4 Geography
Choose exam board for KS4 German
Choose exam board for KS4 History
Choose tier for KS4 Maths
Choose exam board for KS4 Music
Choose exam board for KS4 Physical education (GCSE)
Choose exam board for KS4 Religious education (GCSE)
Choose exam board for KS4 Spanish

      Using selection when developing programs

      Lesson details

      Learning outcome

      I can describe how selection statements are used in programs to control program flow.

      Key learning points

      1. Selection is used when there is more than one possible path for a program to follow.
      2. Selection is carried out using if, elif and else statements.
      3. A selection statement will check if a condition returns as True or False.
      4. Multi-path selection is used when there is more than one path for a program to follow.

      Keywords

      • Selection - used when there is more than one possible path for a program to follow

      • Condition - an expression that evaluates to True or False

      • Multi-path selection - selection when there is more than one path for a program to follow

      Common misconception

      A program follows a sequence of instructions and will run all lines of code.

      Selection statements can be used to control program flow, so some lines of code can be skipped to follow a different path through the program.

      Teacher tip

      Pupils may find the come across syntax errors with missing : and indentation in selection statements. Encourage them to self check programs for these pitfalls.

      Equipment

      Pupils will need access to a device that can edit and run Python programs. Examples in this lesson use the RPF Code Editor https://oak.link/python-editor

      Licence

      This content is © Oak National Academy Limited (2026), licensed on Open Government Licence version 3.0
      except where otherwise stated. See Oak's terms & conditions
      (Collection 2).

      Lesson video

      Loading...

      Prior knowledge starter quiz

      6 Questions

      Q1.
      Which flowchart symbol is sued to represent a decision?

      An image in a quiz
      Correct Answer: An image in a quiz
      An image in a quiz
      An image in a quiz

      Q2.
      Which of the following is the correct syntax for a print statement in Python?

      print(Hello)
      Print(Hello)
      Correct answer: `print("Hello")`
      print (Hello

      Q3.
      What does an IF statement represent?

      Correct answer: a question
      an answer
      a variable
      an iteration

      Q4.
      In programming what is the answer to an IF question?

      Yes or No
      Wrong or Right
      1 or 0
      Correct answer: True or False

      Q5.
      is used when there is more than one possible path for a program to follow.

      Correct Answer: selection

      Q6.
      What statement is used to obtain a value for a variable from a user?

      print()
      if
      get()
      Correct answer: `input()`

      6 Questions

      Q1.
      What is the purpose of selection in programming?

      to repeat a set of instructions multiple times
      Correct answer: to allow a program to follow different paths based on conditions
      to create a new variable
      to execute all lines of code in a program

      Q2.
      Which of the following is used for selection in Python?

      for loop
      while loop
      Correct answer: if statement
      function definition

      Q3.
      What will be the output of the following code?
      12345
      number = 10 if number > 5: print(number + 5) else: print(number - 5)
      Code colour

      10
      5
      Correct answer: 15
      20

      Q4.
      A condition in programming is an expression that evaluates to either or False.

      Correct Answer: True

      Q5.
      The statement is used when there are multiple conditions to check one after another.

      Correct Answer: elif, else if

      Q6.
      What will the following program output?
      1234
      score = 30 if score > 30: print("You won!") print("The end")
      Code colour

      You won!
      You won! The end
      Correct answer: The end

      To help you plan your 10 computer science lesson on: Using selection when developing programs, download all teaching resources for free and adapt to suit your pupils' needs...