GRADE 8 · COMPUTING · UNIT 1 · LESSON 1.24

Computational thinking and programming

Design and test recommendations

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

Topic 1.24 · Design and test recommendations14 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Design and test recommendations

Begin a recommendation algorithm with explicit requirements and accepted inputs. Choose the branches, predict their outcomes and test representative cases. A recommendation is only as complete as the stated rule.

Today’s two goals
  • Combine categorical and numeric inputs, accommodate agreed text variants and supply an unmatched-input response.
  • Explain my method and support it with a labelled trace, example or test record.
Original PaxaKids illustration for Design and test recommendations. 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

A fictional club rule could recommend art for choice "draw" and music for choice "sing", with a clear message for any other input. Tests should cover both recognised choices and an unrecognised one.

Try before your workbook

Why is testing only the recognised draw option insufficient?

Explore the clues

Tap one card to find out more.

Understand the idea

Begin a recommendation algorithm with explicit requirements and accepted inputs. Choose the branches, predict their outcomes and test representative cases. A recommendation is only as complete as the stated rule.

Concept to practise: Design and test recommendations.

Work through an example

A fictional club rule could recommend art for choice "draw" and music for choice "sing", with a clear message for any other input. Tests should cover both recognised choices and an unrecognised one.

Try before your workbook

Why is testing only the recognised draw option insufficient?

Check my readiness thinking

It leaves the other branch and invalid-input behaviour unchecked. Add independent expected results for sing and an unrecognised input, then record the actual evidence.

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.

Design recommendations from a clear policy

A recommendation program needs a table of choices before code. It can combine a category with a number, choose one eligible result and give a clear response when nothing matches.

This lesson uses invented film titles, fictional age rules and imaginary songs. These are coding data, not real classifications or personal recommendations. All ages entered are fictional valid nonnegative integers.

Read the complete fictional film policy

For each exact category, select the highest eligible minimum-age row. Higher thresholds must be tested first within that category. A minimum age of 0 provides a choice for every valid age in that category. These invented rules exist only for this exercise.
Read the complete fictional film policy — original model
Exact categoryMinimum ageInvented title
Adventure14Canyon code
Adventure10River rescue
Adventure0Garden voyage
Animation9Cloud builders
Animation0Little comet
Mystery12Clocktower clue
Mystery0Missing kite

Trace the original exact-case version

Read an integer age, then category text, on separate input lines. This original version has no else. If no condition matches, it prints no title. The category is compared exactly, including capitalisation.
Original Paxa fictional-film selector
age = int(input())
interest = input()
if age >= 14 and interest == "Adventure":
    print("Canyon code")
elif age >= 10 and interest == "Adventure":
    print("River rescue")
elif interest == "Adventure":
    print("Garden voyage")
elif age >= 9 and interest == "Animation":
    print("Cloud builders")
elif interest == "Animation":
    print("Little comet")
elif age >= 12 and interest == "Mystery":
    print("Clocktower clue")
elif interest == "Mystery":
    print("Missing kite")

Predict category and age outcomes

Use page 3. Write the exact selected title, or None when no title prints. None here is a worksheet label for no output, not the Python value printed by the program.
Predict category and age outcomes — original model
Fictional ageCategory textTitle or None
14Adventure{'clue': 'Exact text', 'prompt': 'Base film selection for 14/Adventure', 'answers': ['Canyon code']}
10Adventure{'clue': 'Exact text', 'prompt': 'Base film selection for 10/Adventure', 'answers': ['River rescue']}
8Animation{'clue': 'Exact text', 'prompt': 'Base film selection for 8/Animation', 'answers': ['Little comet']}
12Mystery{'clue': 'Exact text', 'prompt': 'Base film selection for 12/Mystery', 'answers': ['Clocktower clue']}
14adventure{'clue': 'Exact text', 'prompt': 'Base film selection for 14/adventure', 'answers': ['None']}

Choose text normalisation deliberately

One possible design removes outside whitespace with strip() and converts letters to lowercase with lower(). Store the returned text, then compare against lowercase category names. This accepts more than two listed spellings; it does not correct spelling errors or remove internal spaces.
References: Python strip() and Python lower().
Choose text normalisation deliberately — original model
Raw text, shown in quotesStored interest
"Adventure"{'clue': 'Exact text', 'prompt': 'Normalised "Adventure"', 'answers': ['adventure']}
" ADVENTURE "{'clue': 'Exact text', 'prompt': 'Normalised " ADVENTURE "', 'answers': ['adventure']}
"science fiction"{'clue': 'Exact text', 'prompt': 'Normalised "science fiction"', 'answers': ['science fiction']}
Original normalisation step
interest = input().strip().lower()

Compare two valid approaches to accepted forms

You may explicitly accept an agreed list of exact spellings with full comparisons joined by or. Or you may normalise input and use one lowercase comparison. Their accepted sets differ, so document the choice. Group alternatives with parentheses when combining them with an age requirement.
A: two exact forms
interest = input()
if (age >= 14 and
    (interest == "Adventure"
     or interest == "adventure")):
    print("Canyon code")
B: normalised input
interest = input().strip().lower()
if age >= 14 and interest == "adventure":
    print("Canyon code")

Add a category and a fallback from a table

The enhanced example adds two invented Nature titles. For Nature, choose Mountain journal from age 11; otherwise choose Pond paths. Keep the existing seven titles, normalise the input and print Unknown category if no category matches. All ages remain valid nonnegative integer inputs.
Add a category and a fallback from a table — original model
ChangePolicy
New Nature titleAge at least 11: Mountain journal.
New Nature fallbackAge below 11: Pond paths.
Unknown textUnknown category after all category alternatives.
Text formsStrip outside whitespace and convert to lowercase.

Read the complete enhanced selector

This complete original example implements the stated input policy, all original categories, the two Nature titles and a final unmatched-category response. The first matching branch is the only selected title.
Original Paxa enhanced fictional-film selector
age = int(input())
interest = input().strip().lower()
if age >= 14 and interest == "adventure":
    print("Canyon code")
elif age >= 10 and interest == "adventure":
    print("River rescue")
elif interest == "adventure":
    print("Garden voyage")
elif age >= 9 and interest == "animation":
    print("Cloud builders")
elif interest == "animation":
    print("Little comet")
elif age >= 12 and interest == "mystery":
    print("Clocktower clue")
elif interest == "mystery":
    print("Missing kite")
elif age >= 11 and interest == "nature":
    print("Mountain journal")
elif interest == "nature":
    print("Pond paths")
else:
    print("Unknown category")

Test the changed policy, including the new threshold

Use page 8. Quotes in the table show outside spaces but are not part of the input. Write the exact selected title or fallback response.
Test the changed policy, including the new threshold — original model
Fictional ageRaw categoryOutput
10Nature{'clue': 'Exact text', 'prompt': 'Enhanced film for 10/Nature', 'answers': ['Pond paths']}
11nature{'clue': 'Exact text', 'prompt': 'Enhanced film for 11/nature', 'answers': ['Mountain journal']}
9" ANIMATION "{'clue': 'Exact text', 'prompt': 'Enhanced film for 9/" ANIMATION "', 'answers': ['Cloud builders']}
14adventure{'clue': 'Exact text', 'prompt': 'Enhanced film for 14/adventure', 'answers': ['Canyon code']}
15sport{'clue': 'Exact text', 'prompt': 'Enhanced film for 15/sport', 'answers': ['Unknown category']}

Design a song-choice table with a maximum duration

These song names and durations are invented task data. The maximum is a valid nonnegative whole number of minutes. For a recognised style, select the longest listed song that does not exceed the maximum. If none fits, output No song fits. An unknown style gets Unknown style.
Design a song-choice table with a maximum duration — original model
Invented titleStyleDuration in minutes
Quiet orbitclassical4
Dawn notesclassical2
Harbour dancefolk5
Trail echofolk3

Read the complete original song selector

The code checks the longer song first within each recognised style. Normalisation is the stated policy. The final two alternatives distinguish a known style with too little time from an unknown style.
Original Paxa song-duration selector
maximum = int(input())
style = input().strip().lower()
if style == "classical" and maximum >= 4:
    print("Quiet orbit")
elif style == "classical" and maximum >= 2:
    print("Dawn notes")
elif style == "folk" and maximum >= 5:
    print("Harbour dance")
elif style == "folk" and maximum >= 3:
    print("Trail echo")
elif style == "classical" or style == "folk":
    print("No song fits")
else:
    print("Unknown style")

Transfer the same reasoning to original module C04

The complete supplied C04 workshop program combines minutes and an interest, validates the numeric range and interest, then selects one suitable workshop. It uses the same normalisation, specific-before-broad order and defined fallback principles.
Original Paxa c04_workshop_planner.py
minutes = int(input())
interest = input().strip().lower()
if minutes < 0 or minutes > 120:
    print("Invalid time")
elif not (interest == "art" or interest == "science"):
    print("Unknown interest")
elif interest == "art" and minutes >= 45:
    print("Paper sculpture")
elif interest == "art" and minutes >= 20:
    print("Pattern tiles")
elif interest == "science" and minutes >= 40:
    print("Bridge challenge")
elif interest == "science" and minutes >= 15:
    print("Shadow sketch")
else:
    print("Choose a longer time")
print("Planner 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.

Design and test recommendations14 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 14 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 14 worksheets

Worksheet 1

  1. Question 1: What should the code implement? the stated policy table and input rules
  2. Question 2: Why include an unmatched category test? to check the defined response when no category matches

Worksheet 2

  1. Question 3: For fictional age 14 and Adventure, which title should be selected? Canyon code

Worksheet 3

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

Worksheet 4

  1. Question 4: Base film selection for 14/Adventure Canyon code
  2. Question 5: Base film selection for 10/Adventure River rescue
  3. Question 6: Base film selection for 8/Animation Little comet
  4. Question 7: Base film selection for 12/Mystery Clocktower clue
  5. Question 8: Base film selection for 14/adventure None

Worksheet 5

  1. Question 9: Normalised "Adventure" adventure
  2. Question 10: Normalised " ADVENTURE " adventure
  3. Question 11: Normalised "science fiction" science fiction

Worksheet 6

  1. Question 12: Which approach accepts outer spaces around ADVENTURE as written? B
  2. Question 13: Why group the two exact forms in version A? both forms must still satisfy the age requirement

Worksheet 7

  1. Question 14: Where should a category-wide nature test appear? after the age-specific nature test
  2. Question 15: How many fallback else blocks can this one chain contain? at most one

Worksheet 8

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

Worksheet 9

  1. Question 16: Enhanced film for 10/Nature Pond paths
  2. Question 17: Enhanced film for 11/nature Mountain journal
  3. Question 18: Enhanced film for 9/" ANIMATION " Cloud builders
  4. Question 19: Enhanced film for 14/adventure Canyon code
  5. Question 20: Enhanced film for 15/sport Unknown category

Worksheet 10

  1. Question 21: For folk with a maximum of 4 minutes, which result follows the policy? Trail echo
  2. Question 22: For classical with a maximum of 1 minute, what should happen? No song fits

Worksheet 11

  1. Question 23: Which input selects Harbour dance at the exact duration boundary? maximum 5, style folk

Worksheet 12

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

Worksheet 13

  1. Question 24: Extend the page 3 fictional-film selector. Add a clear unmatched-category response, document which text forms you accept and implement that policy consistently. Add a new category different from the page 7 example, with at least two invented titles and stated minimum ages. Write its policy table before coding and explain the branch order. Test each original category, below and exactly at your new threshold, an agreed case variant and an unknown category. Record predictions and actual output or Pending, plus a correction/retest if needed. Cite the complete source, policy and test-record files. Preserve original three-category behaviour for valid nonnegative fictional ages, add one final unmatched fallback and documented exact-variants or normalisation policy. New category differs from Nature and has at least two invented titles/minimum ages; highest eligible policy stated and code puts specific threshold before broad fallback. Test original categories, new category below/at threshold, accepted case form and unknown, predictions/actual or Pending and correction/retest. Full table/source/records, comparisons complete and Boolean grouping correct. No invented real classifications, real learner age data or execution evidence. No numerical marks. Grown-up review; personal evidence is required.

Worksheet 14

  1. Question 25: Create your own table of at least two invented songs, styles and positive whole-minute durations. Include at least two different durations. State how to choose when several songs fit. Write a program that reads style and maximum whole minutes, outputs a suitable song, distinguishes a known style with no fitting song from an unknown style, and follows your agreed case policy. Test an exact duration, a shorter allowance, a longer allowance, a case variant and an unknown style. Record predicted and actual results or Pending and any correction/retest. Cite complete code, table and tests. At least two invented song records and distinct positive integer durations, explicit recognised styles and selection/tie policy, maximum valid nonnegative integer. Selected duration <= maximum and correct style; ordered choices follow stated policy. Known-but-too-short and unknown-style outputs distinguished; documented case policy implemented. Test exact duration, shorter/longer max, agreed case variant and unknown. Full table and source, comparisons/Boolean logic correct, predictions versus actual/Pending honest, correction/retest if needed. Accept equivalent consistent policy such as longest fitting or explicit priority. No real-world song metadata assumed, no invented learner GUI work or numeric marks. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Design and test recommendations 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.