When code fails, it is tempting to hand over the entire project and ask someone to fix it. You usually learn more by narrowing the failure until you can describe the gap between what you expected and what actually happened.
Make the problem small enough to see
Write down the expected output, the actual output, and the input that triggers the problem. If there is an error message, keep its exact wording. Then reduce the code to the smallest example that still reproduces the issue, without removing the behaviour you are trying to understand.
A short example lets a tutor focus on the concept: a loop boundary, an unexpected type, a variable’s scope, or an assumption about the data. It also helps you distinguish a language issue from a problem elsewhere in a large project.
Read the code as a sequence of changes
Choose one input and trace what happens to each important value. For a loop, note the initial state, the condition, the update, and the state after an iteration. For a function, identify its inputs, return value, and any side effects.
Explain this trace aloud in the session. If you predict one value and observe another, pause there. The mismatch is often more informative than the final error. Ask the tutor to question your assumptions rather than immediately rewrite the whole function.
Test the edges
Once a normal example works, try an empty input, a one-item input, a repeated value, or a boundary value that matters to the task. Decide what the program should do in each case before running it. A test is useful only when the expected behaviour is clear.
For course exercises, follow the specifications and the rules on external help. Tutors can explain debugging, algorithms, data structures, and language concepts using permitted or analogous examples. They should not complete a graded project for you or log in to submit it.
Keep the explanation after the fix
Record the faulty assumption and the change that corrected it. ‘Changed line 14’ is less useful than ‘the final index was excluded because the loop condition used a strict comparison.’ That explanation gives you something to recognise next time.
For a live programming session, share code with secrets removed. Never include API keys, passwords, private repositories you are not allowed to share, or personal records. Whether you are learning Python, Java, JavaScript, or SQL, the best outcome is being able to reason about the next problem with less help.
Keep reading
How to compare psychology theories without just listing them · How to plan tutoring around an online college course