GRADE 8 · COMPUTING · UNIT 1 · LESSON 1.33
Computational thinking and programming
Supply parameters and reuse library code
Read a little. Try the workbook. Check your answers. Choose one section below to get started.
LET’S TRACE, REASON AND TEST
Supply parameters and reuse library code
Parameters let a routine accept different input values while reusing its instructions. Match arguments to parameters and use the documented return value. Reusing a routine does not remove the need to understand its contract.
- Relate a supplied value to a parameter and explain the purpose of libraries.
- Explain my method and support it with a labelled trace, example or test record.

Work through an example
A rectangle_area(width, height) routine returning width × height gives 15 for arguments 3 and 5. It can be called again with 4 and 6 without rewriting the multiplication.
Try before your workbook
What result should rectangle_area(2, 9) return, and which parameter receives 9?
Explore the clues
Tap one card to find out more.
Understand the idea
Parameters let a routine accept different input values while reusing its instructions. Match arguments to parameters and use the documented return value. Reusing a routine does not remove the need to understand its contract.
Concept to practise: Supply parameters and reuse library code.
Work through an example
A rectangle_area(width, height) routine returning width × height gives 15 for arguments 3 and 5. It can be called again with 4 and 6 without rewriting the multiplication.
Try before your workbook
What result should rectangle_area(2, 9) return, and which parameter receives 9?
Check my readiness thinking
It should return 18. With that stated positional order, height receives 9; changing argument order can matter for other routines.
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.
Supply an argument to a named parameter
The function can use that value to calculate a result and return it to the caller. Reusing the same definition with different arguments avoids rewriting the calculation for every input.
Read a complete function with one parameter
Original Paxa square-area function
def square_area(side):
return side * side
area = square_area(4)
print("Area:", area)Trace the supplied value and returned result

Read this model’s labels and values
Reuse one definition with several arguments
| Function call | Local side | Returned area |
|---|---|---|
| square_area(2) | {'clue': 'Value', 'prompt': 'Parameter for call 2', 'answers': ['2']} | {'clue': 'Value', 'prompt': 'Returned area for call 2', 'answers': ['4']} |
| square_area(4) | {'clue': 'Value', 'prompt': 'Parameter for call 4', 'answers': ['4']} | {'clue': 'Value', 'prompt': 'Returned area for call 4', 'answers': ['16']} |
| square_area(7) | {'clue': 'Value', 'prompt': 'Parameter for call 7', 'answers': ['7']} | {'clue': 'Value', 'prompt': 'Returned area for call 7', 'answers': ['49']} |
| square_area(10) | {'clue': 'Value', 'prompt': 'Parameter for call 10', 'answers': ['10']} | {'clue': 'Value', 'prompt': 'Returned area for call 10', 'answers': ['100']} |
Supply a value stored in a different caller variable
Original Paxa variable-argument version
def square_area(side):
return side * side
length = int(input())
area = square_area(length)
print("Area:", area)Recognise a function with two parameters
Original Paxa two-parameter example
def rectangle_area(length, width):
return length * width
area = rectangle_area(6, 2)
print("Area:", area)Explain why programmers reuse libraries
Still check the feature’s purpose, arguments, return value and behaviour in your program. Reuse does not guarantee that the whole program is correct. Follow classroom rules and acknowledge external code and documentation.
Distinguish a library function from a constant
Original Paxa documented library example
import math
rounded = math.ceil(4.2)
print("Rounded up:", rounded)
print("Pi approximation:", math.pi)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.5 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: In def square_area(side):, which name is the parameter? side
- Question 2: In square_area(4), what is supplied as the argument? the value 4
Worksheet 2
- Question 3: What value is received by side in the shown call? 4
- Question 4: What value is returned to the caller? 16
- Question 5: Which caller variable stores the return value? area
Worksheet 3
- Question 6: Must the caller’s variable name match the parameter name? no, the supplied value is received by the parameter
Worksheet 4
- Question 7: Parameter for call 2 2
- Question 8: Returned area for call 2 4
- Question 9: Parameter for call 4 4
- Question 10: Returned area for call 4 16
- Question 11: Parameter for call 7 7
- Question 12: Returned area for call 7 49
- Question 13: Parameter for call 10 10
- Question 14: Returned area for call 10 100
Worksheet 5
- Question 15: Which caller variable supplies the side-length value? length
- Question 16: For input 6, what value does the local side receive? 6
- Question 17: What is the full printed line for input 6? Area: 36
Worksheet 6
- Question 18: How many parameters are in the definition? 2
- Question 19: Which parameter receives the second argument 2? width
- Question 20: What value is returned by the shown call? 12
- Question 21: What separates the two arguments in this call? a comma
Worksheet 7
- Question 22: Which is a sound reason to use a suitable library? reuse established work rather than reimplement every common task
- Question 23: What must the programmer still check? the feature’s purpose, arguments, result and program behaviour
- Question 24: What is honest evidence of reuse in school work? identify the library and explain your own code and contribution
Worksheet 8
- Question 25: What is the first full printed line? Rounded up: 5
- Question 26: Which expression reads the pi constant correctly? math.pi
- Question 27: What kind of item is math.ceil? a function that can be called
Worksheet 9
- Question 28: Use the complete square_area definition on page 2. Trace and test calls with arguments 2, 4, 7 and 10, showing the parameter value, returned area and caller variable. Then use the page 5 variable-argument version with input 6 and explain how length supplies a value to side without requiring the names to match. Keep full source, predictions and actual output or Pending, with corrections and retests. State the input assumptions and area units. As an extension trace the complete two-parameter rectangle example and explain which value each parameter receives. Square arguments2/4/7/10 produce local side2/4/7/10 and returns4/16/49/100. Caller can store result in area; print happens in caller, return sends calculated value. Input version length6 supplies side6 -> Area: 36. Parameter is local name in definition, argument is supplied value; names need not match. Positive whole-number side lengths and square units. Rectangle length6,width2 ->12; two parameters receive arguments positionally. Full correct definitions/calls/source, predictions/actual or Pending, correction/retest evidence; no GUI or partner execution invented. Grown-up review; personal evidence is required.
Worksheet 10
- Question 29: Use the complete page 8 library example and its linked documentation. Record which line imports the module, which expression calls a function and which reads a constant. Predict math.ceil for 4.2, 4.0 and -1.2; run the supplied three-case example if available or mark actual execution Pending. Explain each result using the stated smallest-integer rule and identify its type. Explain why math.pi is not called with parentheses and why a library can save time while your program still needs testing. Cite the documentation and keep your code, evidence and one next step. import math makes module available; math.ceil(4.2) is a function call, math.pi reads a floating-point approximation constant. Ceil4.2 ->5,4.0 ->4,-1.2 ->-1, all int for these ordinary float inputs; -1 is the smallest integer >=-1.2. pi is a value rather than a callable function, no math.area standard feature. Library reuse reduces repeated work but correct feature/arguments/result use and program tests still needed. Documentation title/URL, actual/Pending, full code and correction/retest/next step evidence; no external package installation required or claimed. Grown-up review; personal evidence is required.
Curriculum & workbook reference
- Cambridge Lower Secondary Computing Learner’s Book 8 — pages 132–135
- PaxaKids Grade 8 Computing Lesson 1.33: Supply parameters and reuse library code — pages 1–10
Computing for your homeschool day
Explore Supply parameters and reuse library code 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.
