GRADE 8 · COMPUTING · UNIT 1 · LESSON 1.18
Computational thinking and programming
Translate conditions into Python
Read a little. Try the workbook. Check your answers. Choose one section below to get started.
LET’S TRACE, REASON AND TEST
Translate conditions into Python
Python comparisons use operators such as ==, !=, < and >=. An IF header ends with a colon and its body is indented. Assignment with = is different from an equality comparison.
- Bridge from pseudocode to Python comparisons, lowercase if, a colon and an indented suite.
- Explain my method and support it with a labelled trace, example or test record.

Work through an example
If count = 7, the expression count == 7 is true. A conditional print inside if count == 7: runs; replacing == with = is not a valid equality test in that header.
Try before your workbook
Which operator tests whether two values are different in Python, and what does 4 != 4 produce?
Explore the clues
Tap one card to find out more.
Understand the idea
Python comparisons use operators such as ==, !=, < and >=. An IF header ends with a colon and its body is indented. Assignment with = is different from an equality comparison.
Concept to practise: Translate conditions into Python.
Work through an example
If count = 7, the expression count == 7 is true. A conditional print inside if count == 7: runs; replacing == with = is not a valid equality test in that header.
Try before your workbook
Which operator tests whether two values are different in Python, and what does 4 != 4 produce?
Check my readiness thinking
Use !=. The comparison 4 != 4 produces False because the two values are equal.
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.
Turn a decision into executable Python
Pseudocode explains the algorithm. Python requires its own exact syntax: lowercase if, a colon after the condition and an indented block. This lesson uses four spaces for each block level.
Choose the comparison that matches the rule
| Operator | Meaning | Example result |
|---|---|---|
| > | Greater than | 9 > 9 is False |
| Less than | 8 < 9 is True | |
| >= | Greater than or equal to | 9 >= 9 is True |
| <= | Less than or equal to | 9 <= 9 is True |
| == | Equal to | 9 == 9 is True |
| != | Not equal to | 8 != 9 is True |
Keep assignment separate from equality
| Expression | Your result |
|---|---|
| count == 9 | {'clue': 'True or False', 'prompt': 'count equals 9', 'answers': ['True']} |
| count != 9 | {'clue': 'True or False', 'prompt': 'count differs from 9', 'answers': ['False']} |
| count > 9 | {'clue': 'True or False', 'prompt': 'count greater than 9', 'answers': ['False']} |
| count >= 9 | {'clue': 'True or False', 'prompt': 'count at least 9', 'answers': ['True']} |
Assignment followed by comparisons
count = 9
count == 9
count != 9
count > 9
count >= 9Translate the same single-branch algorithm
Pseudocode
INPUT count
IF count >= 9 THEN
OUTPUT "Ready"
ENDIF
OUTPUT "Checked"Python 3
count = int(input())
if count >= 9:
print("Ready")
print("Checked")Trace the block and the boundary
| Input count | First output line | Number of output lines |
|---|---|---|
| 8 | {'clue': 'Exact text', 'prompt': 'First output for count 8', 'answers': ['Checked']} | {'clue': 'Line count', 'prompt': 'Output lines for count 8', 'answers': ['1']} |
| 9 | {'clue': 'Exact text', 'prompt': 'First output for count 9', 'answers': ['Ready']} | {'clue': 'Line count', 'prompt': 'Output lines for count 9', 'answers': ['2']} |
| 10 | {'clue': 'Exact text', 'prompt': 'First output for count 10', 'answers': ['Ready']} | {'clue': 'Line count', 'prompt': 'Output lines for count 10', 'answers': ['2']} |
Recall compound decisions before translating them
Three possible outcomes
INPUT firstReading
INPUT secondReading
IF firstReading > 40 AND secondReading > 40 THEN
OUTPUT "Both high"
ELSEIF firstReading > 40 OR secondReading > 40 THEN
OUTPUT "One high"
ELSE
OUTPUT "Neither high"
ENDIFSelect input pairs for every outcome
| First | Second | Exact output |
|---|---|---|
| 41 | 42 | {'clue': 'Both high / One high / Neither high', 'prompt': 'Output for readings 41 and 42', 'answers': ['Both high']} |
| 41 | 40 | {'clue': 'Both high / One high / Neither high', 'prompt': 'Output for readings 41 and 40', 'answers': ['One high']} |
| 40 | 41 | {'clue': 'Both high / One high / Neither high', 'prompt': 'Output for readings 40 and 41', 'answers': ['One high']} |
| 40 | 40 | {'clue': 'Both high / One high / Neither high', 'prompt': 'Output for readings 40 and 40', 'answers': ['Neither high']} |
Check syntax without changing the policy
A: compare and indent
count = int(input())
if count >= 9:
print("Ready")
print("Checked")B: different block
count = int(input())
if count >= 9:
print("Ready")
print("Checked")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.0 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: What does a condition provide? a result that can be True or False
- Question 2: Which Python keyword starts a conditional statement? if
Worksheet 2
- Question 3: Write the comparison operator for at least. >=
- Question 4: Write the comparison operator for different from. !=
Worksheet 3
- Question 5: count equals 9 True
- Question 6: count differs from 9 False
- Question 7: count greater than 9 False
- Question 8: count at least 9 True
Worksheet 4
- Question 9: Which punctuation symbol ends the Python if header? :
- Question 10: How many leading spaces indent print("Ready") in this example? 4
- Question 11: Which statement is outside the conditional block? print("Checked")
Worksheet 5
- Question 12: First output for count 8 Checked
- Question 13: Output lines for count 8 1
- Question 14: First output for count 9 Ready
- Question 15: Output lines for count 9 2
- Question 16: First output for count 10 Ready
- Question 17: Output lines for count 10 2
- Question 18: Why is print("Checked") unindented? it belongs after the conditional block
Worksheet 6
- Question 19: Which Boolean operator requires both comparisons to be true? AND
- Question 20: After the Both high branch is selected, what happens? the later alternatives are skipped
Worksheet 7
- Question 21: Output for readings 41 and 42 Both high
- Question 22: Output for readings 41 and 40 One high
- Question 23: Output for readings 40 and 41 One high
- Question 24: Output for readings 40 and 40 Neither high
- Question 25: Which pair produces Neither high? 39 and 40
Worksheet 8
- Question 26: Which version follows the complete policy? A
- Question 27: What does version B print for input 8? no output lines
- Question 28: Which header is valid Python for this rule? if count >= 9:
Worksheet 9
- Question 29: Write pseudocode and Python for this rule: read an integer pack count; if it is at least 6, print Pack ready. After that decision, print Check complete for every valid integer input. Use one if, a colon and a four-space block. Test 5, 6 and 7. Record predicted output lines, then actual Python output if you run it, or mark execution Pending. Explain why the exact threshold 6 and the unindented final output matter. Require integer conversion, if packs >= 6:, four spaces before print("Pack ready"), unindented print("Check complete"). Pseudocode same rule using INPUT/IF THEN/ENDIF/OUTPUT. For 5 only Check complete; for 6 and 7 Pack ready then Check complete. Three predicted/observed cases or honest Pending. Explain inclusive boundary and final outside block. Accept equivalent meaningful variable names and correct syntax. No claim of learner execution without evidence. Grown-up review; personal evidence is required.
Worksheet 10
- Question 30: For the sensor pseudocode on page 6, choose your own input pair for each of Both high, One high and Neither high. Include a pair with one reading exactly 40. State the comparison results and why the selected output follows. Give a second pair that makes One high with the other reading high. Explain why a pair with both readings high prints only Both high. Review your work with a partner if available; otherwise label it an individual review. Record any correction and the evidence that supports it. All inputs supplied by learner must meet strict >40. Both high requires both above 40; One high exactly one above 40, covering both orientations; Neither high both <=40. At least one pair uses 40. Explain first-match chain skips later branch after true first condition even though OR would also be true. Identify actual individual/peer review honestly and explain a correction if any. No fabricated partner evidence and no numerical marks. Grown-up review; personal evidence is required.
Curriculum & workbook reference
- Cambridge Lower Secondary Computing Learner’s Book 8 — pages 70–74
- PaxaKids Grade 8 Computing Lesson 1.18: Translate conditions into Python — pages 1–10
Computing for your homeschool day
Explore Translate conditions into 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.
