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.

18-minute video lesson
Teaching, worked examples and 20 practice questions solved step by step.
Watch free for a monthWhat your child will learn
- Evaluate combined logic expressions
- Complete 3-input truth tables
- Use and, or, not in Python
- Use comparison operators
The method
- Write down each input value.
- Work out brackets first.
- Then the outer gate.
- 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.
- Step 1: A AND B = 0
- 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.
- Step 1: A AND B = 0
- 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.
- Step 1: A AND B = 0
- Step 2: 0 OR 0 = 0
Answer: Q = 0