A PG3 student can type or copy a Python program that appears correct but still struggle to explain why it produces the wrong result. Debugging is not just fixing typing mistakes: it involves understanding the intended output, tracing what the program actually does, locating the first incorrect step and testing a reasoned correction. This is a foundational Computing habit, not evidence that the child lacks talent for the subject.
Parents do not need to be programmers to help. Ask the child to explain the input, intended output, values held by variables and sequence of instructions. Use a small trace table, change one thing at a time and check several test cases. Confirm the school’s permitted software and academic-integrity rules before using outside coding platforms or AI tools.
- Start by stating what the program is supposed to do and what it actually does.
- Distinguish syntax errors, execution errors and logical errors.
- Trace variables and conditions line by line, including loop iterations.
- Test simple, boundary and unexpected inputs where appropriate.
- Fix one cause at a time and rerun the original failing test.
- Do not submit copied or AI-generated code as the child’s own work contrary to school rules.
Why copying correct-looking code is not the same as understanding
A code example may work for one input while failing for another. It may also contain a hard-coded value, a condition that covers the wrong cases or a loop that repeats too many times. Copying a working example without being able to explain its logic can conceal these gaps until the next assignment.
Ask your child what problem the program is solving, what each variable represents and how they know the output is correct. If they cannot answer, begin with a smaller example instead of searching for a longer solution. The learning objective is control over the reasoning behind the code.
Three different kinds of bugs
A syntax error occurs when code does not follow the language’s grammar, such as a missing colon or invalid indentation in a Python control structure. A runtime error arises during execution, such as trying to divide by zero. A logical error can produce a result but not the one intended, such as counting only four items when five were required.
Students should describe which type of problem is present rather than treating every failure as a spelling mistake. Error messages can help locate a problem, but they should be read in the context of the program. The reported line may be where the problem becomes visible, not necessarily where the original reasoning went wrong.
What is a trace table?
A trace table records how variables change as instructions execute. Suppose the program begins with total = 0, then adds 2, 4 and 6 in sequence. A trace table might show total as 0, then 2, then 6, then 12. The final value is 12 because each step adds to the previous value.
Ask the student to write the state after each meaningful instruction. They should be able to predict the result without running the code. This practice makes invisible program state visible and helps identify where a value first differs from the expected one.
The problem of missing initialisation
A common beginner error is using an accumulator before it has been assigned an appropriate starting value. In a sum calculation, total = 0 is a natural initial value. In a product calculation, starting at zero would make all subsequent multiplied results zero, so a different initial value may be needed.
Do not teach that every variable should always start at zero. Ask what the variable is meant to represent and which initial value makes sense for the operation. The same reasoning applies to counters, flags and collections.
Conditions can be individually correct but collectively wrong
A program might check whether a test score is at least 50 and then separately check whether it is at least 80. Both conditions are true for a score of 90. If the intention was to assign only one grade category, the student’s conditional structure must handle overlapping conditions correctly.
Ask the child to use specific test cases such as 49, 50, 79 and 80. Write the expected output first, then trace the branches. Boundary values often reveal mistakes that an ordinary mid-range example does not.
Why loops cause confusing results
A loop repeats a section of code according to a rule. Common mistakes include starting a counter at the wrong value, stopping one iteration too soon, failing to update the loop condition or placing a statement at the wrong indentation level. In Python, indentation has meaning and affects the program’s structure.
Use a small sequence with only three or four iterations. Let the child list what happens in each iteration and compare it with the intended number of repetitions. Once the small example is understood, they can try a larger case. This is safer than changing loop limits at random until the output happens to match.
Read inputs, outputs and data types carefully
Python distinguishes numbers and strings. The character sequence "3" is text, whereas 3 is a numeric value. Operations involving these types may behave differently or raise an error. Some bugs arise because a user input has been treated as one type when the calculation requires another.
Parents can ask the child to state what type of data each variable contains at a particular step. The goal is not to memorise every Python built-in operation but to reason carefully about what the program has been given and what the next instruction expects.
Test cases must be chosen for a reason
A student may test only the first example provided in the worksheet. That is not enough to establish that a program works generally. When appropriate, tests should include a normal case, a small case, a large case and a boundary case. The exact selection depends on the input rules and the task.
Ask the child to predict each output before running the program. If the output differs, locate the first step where the trace goes wrong. Record that case so it can be rerun after the correction. A successful fix should preserve correct behaviour for previous valid test cases as well as repair the failing one.
Why changing one thing at a time helps
When several lines are edited simultaneously, a changed output does not reveal which edit fixed or broke the program. A clearer process is to form one hypothesis, change one relevant part, rerun the test and record the result. If the hypothesis was wrong, revise it.
This approach teaches a general problem-solving habit: use evidence to isolate a cause. It also reduces the frustration of repeatedly guessing. Students should be able to explain why the change should work before pressing Run.
How AI can help and how it can undermine the lesson
An AI assistant can produce code quickly, but it may also invent requirements, misunderstand a school task or provide a solution the student cannot explain. Submitting generated code as original work when school instructions prohibit it undermines learning and may violate academic-integrity rules.
Follow the school’s acceptable-use and AI instructions. When AI support is permitted, a safer approach is to ask for a conceptual explanation or a hint and then require the child to write, trace and test their own solution. The student should be able to discuss the result without depending on the AI output.
Computing is broader than writing Python
Computational thinking involves breaking down a problem, designing an algorithm, organising information, checking a solution and evaluating whether it works. Spreadsheets and other tools can support related skills. A student with little previous coding experience may still develop strong Computing habits through clear reasoning and consistent practice.
Parents should ask what the school actually teaches, what devices and software are provided, and how practical work is assessed. Not every secondary school offers G3 Computing as an upper-secondary examination subject. The national syllabus register does not establish availability at an individual school.
A parent-friendly fifteen-minute debugging routine
Take one short school-approved program with a known bug. Spend three minutes stating the expected output, five minutes tracing variables and branches, four minutes explaining and making one correction, and three minutes testing the corrected version against two inputs. The child should write the explanation in ordinary language.
If your child repeatedly needs someone else to find the bug, reduce the example to a few lines. Ask the Computing teacher whether the missing skill is indentation, tracing, condition logic, loops, data types or test design. A precise gap is easier to improve than the broad judgement that the child ‘cannot code’.
Official syllabus and cohort guidance
SEAB lists Computing K349 in its 2027 G3 school-candidate syllabus register. That register is for students sitting SEC in 2027, not the Secondary 1 cohort entering in 2027. Subject availability, selection criteria, devices and lessons depend on the school.
Read MOE’s Full SBB information alongside eduKateSG’s G3 Computing parent introduction. Ask the receiving school what level of prior experience is expected and which debugging skills the student should demonstrate now.
What success should look like
A child does not need to write a perfect program on the first attempt. Progress is visible when they can predict behaviour, identify an incorrect step, explain a correction and test it independently. That is a better foundation than a long collection of copied examples that cannot be modified.
Keep coding time balanced with other G3 subjects, CCA and rest. If the child enjoys investigating mistakes and improving a solution, encourage that curiosity. The aim is to create a confident, thoughtful learner who can reason about technology, not simply produce answers quickly.