Skip to content
Menu

Year 7 · Computing · Python: first programs · Lesson 4

Selection with if and else

Selection in Python with if and else, conditions, comparison operators (==, !=, >, <, >=, <=), and the difference between = and ==.

Whiteboard video lesson: Selection with if and else

17-minute video lesson

Teaching, worked examples and 20 practice questions solved step by step.

Watch free for a month

What your child will learn

  • Explain selection
  • Write if/else statements
  • Use comparison operators
  • Predict program output

The method

  1. if condition:
  2. Indent True code.
  3. else:
  4. == not =.

Key words: selection, if, else, condition, comparison operator, indentation.

Worked examples

The first three practice questions from the lesson, with every step.

Question 1

What is selection?

  1. Step 1: Decision

Answer: making a decision about which code to run

Question 2

Which keyword starts a decision?

  1. Step 1: i...

Answer: if

Question 3

Which keyword runs when the condition is False?

  1. Step 1: e...

Answer: else