GRADE 8 · COMPUTING · UNIT 1 · LESSON 1.23
Computational thinking and programming
Boolean operators in Python
Read a little. Try the workbook. Check your answers. Choose one section below to get started.
LET’S TRACE, REASON AND TEST
Boolean operators in Python
Combine Python comparisons with and, or and not. Preserve parentheses when they express the intended rule, and remember that equality on strings is case-sensitive unless you deliberately normalise input.
- Use lowercase and, or and not with complete comparisons and trace their effect on selection.
- Explain my method and support it with a labelled trace, example or test record.

Work through an example
For colour = "Blue", colour == "blue" is False. Choosing colour.strip().lower() first would be an explicit input-normalisation policy, not an automatic feature of equality.
Try before your workbook
Is (x >= 3 and x <= 7) true when x = 7? Why?
Explore the clues
Tap one card to find out more.
Understand the idea
Combine Python comparisons with and, or and not. Preserve parentheses when they express the intended rule, and remember that equality on strings is case-sensitive unless you deliberately normalise input.
Concept to practise: Boolean operators in Python.
Work through an example
For colour = "Blue", colour == "blue" is False. Choosing colour.strip().lower() first would be an explicit input-normalisation policy, not an automatic feature of equality.
Try before your workbook
Is (x >= 3 and x <= 7) true when x = 7? Why?
Check my readiness thinking
Yes. Both comparisons are true at 7 because the upper comparison uses <=. Changing it to < would exclude 7.
Your original programs and learning models
These original PaxaKids program and data models support your workbook. Some examples deliberately contain faults to investigate. Follow their headings and preserve exact code case, punctuation and order. Traces and supplied records are not claims of physical testing.
Combine complete conditions in Python
Comparisons such as group <= 8 or card == "yes" produce Boolean results. The Boolean operators combine or reverse those results. This lesson works with explicit True/False operands.
Complete the Boolean truth table
| A | B | A and B | A or B | not A |
|---|---|---|---|---|
| True | True | {'clue': 'True or False', 'prompt': 'True and True', 'answers': ['True']} | {'clue': 'True or False', 'prompt': 'True or True', 'answers': ['True']} | {'clue': 'True or False', 'prompt': 'not True with B True', 'answers': ['False']} |
| True | False | {'clue': 'True or False', 'prompt': 'True and False', 'answers': ['False']} | {'clue': 'True or False', 'prompt': 'True or False', 'answers': ['True']} | {'clue': 'True or False', 'prompt': 'not True with B False', 'answers': ['False']} |
| False | True | {'clue': 'True or False', 'prompt': 'False and True', 'answers': ['False']} | {'clue': 'True or False', 'prompt': 'False or True', 'answers': ['True']} | {'clue': 'True or False', 'prompt': 'not False with B True', 'answers': ['True']} |
| False | False | {'clue': 'True or False', 'prompt': 'False and False', 'answers': ['False']} | {'clue': 'True or False', 'prompt': 'False or False', 'answers': ['False']} | {'clue': 'True or False', 'prompt': 'not False with B False', 'answers': ['True']} |
Read a complete not decision
Original Paxa token comparison
token = input()
if not (token == "blue"):
print("Different token")
else:
print("Blue token")Require two facts with and
Original Paxa two-fact room policy
group = int(input())
card = input()
if group <= 8 and card == "yes":
print("Use room")
else:
print("Choose another room")Trace both facts and their selected output
| Group | Card | Whole condition | Output |
|---|---|---|---|
| 7 | yes | {'clue': 'True or False', 'prompt': 'Whole room condition for 7/yes', 'answers': ['True']} | {'clue': 'Exact output', 'prompt': 'Room output for 7/yes', 'answers': ['Use room']} |
| 8 | yes | {'clue': 'True or False', 'prompt': 'Whole room condition for 8/yes', 'answers': ['True']} | {'clue': 'Exact output', 'prompt': 'Room output for 8/yes', 'answers': ['Use room']} |
| 9 | yes | {'clue': 'True or False', 'prompt': 'Whole room condition for 9/yes', 'answers': ['False']} | {'clue': 'Exact output', 'prompt': 'Room output for 9/yes', 'answers': ['Choose another room']} |
| 7 | no | {'clue': 'True or False', 'prompt': 'Whole room condition for 7/no', 'answers': ['False']} | {'clue': 'Exact output', 'prompt': 'Room output for 7/no', 'answers': ['Choose another room']} |
| 7 | YES | {'clue': 'True or False', 'prompt': 'Whole room condition for 7/YES', 'answers': ['False']} | {'clue': 'Exact output', 'prompt': 'Room output for 7/YES', 'answers': ['Choose another room']} |
Accept agreed answer variants with or
Original Paxa reading riddle
print("I am a bound set of pages to read. What am I?")
answer = input()
if answer == "book" or answer == "BOOK" or answer == "Book":
print("Match")
else:
print("Try book")Predict accepted and unmatched answers
| Entered answer | Feedback |
|---|---|
| book | {'clue': 'Match or Try book', 'prompt': 'Riddle feedback for book', 'answers': ['Match']} |
| Book | {'clue': 'Match or Try book', 'prompt': 'Riddle feedback for Book', 'answers': ['Match']} |
| BOOK | {'clue': 'Match or Try book', 'prompt': 'Riddle feedback for BOOK', 'answers': ['Match']} |
| a book | {'clue': 'Match or Try book', 'prompt': 'Riddle feedback for a book', 'answers': ['Try book']} |
| books | {'clue': 'Match or Try book', 'prompt': 'Riddle feedback for books', 'answers': ['Try book']} |
| pen | {'clue': 'Match or Try book', 'prompt': 'Riddle feedback for pen', 'answers': ['Try book']} |
Fix an incomplete comparison and extend the policy
A: intentional bug
answer = input()
if answer == "book" or "BOOK":
print("Match")
else:
print("Try book")B: correct extension
answer = input()
if (answer == "book"
or answer == "BOOK"
or answer == "Book"
or answer == "a book"
or answer == "books"):
print("Match")
else:
print("Try book")Files for this activity
Use these original PaxaKids practice files with the matching workbook. Work on a local copy in the appropriate editor. Some examples deliberately contain faults to investigate; a downloaded file is not a completed practical test.

Try one step with Paxa!
Trace code in the stated order and preserve exact spelling and case. Use fictional data. Label a prediction, paper trace, simulator run and physical-device test separately; an unperformed test stays Pending. Save personal responses before leaving.
Our Unit 1 learning path
- Lesson 1.1: Recall algorithms and representations
- Lesson 1.2: Purpose and conventions of pseudocode
- Lesson 1.3: Input, output and strings
- Lesson 1.4: Identifiers and assignment
- Lesson 1.5: Arithmetic and translation
- Lesson 1.6: Trace and review a sequence
- Lesson 1.7: Conditions and two-way flow
- Lesson 1.8: IF THEN and indentation
- Lesson 1.9: IF THEN ELSE and decision diagrams
- Lesson 1.10: Ordered ELSEIF and fallback ELSE
- Lesson 1.11: Match flowchart and pseudocode branches
- Lesson 1.12: AND, OR and NOT
- Lesson 1.13: Grouping, precedence and review
- Lesson 1.14: Why software searches
- Lesson 1.15: A successful linear search
- Lesson 1.16: An unsuccessful search and termination
- Lesson 1.17: Practise and communicate the search
- Lesson 1.18: Translate conditions into Python
- Lesson 1.19: One-branch IF programs
- Lesson 1.20: Two-way IF ELSE programs
- Lesson 1.21: Ordered ELIF choices
- Lesson 1.22: Ranges and independent decisions
- Lesson 1.23: Boolean operators in Python
- Lesson 1.24: Design and test recommendations
- Lesson 1.25: Trace, debug and reflect
- Lesson 1.26: Choose data types and recognise Boolean literals
- Lesson 1.27: Set and use Boolean flags
- Lesson 1.28: Explain and identify constants
- Lesson 1.29: Express constants in three algorithm forms
- Lesson 1.30: Use a fixed factor in a calculation
- Lesson 1.31: Cast to Boolean and validate an empty response
- Lesson 1.32: Recall calls and trace return values
- Lesson 1.33: Supply parameters and reuse library code
- Lesson 1.34: Choose and import libraries responsibly
- Lesson 1.35: Round with floor and ceiling
- Lesson 1.36: Use pi and investigate another mathematical feature
- Lesson 1.37: Generate random choices within bounds
- Lesson 1.38: Investigate random real values and review library use
- Lesson 1.39: Retrieve test tables and predict selection outcomes
- Lesson 1.40: Decompose everyday problems
- Lesson 1.41: Decompose programs and organise shared work
- Lesson 1.42: Develop through repeated build/test cycles
- Lesson 1.43: Predict and verify algorithm outcomes
- Lesson 1.44: Choose representative and boundary tests
- Lesson 1.45: Build, execute and review a test plan
- Lesson 1.46: Recall physical inputs and compare transmission media
- Lesson 1.47: Configure a radio group and agree a message scheme
- Lesson 1.48: Send and receive numbers and strings
- Lesson 1.49: Trace numeric message sequences
- Lesson 1.50: Transmit text and use received data in conditions
- Lesson 1.51: Diagnose and extend a message protocol
- Lesson 1.52: Review communication and evidence of testing
- Lesson 1.53: Project 1: Adventure story
- Lesson 1.54: Project 2: Fire, Water, Earth
- Lesson 1.55: Check your progress 1
For grown-ups: using this lesson
Your answers are checked in your browser. Open responses need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.
Read one explanation, discuss the model and try the readiness check before the workbook. Choose “Mark lesson finished” when ready. Optional account progress saves lesson position and completion across devices; save personal responses before leaving.
2. Fill in your workbook
Read the teaching and complete workbook instructions. Choose, write or draw; Answer list offers larger controls. Trace code precisely and distinguish predictions from actual tests. Review designs, explanations and drawings with a grown-up.
Opening your PDF…
Swipe sideways across the worksheet on a small screen, or use “Answer list” for larger controls.
You’ve completed the checked activities.
TAKE YOUR PRACTICE OFFLINE
3. Download the student worksheet
All 10 original A4 student pages, ready for pencil-and-paper practice. Choose Review Answers to check your work on this webpage.
Student worksheet only · PDF · 8.3 MiB · No answer key included
TRY FIRST, THEN CHECK TOGETHER
Download the student worksheet →4. Answers & guidance
Finished your try? Open the guide and compare one worksheet at a time. Your own words may be different and still explain the right idea.
Shown on this webpage only. There is no answer-key download, and this guide is left out when printing the page.
Show answers for all 10 worksheets
Worksheet 1
- Question 1: Which operator requires both Boolean operands to be true? and
- Question 2: Which operator reverses one Boolean result? not
Worksheet 2
- Question 3: True and True True
- Question 4: True or True True
- Question 5: not True with B True False
- Question 6: True and False False
- Question 7: True or False True
- Question 8: not True with B False False
- Question 9: False and True False
- Question 10: False or True True
- Question 11: not False with B True True
- Question 12: False and False False
- Question 13: False or False False
- Question 14: not False with B False True
Worksheet 3
- Question 15: What prints for exact blue? Blue token
- Question 16: What prints for Blue with a capital B? Different token
- Question 17: Which comparison has the same result as not (token == "blue")? token != "blue"
Worksheet 4
- Question 18: Does a group of 9 with yes satisfy the whole condition? no, the size comparison is false
- Question 19: Does a group of 7 with no satisfy the whole condition? no, the card comparison is false
Worksheet 5
- Question 20: Whole room condition for 7/yes True
- Question 21: Room output for 7/yes Use room
- Question 22: Whole room condition for 8/yes True
- Question 23: Room output for 8/yes Use room
- Question 24: Whole room condition for 9/yes False
- Question 25: Room output for 9/yes Choose another room
- Question 26: Whole room condition for 7/no False
- Question 27: Room output for 7/no Choose another room
- Question 28: Whole room condition for 7/YES False
- Question 29: Room output for 7/YES Choose another room
Worksheet 6
- Question 30: How many accepted strings are listed? three
- Question 31: Which comparison is repeated for each accepted variant? answer == the accepted string
Worksheet 7
- Question 32: Riddle feedback for book Match
- Question 33: Riddle feedback for Book Match
- Question 34: Riddle feedback for BOOK Match
- Question 35: Riddle feedback for a book Try book
- Question 36: Riddle feedback for books Try book
- Question 37: Riddle feedback for pen Try book
Worksheet 8
- Question 38: Which version correctly rejects pen? B
- Question 39: Which Boolean operator joins the allowed alternatives? or
Worksheet 9
- Question 40: Create a program for this fictional exhibit rule. Read a nonnegative integer group size, a pass colour and cancellation text yes or no. Print Entry only when the group is at most 8, the pass is exactly blue or green, and the visit is not cancelled. Otherwise print Wait. Use and, or and not with complete comparisons and clear grouping. Test (8, blue, no), (8, green, no), (9, blue, no), (7, red, no) and (7, blue, yes). Record predictions, actual output or Pending and explain each Boolean operator. Cite complete code and test records if saved. Complete three-input program, integer conversion and exact text policy. Condition equivalent to group <= 8 and (colour == "blue" or colour == "green") and not (cancelled == "yes"). Entry for first two tests, Wait for remaining three. Valid nonnegative integer and cancellation yes/no domain explicit; no unstated validation. Clear parentheses ensure pass alternatives grouped with required size/cancellation, full comparison each side of or, lowercase keywords/colon/four-space blocks. Explain all three operators, complete source and prediction/actual or Pending evidence, correction and retest if needed. No numerical marks or invented execution. Grown-up review; personal evidence is required.
Worksheet 10
- Question 41: Modify the page 6 riddle to accept all five exact forms shown in the correct page 8 extension. Then create a separate original riddle with at least two agreed answer forms and a defined nonmatch response. Write its question and accepted forms before coding. Identify comparison and Boolean operators, accepted-output and all-false fallback blocks. Test every agreed form and at least one wrong input in both programs. Record predicted and actual feedback or Pending, an actual correction if needed, and individual or genuine partner review. Cite full source and test records or attach complete code. Modified original accepts exactly book, BOOK, Book, a book, books; wrong pen rejected. Own riddle question/accepted forms explicit, at least two meaningful forms using complete equality comparisons joined by or, one accepted feedback and defined fallback. Lowercase Python, colon and consistent action blocks; grouping/continuation valid if used. Tests cover all accepted forms and at least one wrong input in each program, prediction/actual or Pending separated, comparison == distinguished from Boolean or, true/fallback annotation, truthful review and correction/retest if needed. Accept documented broader normalisation only as explicit policy change with appropriate tests. No fake partner or execution evidence. Grown-up review; personal evidence is required.
Curriculum & workbook reference
- Cambridge Lower Secondary Computing Learner’s Book 8 — pages 97–99
- PaxaKids Grade 8 Computing Lesson 1.23: Boolean operators in Python — pages 1–10
Computing for your homeschool day
Explore Boolean operators in Python with this free Grade 8 Computing lesson. Read one idea together, try the fillable workbook and return to review at your own pace. Download the same student worksheet PDF for pencil-and-paper practice.
Fit learning around your family’s day. There is no timer and no sign-up is needed to use the lesson. An optional account saves your lesson position and completion across devices. Workbook responses and drawings stay in this tab; save a copy of your responses before leaving.
Understand your results
Closed answers are checked in your browser. Drawings and written explanations need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.
Choose Review Answers after trying the activity. The guide stays on the webpage; the worksheet download contains only the student pages.
For programme background, visit the Cambridge Lower Secondary Computing overview. PaxaKids provides independent original companion practice.
Book page references identify the related teaching topic. File-management and responsible-data preparation are original PaxaKids material; orientation or contents pages are not presented as teaching citations for those skills. The explanations, characters, programs and exercises here are original PaxaKids companion practice. Practical tasks require the appropriate editor and, where applicable, suitable equipment. A design or paper trace is not a verified hardware result. Only completed, reviewed lessons are listed.
Explore the Cambridge Lower Secondary Computing curriculum for programme background. PaxaKids is an independent learning resource.
