Students & Study

Verified against ChatGPT · 2026-08-08

Debug your own broken code with a tutor that makes you find the bug instead of just fixing it for you

Guides you to locate and understand a bug in your own code through targeted questions about what you expected versus what happened, only showing the actual fix after you've identified the cause yourself.

ChatGPT (GPT-5.1)4 fillable variables

The prompt

Ready to copy — highlighted parts are example details you can swap.

I have a bug in my code and I want to actually learn to debug, not just get the fix. Act as a coding tutor who helps me find the bug myself rather than fixing it for me.

MY CODE
def find_max(numbers):\n    max_val = 0\n    for n in numbers:\n        if n > max_val:\n            max_val = n\n    return max_val

WHAT I EXPECTED TO HAPPEN
Return the largest number in the list, including when all numbers are negative

WHAT ACTUALLY HAPPENS
find_max([-5, -2, -8]) returns 0 instead of -2

LANGUAGE/CONTEXT
Python, intro CS course, second week covering functions and loops

Do not point out the bug directly or rewrite the code, even if I ask you to just fix it — if I ask for the fix outright, briefly say why finding it yourself will help more, then continue with the next question instead. Start by asking me to trace through my own code step by step for the specific input where find_max([-5, -2, -8]) returns 0 instead of -2 occurs, predicting out loud what each line does — this surfaces the gap between what I think the code does and what it actually does. Based on Return the largest number in the list, including when all numbers are negative versus find_max([-5, -2, -8]) returns 0 instead of -2, narrow toward the likely region of the bug (e.g., "before we go further, what does this specific variable look like right after this specific line runs — is that what you'd expect?") but phrase it as a question I answer, not a statement you make. If I trace through and correctly identify the actual bug myself, confirm it and then ask me what the fix should be, rather than immediately telling me. If after two rounds of guided questions I'm still genuinely stuck, narrow the region further with a more specific question, but do not name the exact bug or line until I've had a real chance to find it through the narrowed question.

WHAT NOT TO DO
Do not run or execute the code and just report the output — the point is for me to build a mental model of execution, not receive one. Do not ask more than one question per response; layering multiple questions makes it unclear what to actually respond to.

OUTPUT FORMAT
One guiding question at a time, narrowing progressively. No code fixes until I've identified the cause.

Customize

Optional — swap in your own details for the highlighted parts above.

Why this works

GPT-5.1's default response to a bug report with code attached is to identify the bug and produce a corrected version immediately, since that's the most directly useful-looking output and matches the model's general helpfulness bias — but a student who receives a fixed version of their own code without doing the diagnostic work themselves doesn't build the debugging skill that will actually matter on the next bug, which won't come with a tutor attached. Forcing a step-by-step trace of the student's own code against the specific failing input, before any hint about where the bug lives, mirrors the actual skill professional developers use (mentally or literally stepping through execution) and surfaces the gap between the student's assumed behavior and actual behavior directly through their own reasoning rather than through being told — in the example, a student tracing max_val = 0 against an all-negative input list will themselves notice that 0 is larger than every number in the list, which is a far stickier realization than being told "you initialized max_val wrong." The rule against naming the bug even under direct pressure to just fix it is necessary because students under time pressure predictably ask for the answer, and without an explicit instruction to resist that ask while still being brief about why, the interaction collapses into a debugging service on the first frustrated request. Narrowing progressively through questions rather than one broad question addresses the reality that a totally open-ended "what do you think is wrong?" is often too unconstrained for a genuinely stuck beginner — each question needs to shrink the search space based on the previous answer, the same way a human tutor would follow up on what the student just said rather than repeating the same broad prompt. Limiting to one question per turn prevents the common failure where a multi-part question lets a student answer the easy part and skip the part that would have actually revealed the bug.

What you get back

Let's trace find_max([-5, -2, -8]) line by line. Before the loop starts, what value does max_val hold? Now, on the very first iteration, n is -5 — based on the code's condition (if n > max_val), does -5 > max_val evaluate to True or False given what max_val currently is?

Verified against

ChatGPT GPT-5.1 · 2026-08-08

Changelog

  • 2026-08-08 Initial publish, verified against ChatGPT GPT-5.1.

Need this built into your business?

If a prompt isn't enough — what Scult builds, built and maintained for you — that's Scult's day job.

EXPLORE WHAT SCULT BUILDS
All Students & Study prompts

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY