GRADE 7 · COMPUTING · UNIT 1 · LESSON 1.10

Block it out: Moving from blocks to text

Error detection and correction

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

8 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Error detection and correction

Debugging means finding and correcting faults. Some faults prevent code from running, such as unpaired quotes or brackets. Others allow it to run but produce the wrong result. A test plan separates the expected result from the actual result so a repair can be checked.

Today’s two goals
  • Construct or apply a test plan recording inputs, expected results, actual results and pass/fail.
  • Distinguish syntax problems from valid code that produces an incorrect calculation.
Original PaxaKids illustration for Error detection and correction. Precise program text and data are supplied in the workbook models.
An original PaxaKids workbook scene. Use the supplied programs and data for precise workbook facts.

Explore the clues

Tap one card to find out more.

Understand the idea

Debugging means finding and correcting faults. Some faults prevent code from running, such as unpaired quotes or brackets. Others allow it to run but produce the wrong result. A test plan separates the expected result from the actual result so a repair can be checked.

Concept to practise: Error detection and correction.

Work through an example

A program meant to add 4 and 7 prints 28. The syntax may be valid, but using multiplication instead of addition causes a logic error. The expected result is 11. Change the operator, then rerun the same test and additional cases.

Try before your workbook

A calculator prints 56 after the strings "5" and "6" are added. What went wrong, and what expected result should a numeric addition test use?

Check my readiness thinking

The values stayed as strings, so + joined them. Convert suitable numeric input before adding; the expected numeric result is 11. Record the actual result only after running or tracing the repaired program.

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.

Find the cause, prove the repair

Our goal: apply a test plan, distinguish error types and explain repairs using fresh test evidence.

A test plan records inputs, the expected result, the actual result and pass or fail. Predict from the requirement before running the program. A program that finishes can still calculate the wrong answer.

Three kinds of fault

A: SYNTAX
print("Ready"
B: RUNTIME
member = "Maya"
print(members)
C: LOGIC
price = 4
count = 3
cost = price + count
print(cost)

Inspect an original shop program

PRODUCTCOST_PAXAFAULTY.PY
unit_price = input("Price per item: ")
units = int(input("Item count: "))
amount = unit_price + units
print("Amount:", "amount")

Build a useful product test plan

Build a useful product test plan — original model
TestPrice per itemItem count
P14.53
P22.254
P380

Two programs for a paired repair

NUMBERTRICK_PAXA.PY
chosen = float(input("Starting number: "))
doubled = chosen * 2
raised = doubled + 6
halved = raised / 2
answer = halved - chosen
print("Trick result:", answer)
RESTAURANTBILL_PAXA.PY
bill = float(input("Bill amount: "))
people = int(input("People sharing: "))
tip = bill * 0.15
with_tip = bill + tip
share = with_tip / people
print("Each person:", share)

Exchange, repair and retest

Each partner introduces five separate faults into their exercise copy and privately logs the original and changed code. Examples include changing an operator, removing a parenthesis, changing one variable name, removing a conversion or quoting a variable in output.

Exchange the faulty copies. Repair the other program using its requirement and these tests. Keep an error log: fault, effect, repair and retest. Compare with the hidden fault list only after your attempt. A teacher can act as the partner when needed.
Exchange, repair and retest — original model
ProgramInput caseExpected result
Number trick5; then 0; then -43.0 in each separate run
Bill sharing100 and 4 people28.75 each
Bill sharing80 and 2 people46.0 each
Paxa the Fox

Try one step with Paxa!

Trace code carefully and preserve exact spelling, case and order. Use invented practice data. Save personal responses before leaving.

Our Unit 1 learning path
  1. Lesson 1.1: Comparing Scratch and Python
  2. Lesson 1.2: Using Python
  3. Lesson 1.3: Using Python IDLE in Script mode
  4. Lesson 1.4: Variables
  5. Lesson 1.5: Adding more information to a program
  6. Lesson 1.6: Data types – string, integer and real
  7. Lesson 1.7: Casting
  8. Lesson 1.8: Flowcharts and algorithms
  9. Lesson 1.9: BIDMAS in Python
  10. Lesson 1.10: Error detection and correction
  11. Lesson 1.11: Making choices IF THEN ELSE in flowcharts
  12. Lesson 1.12: Sub-routines
  13. Lesson 1.13: Random questions and a star number
  14. Lesson 1.14: Final project
  15. Lesson 1.15: Evaluation
  16. Lesson 1.16: What can you do?
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 the 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.

Error detection and correction8 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.0 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 should you write before running a test? the expected result
  2. Question 2: A program runs but adds when it should multiply. What is the problem? a logic error
  3. Question 3: What provides evidence after changing faulty code? retest and compare with the expected result

Worksheet 2

  1. Question 4: Which example has a missing closing parenthesis? A
  2. Question 5: Which example refers to a variable that was not defined? B
  3. Question 6: Example C should find the cost of three items at 4 each. Which repair matches this requirement? cost = price * count

Worksheet 3

  1. Question 7: Which conversion allows a decimal unit price? float(input("Price per item: "))
  2. Question 8: Which type suits a count of whole items? int
  3. Question 9: Which operator should calculate this amount? *
  4. Question 10: Which line displays the stored amount? print("Amount:", amount)

Worksheet 4

  1. Question 11: What amount should P1 produce? 13.5 / 13.50
  2. Question 12: What amount should P2 produce? 9 / 9.0 / 9.00
  3. Question 13: What amount should P3 produce? 0 / 0.0 / 0.00

Worksheet 5

  1. Question 14: What is the intended number-trick result for any ordinary valid test number? 3
  2. Question 15: Which expression includes the tip before dividing among people? (bill + bill * 0.15) / people

Worksheet 6

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

Worksheet 7

  1. Question 16: Show your repaired four-line program and explain all three repairs. Record P1–P3 with input, expected result, actual result and pass/fail. Include a failed run or error if you observed one, then show the retest. Clearly label paper-only traces. Repair unit_price with float(input(...)); keep units as int(input(...)); amount = unit_price * units; print("Amount:", amount). Expected P1 13.5, P2 9.0, P3 0.0. Original program raises TypeError at amount = unit_price + units for valid inputs because str plus int is invalid. After fixing only conversion, + still gives wrong logic; after fixing calculation the quoted "amount" still prints literal text. Require repair explanations tied to those behaviours and honest actual/paper labels. Numeric-equivalent formatting accepted; Python float accuracy limitations outside introductory exercise scope. Grown-up review; personal evidence is required.

Worksheet 8

  1. Question 17: Identify the received program and five separate faults. Explain each effect and repair, then give retest evidence for every listed case. Summarise what the other partner repaired so the record covers both programs. Explain why one repair could reveal another fault. Teacher checks exactly five distinct introduced changes in each exercise copy against the creator’s private log. Receiver repairs the other program; pair evidence covers number trick and bill sharing. Number trick computes ((chosen*2+6)/2)-chosen and produces 3.0 for 5, 0 and -4; bill share = (bill + 0.15*bill)/people, producing 28.75 for 100/4 and 46.0 for 80/2. Accept equivalent code and positive-people validation as an extension. No invented actual runs; paper traces labelled. Require effect/repair/retest for each fault and explanation that earlier syntax or runtime errors can stop later faulty lines from executing. Original CSV template has blank actual/pass fields, not fabricated evidence. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Error detection and correction with this free Grade 7 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

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.

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.

The book pages identify the related teaching topic. 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.