Revise Computingrevisecomputing.co.uk
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates

Knowledge organisers / Boolean Expressions

Translate logic

All topicsPractise exam questions
Knowledge organiser

Boolean Expressions

301.8c

Convert rules to Boolean.

What you need to know

Converting English rules into Boolean expressions is a key GCSE skill. Break the rule into parts, identify the comparisons, and connect them with and/or/not.

Key points

  • "Between 10 and 20" → x >= 10 and x <= 20
  • "Under 5 or over 65" → age < 5 or age > 65
  • "Not empty" → not name == "" or len(name) > 0
  • Write it in English first, then translate to code

Code examples

Translating rules
python
# Rule: "Pass if score is 50 or above AND attended > 80%"
score = 65
attendance = 85

if score >= 50 and attendance > 80:
    print("Pass")