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

      Lesson details

      Learning outcome

      I can use logical operators to build more complex selection statements.

      Key learning points

      1. Logical operators are often used when you need to evaluate multiple relational expressions to return a single value.
      2. Logical expressions return as either True or False. The three basic logical operators are and, or, and not.
      3. Logical expressions can be used in selection statements.

      Keywords

      • Logical expression - an expression that combines relational and logical operators

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

      Common misconception

      A logical expression can only check one value.

      Logical expressions can combine relational and logical operators to check multiple values or inputs.

      Teacher tip

      Comparing values of objects is a useful way to visualise the use of realtional operators. Props in the classroom help make these comparisons more concrete.

      Equipment

      All pupils requires access to devices that can edit and run Python programs. Starter code files are available to copy or use directly via the Raspberry Pi Code 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.
      A compares two values and produces the result of True or False.

      Correct Answer: relational operator

      Q2.
      Match the arithmetic operator to the symbol:

      Correct Answer:==,equal to
      Correct Answer:!=,not equal to
      Correct Answer:>=,greater than or equal to
      Correct Answer:<,less than

      Q3.
      Write the if statement command to check if the value stored in the variable called num is 10 or more.

      Correct Answer: if num >= 10:, if num>=10:

      Q4.
      What will be displayed if score is 5?
      123456
      if score < 5: print ("You lose") elif score <= 10: print ("Not bad!") else: print ("You win")
      Code colour

      You lose
      Correct answer: Not bad!
      You win

      Q5.
      What will be displayed if score is 10?
      123456
      if score < 5: print ("You lose") elif score <= 10: print ("Not bad!") else: print ("You win")
      Code colour

      You lose
      Correct answer: Not bad!
      You win

      Q6.
      What will be displayed if score is 11?
      123456
      if score < 5: print ("You lose") elif score <= 10: print ("Not bad!") else: print ("You win")
      Code colour

      You lose
      Not bad!
      Correct answer: You win

      6 Questions

      Q1.
      What is the purpose of logical operators in programming?

      To perform mathematical calculations.
      To repeat a block of code multiple times.
      Correct answer: To compare multiple conditions and return True or False.
      To store user input.

      Q2.
      Which of the following is True when both conditions are True?

      or
      Correct answer: and
      not

      Q3.
      The expression `(5 > 3) and (10 < 20)` evaluates to .

      Correct Answer: True

      Q4.
      Which logical operator is used to reverse the result of a condition?

      and
      or
      Correct answer: not

      Q5.
      The expression `(8 < 3) and (5 > 2)` evaluates to .

      Correct Answer: False

      Q6.
      What will be displayed if the user inputs "king" for value and "hearts" for suit?
      123456
      if value == "king" and suit == "hearts": print("Match") else: print("Not a match")
      Code colour

      Correct answer: Match
      Not a match
      Error

      To help you plan your 10 computer science lesson on: Logical operators, download all teaching resources for free and adapt to suit your pupils' needs...