Single lesson · Key Stage 3

elif, AND, OR and NOT – Year 8 Computing lesson

Pupils learn to use if, elif and else with AND, OR and NOT to combine tests so a program chooses one outcome from several.

Also in a bundle Python: Iteration and Boolean Operators – Year 8 Computing lessons 6 lessons for £20 · save 16% on buying separately

Lesson 2 of 6 in unit 8.1 Python: Iteration and Boolean Operators, taught in Year 8, Autumn 1. It answers one big question: How can a program make a decision from more than one test?

By the end, pupils can use if, elif and else with AND, OR and NOT to combine tests so a program chooses one outcome from several.

The Build (the main task)
Write a program that rates a password as Weak, OK or Strong, using if, elif and else and at least one AND, OR or NOT in a condition.
Support version
Parsons problem: the lines of a working rating program are jumbled, with one extra line that uses AND where OR is needed.
Challenge
Change the rating so a password is only Strong if it is 12 or more characters AND not all digits (not password.isdigit()), then give one Strong and one OK password with a reason for each.
Real-world link
Password checkers use more than one rule: long enough AND not the same as your username. Today's program rates a password.
Key words
Boolean operator, Boolean and Combine, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“OR is only True when both tests are True”; “Every branch of an if–elif–else whose test is True runs”.
National Curriculum
NC3 (two or more languages, at least one textual; data structures; modular programs with procedures or functions); NC4 (boolean logic (AND, OR, NOT) in circuits and programming; binary numbers, addition and conversion).

Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.

Pupils need computers for the main task.

Also sold in the Python
Iteration and Boolean Operators unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Single-teacher licence: use and adapt it with your own classes

More for KS3 Computing

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.