Skip to content
Menu

Year 9 (ages 13–14, Grade 8 in the US) · Computing · Boolean logic · Lesson 2

Combining gates and logic in Python

Combining logic gates, working out expressions with brackets, 3-input truth tables, and Boolean logic in Python if statements.

Exam boards: this lesson matches the AQA and Pearson Edexcel GCSE computing courses. Check which course your school follows.

Whiteboard video lesson: Combining gates and logic in Python

18-minute video lesson

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

Watch free for a month

What your child will learn

  • Evaluate combined logic expressions
  • Complete 3-input truth tables
  • Use and, or, not in Python
  • Use comparison operators

The method

  1. Write down each input value.
  2. Work out brackets first.
  3. Then the outer gate.
  4. Python: and, or, not.

Key words: logic gate, truth table, Boolean expression, and, or, not, condition.

Worked examples

Worked examples from the lesson, with every step.

Question 1

Work out Q = (A AND B) OR C when A = 0, B = 1, C = 0.

  1. Step 1: A AND B = 0
  2. Step 2: 0 OR 0 = 0

Answer: Q = 0

Question 2

Work out Q = (A AND B) OR C when A = 0, B = 0, C = 1.

  1. Step 1: A AND B = 0
  2. Step 2: 0 OR 1 = 1

Answer: Q = 1

Question 3

Work out Q = (A AND B) OR C when A = 1, B = 0, C = 0.

  1. Step 1: A AND B = 0
  2. Step 2: 0 OR 0 = 0

Answer: Q = 0