GRADE 8 · COMPUTING · UNIT 1 · LESSON 1.22
Computational thinking and programming
Ranges and independent decisions
Read a little. Try the workbook. Check your answers. Choose one section below to get started.
LET’S TRACE, REASON AND TEST
Ranges and independent decisions
A chained choice and separate IF statements have different behaviour. A range condition combines a lower and an upper bound. Specify whether each bound includes equality.
- Classify numeric directions or positions and distinguish mutually exclusive options from simultaneous edge alerts.
- Explain my method and support it with a labelled trace, example or test record.

Work through an example
For x = 6, both independent conditions x > 2 and x < 9 are true, so both bodies can run. An IF/ELIF chain would select at most one of those bodies.
Try before your workbook
Does the range x >= 2 AND x < 6 include 6? Which endpoint is included?
Explore the clues
Tap one card to find out more.
Understand the idea
A chained choice and separate IF statements have different behaviour. A range condition combines a lower and an upper bound. Specify whether each bound includes equality.
Concept to practise: Ranges and independent decisions.
Work through an example
For x = 6, both independent conditions x > 2 and x < 9 are true, so both bodies can run. An IF/ELIF chain would select at most one of those bodies.
Try before your workbook
Does the range x >= 2 AND x < 6 include 6? Which endpoint is included?
Check my readiness thinking
It excludes 6 and includes 2. Testing both endpoints helps distinguish an intended range from an off-by-one error.
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.
Use directions, ranges and map positions
You will decide when one ordered chain is suitable and when two separate decisions are needed. Every numerical rule and valid input range is stated so boundaries can be tested accurately.
Read bearings clockwise from north

Read this model’s labels and values
Classify a bearing into four direction sectors
Original Paxa four-direction classifier
bearing = int(input())
if bearing < 45:
print("North")
elif bearing < 135:
print("East")
elif bearing < 225:
print("South")
elif bearing < 315:
print("West")
else:
print("North")Test exact boundaries and the north wraparound
| Bearing | Direction | Bearing | Direction |
|---|---|---|---|
| 0 | {'clue': 'Exact text', 'prompt': 'Direction for 0', 'answers': ['North']} | 224 | {'clue': 'Exact text', 'prompt': 'Direction for 224', 'answers': ['South']} |
| 44 | {'clue': 'Exact text', 'prompt': 'Direction for 44', 'answers': ['North']} | 225 | {'clue': 'Exact text', 'prompt': 'Direction for 225', 'answers': ['West']} |
| 45 | {'clue': 'Exact text', 'prompt': 'Direction for 45', 'answers': ['East']} | 314 | {'clue': 'Exact text', 'prompt': 'Direction for 314', 'answers': ['West']} |
| 134 | {'clue': 'Exact text', 'prompt': 'Direction for 134', 'answers': ['East']} | 315 | {'clue': 'Exact text', 'prompt': 'Direction for 315', 'answers': ['North']} |
| 135 | {'clue': 'Exact text', 'prompt': 'Direction for 135', 'answers': ['South']} | 359 | {'clue': 'Exact text', 'prompt': 'Direction for 359', 'answers': ['North']} |
Specify an eight-direction version before coding
| Valid integer bearing | Output |
|---|---|
| 0–22 and 338–359 | North |
| 23–67 | North-east |
| 68–112 | East |
| 113–157 | South-east |
| 158–202 | South |
| 203–247 | South-west |
| 248–292 | West |
| 293–337 | North-west |
Specify nearest quarter-hour output
| Minutes past | Nearest label |
|---|---|
| 0–7 | On the hour |
| 8–22 | Quarter past |
| 23–37 | Half past |
| 38–52 | Quarter to |
| 53–59 | On the hour |
Read one movement command per run
Original Paxa movement program
x = 10
y = 15
command = input()
if command == "U":
y = y + 1
elif command == "D":
y = y - 1
elif command == "R":
x = x + 1
elif command == "L":
x = x - 1
else:
print("Unknown command")
print("x:", x)
print("y:", y)Trace separate runs, including invalid text
| Command | Result x | Result y |
|---|---|---|
| U | {'clue': 'Integer', 'prompt': 'x after U', 'answers': ['10']} | {'clue': 'Integer', 'prompt': 'y after U', 'answers': ['16']} |
| D | {'clue': 'Integer', 'prompt': 'x after D', 'answers': ['10']} | {'clue': 'Integer', 'prompt': 'y after D', 'answers': ['14']} |
| L | {'clue': 'Integer', 'prompt': 'x after L', 'answers': ['9']} | {'clue': 'Integer', 'prompt': 'y after L', 'answers': ['15']} |
| R | {'clue': 'Integer', 'prompt': 'x after R', 'answers': ['11']} | {'clue': 'Integer', 'prompt': 'y after R', 'answers': ['15']} |
| u | {'clue': 'Integer', 'prompt': 'x after u', 'answers': ['10']} | {'clue': 'Integer', 'prompt': 'y after u', 'answers': ['15']} |
| jump | {'clue': 'Integer', 'prompt': 'x after jump', 'answers': ['10']} | {'clue': 'Integer', 'prompt': 'y after jump', 'answers': ['15']} |
Modify only the vertical step size
Original Paxa vertical-step modification excerpt
if command == "U":
y = y + 4
elif command == "D":
y = y - 4Read the original C04 map and alert bands

Read this model’s labels and values
Read independent horizontal and vertical decisions
Original Paxa c04_map_edges.py
x = int(input())
y = int(input())
if x < 0 or x > 80 or y < 0 or y > 40:
print("Outside map")
else:
if x <= 4:
print("West edge")
elif x >= 76:
print("East edge")
if y <= 4:
print("South edge")
elif y >= 36:
print("North edge")
if x > 4 and x < 76 and y > 4 and y < 36:
print("Interior")Predict edge, corner, interior and outside results
| Position (x, y) | First printed line | Line count |
|---|---|---|
| (3, 38) | {'clue': 'Exact text', 'prompt': 'First map output at (3, 38)', 'answers': ['West edge']} | {'clue': 'Integer', 'prompt': 'Map output line count at (3, 38)', 'answers': ['2']} |
| (77, 2) | {'clue': 'Exact text', 'prompt': 'First map output at (77, 2)', 'answers': ['East edge']} | {'clue': 'Integer', 'prompt': 'Map output line count at (77, 2)', 'answers': ['2']} |
| (40, 20) | {'clue': 'Exact text', 'prompt': 'First map output at (40, 20)', 'answers': ['Interior']} | {'clue': 'Integer', 'prompt': 'Map output line count at (40, 20)', 'answers': ['1']} |
| (-1, 20) | {'clue': 'Exact text', 'prompt': 'First map output at (-1, 20)', 'answers': ['Outside map']} | {'clue': 'Integer', 'prompt': 'Map output line count at (-1, 20)', 'answers': ['1']} |
Find the alert hidden by a single chain
Intentional single-chain logic error
x = int(input())
y = int(input())
if x <= 4:
print("West edge")
elif x >= 76:
print("East edge")
elif y <= 4:
print("South edge")
elif y >= 36:
print("North edge")
else:
print("Interior")Plan, test and reflect on independence
For your reflection, choose Worked independently, Used prompts or Needed guided support, then cite actual examples. Compare with an earlier programming task and identify one next step. These are evidence-based descriptions, not numeric ratings.
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 16 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.4 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 16 worksheets
Worksheet 1
- Question 1: Which requirement may need two messages from one position? warn near both edges at a map corner
- Question 2: What should a numeric range specification make clear? which boundary values belong to each result
Worksheet 2
This page introduces the activity. There are no marked responses on this sheet.
Worksheet 3
- Question 3: How many elif headers are in this program? 3
- Question 4: What is the final else result for valid input? North
- Question 5: Why does bearing 90 reach the second test? 90 is not below 45
Worksheet 4
- Question 6: Direction for 0 North
- Question 7: Direction for 224 South
- Question 8: Direction for 44 North
- Question 9: Direction for 225 West
- Question 10: Direction for 45 East
- Question 11: Direction for 314 West
- Question 12: Direction for 134 East
- Question 13: Direction for 315 North
- Question 14: Direction for 135 South
- Question 15: Direction for 359 North
Worksheet 5
This page introduces the activity. There are no marked responses on this sheet.
Worksheet 6
- Question 16: What label is selected for 7 minutes? On the hour
- Question 17: What label is selected for 8 minutes? Quarter past
Worksheet 7
This page introduces the activity. There are no marked responses on this sheet.
Worksheet 8
- Question 18: x after U 10
- Question 19: y after U 16
- Question 20: x after D 10
- Question 21: y after D 14
- Question 22: x after L 9
- Question 23: y after L 15
- Question 24: x after R 11
- Question 25: y after R 15
- Question 26: x after u 10
- Question 27: y after u 15
- Question 28: x after jump 10
- Question 29: y after jump 15
Worksheet 9
- Question 30: In a fresh modified run, what y results from U? 19
- Question 31: In a fresh modified run, what y results from D? 11
- Question 32: In a fresh modified run, what x results from U? 10
Worksheet 10
This page introduces the activity. There are no marked responses on this sheet.
Worksheet 11
This page introduces the activity. There are no marked responses on this sheet.
Worksheet 12
- Question 33: First map output at (3, 38) West edge
- Question 34: Map output line count at (3, 38) 2
- Question 35: First map output at (77, 2) East edge
- Question 36: Map output line count at (77, 2) 2
- Question 37: First map output at (40, 20) Interior
- Question 38: Map output line count at (40, 20) 1
- Question 39: First map output at (-1, 20) Outside map
- Question 40: Map output line count at (-1, 20) 1
- Question 41: At x = 4, is the West edge test true? yes
Worksheet 13
- Question 42: At (3, 38), what does this wrong version print? West edge only
- Question 43: Which repair restores both axis alerts? start a separate if for the vertical edge tests
Worksheet 14
- Question 44: Which input best exposes a missing second edge alert? a corner-band point such as (3, 38)
- Question 45: What should support reflection record? the actual help used and evidence of work
Worksheet 15
- Question 46: Create separate eight-direction and nearest-quarter-hour programs from the complete policies on pages 5 and 6. State the valid input domains, use ordered conditions and give a defined result for every valid input. For the compass version, test all eight direction centres plus 22, 23 and 359. For time, test 7, 8, 22, 23, 52 and 53. Record exact predicted and actual output or Pending. Explain a boundary and the north/hour wraparound. Cite full saved programs and test records, or write and attach complete code. Eight-direction integer domain 0–359: <23 N,<68 NE,<113 E,<158 SE,<203 S,<248 SW,<293 W,<338 NW,else N, using stated full direction text. Test centres 0/45/90/135/180/225/270/315 plus22 N,23 NE,359 N. Clock integer domain 0–59: <8 On the hour,<23 Quarter past,<38 Half past,<53 Quarter to,else On the hour. Time cases: 7 gives On the hour; 8 and 22 give Quarter past; 23 gives Half past; 52 gives Quarter to; 53 gives On the hour. No gaps/overlaps in selected outcomes; complete code/file evidence, input domains explicit, exact predictions/actual or Pending, correction/retest if any. Accept equivalent correct ordered lower-bound chain. No numeric marks. Grown-up review; personal evidence is required.
Worksheet 16
- Question 47: Save a complete movement version with vertical steps of 4 and horizontal steps of 1 from (10, 15). Test U, D, L, R and an invalid command in fresh runs. Then implement or enter the complete C04 edge program and test (4, 36), (5, 35), (76, 4) and an outside point. Show why corner cases need separate horizontal and vertical decisions. Keep predicted and actual outputs or Pending and any correction/retest. Cite complete source and records. Finally use the page 14 reflection labels, describe help actually used and compare your independence with a previous task. Modified movement U=(10,19),D=(10,11),L=(9,15),R=(11,15); invalid unchanged with warning, both coordinate outputs after chain. Map (4,36) West then North; (5,35) Interior; (76,4) East then South; outside point Outside map only. Separate axis if blocks retain both warnings, exact inclusive boundaries and guard. Complete source and prediction/actual/Pending records. Reflection uses nonnumeric independence description, truthful actual help, comparison with prior task and concrete next step. No fabricated GUI, physical movement or partner activity. Grown-up review; personal evidence is required.
Curriculum & workbook reference
- Cambridge Lower Secondary Computing Learner’s Book 8 — pages 93–97
- PaxaKids Grade 8 Computing Lesson 1.22: Ranges and independent decisions — pages 1–16
Computing for your homeschool day
Explore Ranges and independent decisions 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.
