GRADE 8 · COMPUTING · UNIT 1 · LESSON 1.7

Computational thinking and programming

Conditions and two-way flow

Read a little. Try the workbook. Check your answers. Choose one section below to get started.

Topic 1.7 · Conditions and two-way flow8 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Conditions and two-way flow

A condition has a Boolean result: true or false. In a two-way decision, one branch is chosen according to that result. State the comparison and test a value on each side of its boundary.

Today’s two goals
  • Read a decision diamond and evaluate a comparison before following its true or false branch.
  • Explain my method and support it with a labelled trace, example or test record.
Original PaxaKids illustration for Conditions and two-way flow. Use the supplied program and data models for precise workbook facts.
An original PaxaKids workbook scene. Use the supplied programs and data for precise workbook facts.

Work through an example

For a fictional rule that a score of at least 12 earns a badge, score >= 12 is true at 12 and false at 11. The equality case matters because at least includes the boundary.

Try before your workbook

For a rule count > 5, should a count of exactly 5 follow the true branch?

Explore the clues

Tap one card to find out more.

Understand the idea

A condition has a Boolean result: true or false. In a two-way decision, one branch is chosen according to that result. State the comparison and test a value on each side of its boundary.

Concept to practise: Conditions and two-way flow.

Work through an example

For a fictional rule that a score of at least 12 earns a badge, score >= 12 is true at 12 and false at 11. The equality case matters because at least includes the boundary.

Try before your workbook

For a rule count > 5, should a count of exactly 5 follow the true branch?

Check my readiness thinking

No. Greater than excludes equality. A count of 6 follows the true branch; 5 follows the false branch.

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.

Choose a route by evaluating a condition

Selection changes the route through an algorithm. A decision diamond asks a question that evaluates to True or False. Evaluate the comparison using the current values, then follow the matching labelled arrow.

Our examples use whole-number fictional prices and counts. In this workbook, == means equal, != means not equal, and <- means assignment. These are stated pseudocode conventions; Python uses = for assignment.

Follow both routes of this original budget plan

The fictional book-fair rule is deliberately strict: cost must be less than 30. Trace this version as written. An OUTPUT displays the quoted text or current number; extra is calculated only on the False route.
Follow both routes of this original budget plan — original labelled workbook model. The following text version gives its labels and values.
Follow both routes of this original budget plan · original PaxaKids model.
Read this model’s labels and values
Before
    1. start
    2. Start
    1. input
    2. INPUT cost
Condition
cost < 30
True
    1. output
    2. OUTPUT
      "Buy option"
False
    1. output
    2. OUTPUT "Wait"
    1. process
    2. extra <-
      cost - 30
    1. output
    2. OUTPUT extra

Test below, at and above the boundary

Test below, at and above the boundary — original model
Input costCondition cost < 30Route and exact output
29{'clue': 'True or False', 'prompt': 'For cost 29: cost < 30', 'answers': ['True', 'true']}Complete the question below.
30{'clue': 'True or False', 'prompt': 'For cost 30: cost < 30', 'answers': ['False', 'false']}Complete the questions below.
31{'clue': 'True or False', 'prompt': 'For cost 31: cost < 30', 'answers': ['False', 'false']}Complete the question below.

Use all six comparison operators

Comparisons test a relationship. In these examples, numbers are compared as numbers. A Boolean result is True or False; it is not the difference between the numbers.
Use all six comparison operators — original model
OperatorMeaningExample and result
==equal to8 == 8 is True
!=not equal to8 != 8 is False
less than8 < 9 is True
>greater than8 > 9 is False
<=less than or equal to8 <= 8 is True
>=greater than or equal to8 >= 8 is True

A condition can compare exact strings

At the fictional theatre desk, seat is a string. Compare it exactly with "Balcony". If equal, output "Upper room"; otherwise output "Main room". This example does not change letter case or remove spaces.

The illustration sets the scene. Use the stated text rules, not anything printed on its props.

Read the source boundary before repairing it

The book’s budget example uses the strict condition cost < 22. Its False route calculates extra <- cost - 22. Exactly 22 therefore follows False and calculates zero extra. This is the result of the written algorithm, even if an inclusive budget policy was intended.

A simple IF can also omit an ELSE: False then skips the inside action and continues after ENDIF. Do not invent a False action that is absent.
ORIGINAL ONE-ACTION EXAMPLE
INPUT tokens
IF tokens > 0 THEN
    OUTPUT "Token available"
ENDIF
OUTPUT "Finished"

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.

Paxa the Fox

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
  1. Lesson 1.1: Recall algorithms and representations
  2. Lesson 1.2: Purpose and conventions of pseudocode
  3. Lesson 1.3: Input, output and strings
  4. Lesson 1.4: Identifiers and assignment
  5. Lesson 1.5: Arithmetic and translation
  6. Lesson 1.6: Trace and review a sequence
  7. Lesson 1.7: Conditions and two-way flow
  8. Lesson 1.8: IF THEN and indentation
  9. Lesson 1.9: IF THEN ELSE and decision diagrams
  10. Lesson 1.10: Ordered ELSEIF and fallback ELSE
  11. Lesson 1.11: Match flowchart and pseudocode branches
  12. Lesson 1.12: AND, OR and NOT
  13. Lesson 1.13: Grouping, precedence and review
  14. Lesson 1.14: Why software searches
  15. Lesson 1.15: A successful linear search
  16. Lesson 1.16: An unsuccessful search and termination
  17. Lesson 1.17: Practise and communicate the search
  18. Lesson 1.18: Translate conditions into Python
  19. Lesson 1.19: One-branch IF programs
  20. Lesson 1.20: Two-way IF ELSE programs
  21. Lesson 1.21: Ordered ELIF choices
  22. Lesson 1.22: Ranges and independent decisions
  23. Lesson 1.23: Boolean operators in Python
  24. Lesson 1.24: Design and test recommendations
  25. Lesson 1.25: Trace, debug and reflect
  26. Lesson 1.26: Choose data types and recognise Boolean literals
  27. Lesson 1.27: Set and use Boolean flags
  28. Lesson 1.28: Explain and identify constants
  29. Lesson 1.29: Express constants in three algorithm forms
  30. Lesson 1.30: Use a fixed factor in a calculation
  31. Lesson 1.31: Cast to Boolean and validate an empty response
  32. Lesson 1.32: Recall calls and trace return values
  33. Lesson 1.33: Supply parameters and reuse library code
  34. Lesson 1.34: Choose and import libraries responsibly
  35. Lesson 1.35: Round with floor and ceiling
  36. Lesson 1.36: Use pi and investigate another mathematical feature
  37. Lesson 1.37: Generate random choices within bounds
  38. Lesson 1.38: Investigate random real values and review library use
  39. Lesson 1.39: Retrieve test tables and predict selection outcomes
  40. Lesson 1.40: Decompose everyday problems
  41. Lesson 1.41: Decompose programs and organise shared work
  42. Lesson 1.42: Develop through repeated build/test cycles
  43. Lesson 1.43: Predict and verify algorithm outcomes
  44. Lesson 1.44: Choose representative and boundary tests
  45. Lesson 1.45: Build, execute and review a test plan
  46. Lesson 1.46: Recall physical inputs and compare transmission media
  47. Lesson 1.47: Configure a radio group and agree a message scheme
  48. Lesson 1.48: Send and receive numbers and strings
  49. Lesson 1.49: Trace numeric message sequences
  50. Lesson 1.50: Transmit text and use received data in conditions
  51. Lesson 1.51: Diagnose and extend a message protocol
  52. Lesson 1.52: Review communication and evidence of testing
  53. Lesson 1.53: Project 1: Adventure story
  54. Lesson 1.54: Project 2: Fire, Water, Earth
  55. 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.

Conditions and two-way flow8 student pages · original artwork

Opening your PDF…

Swipe sideways across the worksheet on a small screen, or use “Answer list” for larger controls.

TAKE YOUR PRACTICE OFFLINE

3. Download the student worksheet

All 8 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

Download worksheet PDF ↓

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 8 worksheets

Worksheet 1

  1. Question 1: What determines the exit from a decision diamond? the truth value of its condition
  2. Question 2: For cost = 18, what is the result of cost < 30? True
  3. Question 3: Which shape normally contains an assignment calculation? a process rectangle

Worksheet 2

This page introduces the activity. There are no marked responses on this sheet.

Worksheet 3

  1. Question 4: For cost 29: cost < 30 True / true
  2. Question 5: For cost 30: cost < 30 False / false
  3. Question 6: For cost 31: cost < 30 False / false
  4. Question 7: Which output is displayed for cost 29? Buy option
  5. Question 8: After Wait, which number is displayed for cost 30? 0
  6. Question 9: After Wait, which number is displayed for cost 31? 1

Worksheet 4

  1. Question 10: Which comparison is True when count equals 5? count >= 5
  2. Question 11: Which condition excludes exactly the value 5? count != 5

Worksheet 5

  1. Question 12: For seat = "Balcony", which route is followed? True: Upper room
  2. Question 13: For seat = "balcony", which output is produced? Main room
  3. Question 14: Which operator tests equality under our convention? ==

Worksheet 6

  1. Question 15: In the source budget example, write True or False for 22 < 22. False / false
  2. Question 16: In that same source example, what is extra when cost is 22? 0
  3. Question 17: For tokens = 0, what does the one-action example display? Finished only

Worksheet 7

  1. Question 18: Design an original theatre decision flowchart. Input whole-number tickets_left. If tickets_left > 0, output "Tickets available"; otherwise output "Sold out". Use the correct input, decision, output and start/stop shapes. Label both decision exits, join both routes to Stop, then record the route and exact output for inputs 0, 1 and 4. Use only the stated inputs; do not add real booking details. Require Start, INPUT tickets_left in parallelogram, tickets_left > 0 diamond, True to Tickets available and False to Sold out in output parallelograms; both reach Stop. 0 False/Sold out; 1 and 4 True/Tickets available. No assignment masquerading as input/output. Arrow direction unambiguous, labels readable and no disconnected branch. Equivalent clean layout accepted. No numeric scoring. Grown-up review; personal evidence is required.

Worksheet 8

  1. Question 19: Compare two book-fair policies: A accepts cost < 30; B accepts cost <= 30. For costs 29, 30 and 31, record each truth value and state which inputs change route. Explain why the page 2 plan displays Wait then 0 at cost 30. Propose the single comparison change for an inclusive 30-unit budget. Explain the similar cost-22 issue in the source example. Identify whether your evidence is a manual trace or an actual program run, and record any practical or peer step still Pending. A results True, False, False; B True, True, False. Only cost 30 changes route. Page 2 as written follows False at 30, outputs Wait, computes extra = 0 and outputs 0. Change < to <= for an inclusive limit; trace original first, clearly label revised requirement. Source 22 < 22 is False, extra 0, analogous <= repair for inclusive 22. Require exact route/output evidence and honest trace/run distinction; optional ELSE is not universally mandatory. No invented completion or numeric marks. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Conditions and two-way flow 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.