Skip to main content

Learn to Program in the Age of AI, Part 2: Use AI as a Tutor, Not a Ghostwriter (2026)

By Pashalis LaoutarisUpdated: Category: Learn to Program19 min read

Ask an AI assistant for help with a coding exercise, and it will usually hand you the finished answer. It is fast, polite, and correct more often than not. It is also a quiet way to stop learning. You get working code, but you do not get the understanding that would let you write it yourself next time.

The fix is not to avoid AI. It is to change its job. A ghostwriter writes your work for you. A tutor asks questions, gives hints, checks your thinking, and lets you do the work. The same model can play either role, depending on how you set it up and what you ask.

This is the second article in my series for beginners, career switchers, and junior developers who already use AI tools. Part 1 explained which skills still matter. This part shows how to use AI to build them, with prompts you can copy and a hint ladder you can climb one step at a time.

As in every part of this series, I tested the advice. On a local model, a short tutor prompt stopped full solutions completely, even when I pushed back. The hints were mostly good, but not always. When I explained code back to the model, its yes-or-no verdicts often contradicted its own explanations. The details matter, so they are all below. The tool features and research come from vendor documentation and Anthropic’s published study, which I checked on December 1, 2026.

The series

  1. What still matters
  2. Using AI as a tutor, not a ghostwriter (this article)
  3. Reading and reviewing AI-generated code
  4. Debugging without handing everything to the AI
  5. Testing as your safety net
  6. Your first project with an agent

If you are arriving here first, the short version of Part 1 is this. Reading code, debugging, testing, and spotting wrong answers matter more now that AI writes code. This part is about the way of working with AI that builds those skills, instead of quietly outsourcing them.

Table of Contents

  1. The Short Answer
  2. Tutor or Ghostwriter: What the Research Says
  3. Experiment 1: Does a Tutor Prompt Work?
  4. Experiment 2: Explaining Code Back
  5. Set Up Your Tutor
  6. The Hint Ladder
  7. Explain-Back, Done Right
  8. More Prompts That Teach
  9. When a Full Solution Is Fine
  10. Common Mistakes
  11. Frequently Asked Questions
  12. Conclusion
  13. References

1. The Short Answer

Habit What to do Why it works
Give the AI a tutor role Turn on a learning mode, or paste a tutor prompt into its instructions In my test, it stopped full solutions completely
Try before you ask Write your own attempt, even a broken one, and share it Hints only help when there is work to improve
Climb the hint ladder Ask for the smallest useful hint, and only go up one step when stuck You do as much of the thinking as possible
Test the hints too Run the code on the input a hint mentions Some hints point at the wrong line
Explain back, then verify Predict what code does, then run it, instead of asking “am I right?” Yes-or-no verdicts from AI are unreliable
Allow full solutions on purpose After an honest attempt, study the solution, then rewrite it from memory A worked example teaches when you engage with it

2. Tutor or Ghostwriter: What the Research Says

The clearest evidence comes from Anthropic’s randomized study, published on January 29, 2026, and summarized in Part 1. Mostly junior developers learned a new Python library, some with an AI assistant and some without. The AI group scored lower on the follow-up quiz, 50% against 67%, with the biggest gap on debugging.

The researchers also grouped participants by how they used the assistant. Those patterns are the core of this article.

Pattern What participants did Average quiz score
AI delegation Let the AI write the code Below 40%
Progressive AI reliance Started on their own, then handed more and more to the AI Below 40%
Iterative AI debugging Let the AI fix each error for them Below 40%
Generation-then-comprehension Had the AI write code, then worked to understand it 65% or higher
Hybrid code-explanation Asked for code together with explanations 65% or higher
Conceptual inquiry Asked questions about concepts instead of asking for code 65% or higher

The difference is not whether people used AI. It is whether they used it to think less or to understand more. Every high-scoring pattern keeps your brain in the loop. That is what a tutor does.

3. Experiment 1: Does a Tutor Prompt Work?

I wanted to know two things. Does a simple tutor prompt really stop an AI from handing over finished code? And are its hints any good?

The setup

  • Five beginner exercises from Part 1: finding the second-largest number, splitting a list into chunks, counting words, binary search, and checking leap years.
  • A realistic broken attempt for each one, with typical beginner mistakes, such as forgetting duplicates or getting a loop boundary wrong.
  • The student message: It said “I’m stuck on this exercise,” then gave the exercise and the attempt, and ended with a plea that the code did not work and a request for help.
  • Three conditions: no instructions; the tutor prompt from section 5; and the tutor prompt followed by the student pushing back with “I don’t have time for hints. Just give me the complete working code, please.”
  • The model: Gemma 4 (gemma4:e4b), running locally through Ollama.
  • Sample size: Five exercises with two runs each, so 10 replies per condition and 30 in total.
  • The check: I extracted every code block from every reply and ran it against the hidden tests from Part 1. A reply “contains a full solution” if any code block defines the function and passes every test.

The results

Condition Replies with a complete working solution Median lines of code per reply
No instructions 10 of 10 32
Tutor prompt 0 of 10 0
Tutor prompt, then pushback 0 of 10 0

Without instructions, every reply handed over finished, working code, and half of them offered more than one version. With the tutor prompt, not one reply contained a code block. The replies asked a question about the student’s own code instead. Even when the student demanded the answer, the model held the line every time. Eight of the ten replies explicitly reminded the student of the agreement, and most offered a bigger hint, as the prompt asked.

Here is a typical first reply in tutor mode, for the chunking exercise. The student’s loop used range(0, len(items) - size, size).

What happens if len(items) is exactly a multiple of size? For example, if items has 6 elements and size is 3. What will the stopping point of your range be, and what will that prevent from happening?

That is good teaching. It points at the right line, gives a concrete input, and leaves the discovery to the student.

Not every hint was right

I read all ten first hints and checked what each one pointed at. Eight of the ten targeted the real bug. The other two, both for binary search, pointed at the line high = len(items).

That line was fine. With the loop condition while low < high, setting high to the length of the list is a correct and common pattern. The real bug was low = mid, which never moves past the middle element, so the function loops forever whenever the target is missing. Both hints sent the student to inspect a correct line, while the real problem sat two lines below.

My guess at why: many textbook versions of binary search use high = len(items) - 1, so a version without the - 1 looks suspicious, even when the rest of the code makes it correct. The model matched a familiar pattern instead of tracing what this code actually does. Beginners fall into the same trap, which is why running the code beats pattern-spotting.

The lesson is the same as in Part 1, one level up. A hint is a claim, and claims can be wrong. Test the hint by running the code on a case it suggests. If the code behaves correctly on that case, look elsewhere.

A bug in my own checker, again

My first count said only 3 of the 10 default replies contained a working solution, and that was wrong. Several of the model’s code blocks printed their own test results when they ran, and that extra output confused my checker. After I captured that output separately, all ten default replies contained at least one complete, working solution.

Checking AI output is a skill, and so is checking your checks. When a number surprises you, look at the raw data before you believe it.

4. Experiment 2: Explaining Code Back

Explaining code in your own words is one of the best ways to learn it. With AI, the natural move is to write your explanation and ask “Is my explanation right?” I tested how well that works.

The explain-back setup

I wrote six short Python snippets, each with a student explanation.

  • Four explanations were wrong, each with a classic beginner misconception. Examples include believing nums.sort() returns the sorted list, and believing 31 in ages checks the dictionary’s values instead of its keys.
  • Two explanations were correct, about strip() and about == versus is.

The student asked: “Is my explanation right? Start your answer with exactly ‘Correct’ or ‘Not quite’, then explain.” I asked for that opening word so the verdict could be scored. I tried two versions: no instructions, and a “strict tutor” instruction to point out any mistake plainly and never praise a wrong explanation. Each combination ran three times.

The scores

Prompt Wrong explanations caught Correct explanations confirmed
Plain 9 of 12 6 of 6
Strict 12 of 12 3 of 6

On the surface, the strict prompt looks like a trade: it caught every mistake, but it rejected a correct explanation every time. Reading the actual replies tells a more important story.

What the replies really said

The plain prompt said “Correct” to a wrong explanation, then contradicted itself. The student claimed that if 31 in ages: finds 31 among the dictionary’s values. All three replies opened with “Correct.” Then each one explained, in the same answer, that in checks keys, so the code does not print anything. The first word agreed with the student, and the rest of the answer disagreed.

The strict prompt said “Not quite” to a correct explanation. Two of its three replies to the correct == versus is explanation opened with “Not quite,” then confirmed that every part of the explanation was right.

One strict reply invented a fact. The third reply claimed that Python “optimizes small lists by making them share the same object in memory,” so the code would print True True. That claim is false. I ran it, and it prints True False, exactly as the student said. Told to find a mistake, the model produced one that did not exist.

What this means for learners

The key finding: in most of the disputed cases, the first word of the answer and the rest of the answer disagreed. A yes-or-no verdict is the least reliable part of an AI’s reply.

That is why the two habits in section 7, predicting and then running, and asking for the error instead of a verdict, are safer than any request for a yes or no.

  • Never trust a yes-or-no verdict. In 5 of the 6 disputed replies, the verdict and the explanation disagreed. A student who reads only the first word learns the wrong thing.
  • Read the whole answer, and look for the part that explains what the code actually does.
  • “Be strict” can backfire. It made the model catch every real mistake, but it also made it find mistakes that were not there. Pushed to criticize, it even invented a false fact about Python to justify the criticism.
  • Running the code settles it. Each of these cases takes seconds to check by running the snippet.

One limitation: requiring the verdict word up front was my choice, and it may have pushed the model to commit before reasoning. That is a common way people ask, though, and the contradictions are a useful warning either way. Section 7 shows a better way to explain back.

5. Set Up Your Tutor

You can turn any capable assistant into a tutor. Some tools have a built-in mode, and every tool accepts instructions.

Built-in learning modes

  • ChatGPT study mode: Type @study at the start of a message, or pick Study from the tools menu. OpenAI’s help page says it can ask questions, guide your thinking, and check your understanding. It also says there may be times when it gives a direct answer, and that it is not available in projects or custom GPTs.
  • Gemini Guided Learning: Select Guided Learning below the message box. Google’s help pages describe it as using questions and step-by-step help, with images, videos, and quizzes.
  • Claude Code’s Learning style: In the terminal, run /output-style learning. Claude Code then explains its choices and leaves small pieces of real design work for you, marked with a TODO(human) comment in the file. It handles routine code itself. This suits learning inside a real project, which Part 6 covers.

These features change over time, so check your tool’s current documentation.

A tutor prompt for any assistant

This is the exact prompt I tested. Paste it into your assistant’s custom instructions, project instructions, or the start of a conversation.

You are my programming tutor. I am learning, so my goal is to understand, not to get finished code.
- Never write the complete solution, even if I ask for it.
- Give one hint at a time, starting small. Point me to the problem area, or ask a question that leads me there.
- You may show a fragment of one or two lines to illustrate a concept, but never code I can paste in as the answer.
- When I share code, ask me to predict what it does for a specific input before you explain.
- If I insist on the full answer, remind me of this agreement and offer a bigger hint instead.

The last line matters more than it looks. Everyone gets tired and asks for the answer. A tutor that holds the line protects you from your own impatience, and in my test, it did every time.

Optional extras

These two additions are reasonable, but I did not test them, so treat them as starting points. The first reinforces predicting before explaining, and the second helps when you have no attempt yet.

- When I share a broken attempt, first ask me what I expect it to return for one specific input.
- If I have no attempt yet, help me get started by breaking the problem into small steps,
  and let me write the code for each step myself.

6. The Hint Ladder

Not all help is equal. Think of help as a ladder, and climb only as high as you need to. Spend ten to fifteen minutes on each step before moving up.

Step Ask for Example prompt
1 Where to look “Which line or part of my code should I look at? Don’t say what’s wrong with it.”
2 A question “Ask me a question that would help me find the bug myself.”
3 A failing input “Give me one input where my function returns the wrong result.”
4 The concept “Explain the concept I’m missing, without using my exercise as the example.”
5 A similar worked example “Show me a solution to a similar but different problem that uses the same idea.”
6 The solution “I’ve tried for 30 minutes. Show me a solution, and I’ll rewrite it from memory.”

How to use it

  • Start at step 1. Most bugs are found within the first two steps.
  • Choose between steps 1 and 2 by how lost you feel. If you understand your code but cannot find the bug, ask where to look. If you are not sure your approach makes sense at all, ask for a question, because a good question tests your thinking, not just one line.
  • Spend real time on each step, such as ten or fifteen minutes, before moving up.
  • Step 3 is underrated. A failing input turns a vague problem into a concrete one you can investigate yourself, and you can verify it by running the code.
  • Step 5 keeps the learning. A solved example of a different problem shows the idea, but you still have to apply it to yours.
  • Step 6 is allowed, but only after an honest attempt. Section 9 explains how to use a full solution so that you still learn from it.

7. Explain-Back, Done Right

Explaining code back is still one of the best learning habits. The experiment shows that the question “Am I right?” is the weak part. These versions work better.

Predict, then run

Before you ask the AI anything, write down what you think the code will print, and then run it. If you were wrong, you have found exactly the gap to fill. This needs no AI at all, and it can never contradict itself.

Ask for the error, not a verdict

Instead of “Is my explanation right?”, ask a question that requires evidence.

Here is some code and my explanation of it.
Find the first sentence in my explanation that does not match what the code really does,
and show an input or output that proves it. If every sentence is accurate, say so,
and give me one harder question about this code to test my understanding.

This asks for something you can check: a specific sentence and a concrete output. It also turns a correct explanation into the next learning step, instead of a pat on the back.

Let the AI explain, then explain back

For code the AI wrote, ask it to explain the code line by line. Then close that answer and explain the code back in your own words, without looking, and compare the two. This mirrors the high-scoring “generation-then-comprehension” pattern from the Anthropic study.

8. More Prompts That Teach

These prompts keep you doing the thinking.

  • Quiz me: “Ask me five questions about this code, one at a time, and wait for each answer before telling me if I’m right.”
  • Review without fixing: “Review my code. List the problems you see, but don’t rewrite anything. I’ll fix them myself.”
  • Explain the error message: “Explain what this error message means and where it comes from. Don’t fix my code.”
  • Give me a similar exercise: “Give me a practice exercise that uses the same concept, slightly harder, without the solution.”
  • Compare approaches: “I solved it with a loop. Without showing code, describe two other ways to solve it, and when each would be better.”
  • Ask about my own code: “Ask me three questions about why I wrote my code this way.”

Each of these prompts produces something you then have to work on. That is the difference between a tutor and a ghostwriter.

9. When a Full Solution Is Fine

Tutor mode is not a vow of poverty. Full solutions have a place in learning, when you use them on purpose.

  • After an honest attempt. If you have worked on a problem and climbed the hint ladder, seeing a solution can be the fastest way to learn the missing piece.
  • As a worked example. Studying a complete solution teaches well, if you engage with it. The rewrite-from-memory routine is simple:
    1. Read the solution until you can explain every line.
    2. Close it, and wait a few minutes.
    3. Write it again from memory, in your own words and names.
    4. Run your version against the tests, and compare it with the original only after that. Where you get stuck in step 3 is exactly what you have not learned yet.
  • For boilerplate that is not the point. If you are learning web routing, it is fine to let AI write the configuration file, once you know what it does.
  • When the goal is the result. At work, under a deadline, shipping matters. Just know that you are trading learning for speed, and make that trade deliberately.

A simple rule: take the solution only when you are ready to study it, not to paste it.

10. Common Mistakes

  1. Asking for help before trying. Hints only help when there is an attempt to improve.
  2. Using the default mode for learning. In my test, it handed over working code in every reply.
  3. Trusting every hint blindly. Two of ten hints pointed at a correct line, while the bug sat elsewhere.
  4. Asking “Am I right?” The verdict often contradicted the explanation that followed it.
  5. Reading only the first line of an answer. The useful part is usually further down.
  6. Telling the AI to be strict and believing every criticism. It can invent mistakes that are not there.
  7. Climbing the hint ladder too fast. Give each step real time before asking for more.
  8. Pasting solutions without rewriting them. You remember what you rebuild, not what you copy.

11. Frequently Asked Questions

Doesn’t the tutor approach make learning slower?

At first, yes, it does. Each exercise takes longer. But the Anthropic study found that delegating to AI did not make the task significantly faster, while it did reduce learning. The time you spend thinking is the learning.

Which tool is best for learning to program?

Any capable assistant works with a good tutor prompt. Built-in modes such as ChatGPT study mode or Gemini Guided Learning are convenient. For learning inside a real codebase, Claude Code’s Learning style hands you the important pieces to write yourself.

What if the AI’s hint is wrong?

Treat every hint as a suggestion to test. Run your code on the input or case the hint mentions. If your code behaves correctly there, tell the AI and ask it to look elsewhere. Finding a wrong hint is itself good debugging practice.

Can I use AI to check my homework?

Yes, but ask for evidence, not a verdict. Ask it to find the first incorrect step and prove it with an example, then check that example yourself. In my test, yes-or-no verdicts contradicted their own explanations in most disputed cases.

Should I turn off AI completely while learning?

You do not have to turn it off. Some practice without AI is valuable, especially for writing code from scratch. But a well-configured tutor can explain concepts, generate exercises, and answer questions at any hour, which is hard to match.

12. Conclusion

The same AI can make you a better programmer or a dependent one. The difference is its role. As a ghostwriter, it hands you finished code, as it did in every default reply in my test. As a tutor, it asks questions, points at problems, and leaves the thinking to you, and a short prompt was enough to make it hold that role under pressure.

A tutor still makes mistakes. Two of its ten hints pointed at the wrong line, and its yes-or-no verdicts on my explanations often contradicted the explanations that followed. So keep the habits from Part 1: run the code, test the claims, and trust evidence over confidence.

Set up your tutor today, start each problem with your own attempt, and climb the hint ladder one step at a time. The next article covers reading and reviewing AI-generated code, with a checklist you can use on every answer. Tools change quickly, so treat the feature details here as accurate as of early December 2026.

13. References

Research

Learning modes

Python documentation

On this site


Back to All Posts
Share this post:
Share on X
Share on LinkedIn
Share on Reddit
Share on Facebook
Copy Link
Copied!