Sub topic 3
Choosing a Role for the AI: Tutor, Reviewer or Generator
An AI assistant can do very different jobs depending on how you ask. The same tool can coach you through a problem, critique code you wrote, or hand you a finished program. These jobs have different effects on what you learn. This chapter gives you a way to choose the job on purpose.
This chapter assumes you can write basic Python (functions, conditionals, loops), run a script in a terminal or editor, and have used a chat-based AI assistant or code completion at least a few times.
Why the role matters
The previous chapters covered two ideas. Working code is not the same as skill, and skill grows through effortful practice and retrieval. The AI affects that practice in only one way: it changes who does the thinking.
When you ask "write a function that returns the median of a list", the AI does the problem solving. You get a result, but you did not build the mental model that produced it. When you write the function yourself and ask "what is wrong with this?", you did the problem solving and the AI supplied feedback.
So the question to ask before each request is: which part of the work do I want to keep? The role you pick answers that question.
The three roles
Tutor
A tutor guides you toward an answer without giving it away. A tutor asks questions, gives hints, points to a concept you are missing, and explains why something works.
Use the tutor role when:
- You are learning a new concept or technique.
- You are stuck on a problem and want to keep solving it yourself.
- You want to check your understanding.
The learning cost is low, because you still do the retrieval, prediction and reasoning. The time cost is higher, because tutoring is slower than being handed an answer.
The prompt template from the topic plan shows the pattern:
I am learning Python. I tried to write a function that returns the median of a list, and my code is below.
<paste your code and the error or wrong output>
Do not give me the full solution. First, ask me one question that helps me find the problem. If I am still stuck, give a hint. After I fix it, review my code and tell me what to improve.Notice that the prompt contains your attempt, states what you do not want (the full solution), and sets an order: question, then hint, then review. By default an AI tends to be helpful by giving the full answer. A tutor prompt has to say otherwise.
Reviewer
A reviewer reads code you already wrote and gives feedback. It may find bugs, suggest clearer names, point out missed edge cases, or compare your approach with another one.
Use the reviewer role when:
- You have a working or nearly working solution.
- You want to improve style, structure or robustness.
- You want a second opinion before moving on.
The learning cost is low, as long as you wrote the code first. A reviewer with nothing to review becomes a generator, so the attempt is a requirement for this role.
A good reviewer request names what to look for and what to leave alone:
Review the function below. Check for edge cases I may have missed and for unclear names. List the problems and explain each one in a sentence. Do not rewrite the function.
<paste your code>The last sentence, "Do not rewrite the function", keeps the fix in your hands. Fixing the problems yourself is where much of the learning happens.
Generator
A generator produces code for you. You describe what you want and receive a solution.
Use the generator role when:
- The task is not what you are trying to learn. Examples are boilerplate, a throwaway script, or a data format conversion you already understand.
- You want an example to study after you have attempted the problem.
- You already have the skill and want to save time.
The learning cost is high when the task is the skill you are trying to build. It is acceptable when the task is routine for you, or when the generated code is something you will read closely, as the later chapter on reading generated code explains.
A generator is also the role where the risks in the next chapters apply most: wrong answers that look right, and code you cannot explain. Treat generated code as unverified until you have read it and tested it.
Comparing the roles
| Role | Who does the problem solving | Typical output | Best for | Main risk |
|---|---|---|---|---|
| Tutor | You | Questions, hints, explanations | New concepts, being stuck | Slower progress, vague hints |
| Reviewer | You, then the AI checks | A list of issues and suggestions | Improving code you wrote | Skipping the attempt, accepting every suggestion |
| Generator | The AI | Finished code | Routine tasks, worked examples | Skipped learning, unverified code |
A decision flow
You can choose a role by asking a few questions in order.
Two points about this flow. First, the generator branch still ends with reading and testing, because generated code can be wrong. Second, a missing attempt always sends you back to try first. The next chapter covers that workflow in detail.
Worked example: one task, three roles
Suppose the task is to count the vowels in a string. Here is how each role would shape the same work.
Tutor. You write a first attempt and it gives the wrong count. You paste it and ask for a question rather than a fix. The AI asks, "What happens to an uppercase A in your comparison?" That question points you at the bug and you fix it yourself.
Reviewer. You finish this version and it works:
def count_vowels(text):
return sum(1 for ch in text.lower() if ch in "aeiou")
# Predict the output before you run this line.
print(count_vowels("Learning with AI"))Before running it, write down your prediction. Count the vowels in "Learning with AI": e, a, i, i, A, I. That is 6. Now run it. If the output differs from your prediction, find out why before going on. Then ask a reviewer to look at the function. It might raise the case of None input, or note that y is not counted. You decide whether those matter.
Generator. You ask for a function that counts vowels and receive code like the version above. You get a working result in seconds. You also did none of the thinking about case handling, so you cannot yet say why .lower() is there. If this were your learning target, you would have skipped the part that mattered.
The generator result is not wrong. It is a poor fit for this particular goal.
Switching roles during one session
Real work moves between roles. A common sequence for a learning task is:
- Attempt the problem yourself.
- Use the tutor role if you get stuck.
- Use the reviewer role once your code runs.
- Use the generator role to see an alternative solution, and compare it with yours.
Say the role out loud in your prompt each time you switch. The AI does not remember your intent. If you started with a tutor prompt and then write "just give me the code", it will switch roles without comment, and you may do the same without noticing. Switching on purpose is fine. Drifting into the generator role because you are tired is the failure to watch for.
Common mistakes
- Asking the tutor to start. If you paste a problem statement with no attempt, a tutor has nothing to respond to. The AI will usually produce a solution. Write something first, even if it is wrong or only pseudocode.
- Treating review as approval. A reviewer saying "looks good" does not prove the code is correct. Tests do. The chapter on verification covers this.
- Accepting every suggestion. Reviewers sometimes suggest changes that are stylistic, unnecessary, or wrong. Ask why for each one, and apply only the ones you can explain.
- Using the generator for the core skill. If you are learning loops, do not generate loops. Generate the surrounding setup instead.
- Never using the generator. Avoiding it completely is not required. Routine work does not teach much, and generating it frees time for practice that does.
A quick self-check for any request
Before you press enter, ask yourself three things:
- Is the task the thing I am trying to learn?
- Have I attempted it?
- If the AI gives me code, could I explain each line afterward?
If the answers are yes, no and no, rewrite the prompt as a tutor request that includes your attempt.
Exercise
You are learning how to write loops in Python. You need to read a text file, but file handling is not what you are studying this week. You also need to write a loop that finds the largest number in a list, which is what you are studying. Which role would you choose for each of the two tasks, and what would you do before using the AI on the loop task?
Show answer
Use the generator role for the file reading, because it is routine and not your learning target. Read and test the output before using it. For the largest-number loop, use the tutor or reviewer role. First write your own attempt, even if it is incomplete. If it fails, ask the tutor for a question or hint without the full solution. If it works, ask the reviewer to check edge cases such as an empty list or all-negative numbers.
Exercise
A learner pastes "Write a function that returns the median of a list" into an AI chat and receives a complete function. They say they are using the AI as a tutor. Which role is the AI actually playing, and how would you change the request so that it plays the tutor role?
Show answer
The AI is playing the generator role, because it produced the finished solution and the learner did no problem solving. To make it a tutor, the learner should write an attempt first, paste it with the error or wrong output, say that the full solution is not wanted, and ask for one guiding question and then a hint if still stuck, as in the tutor prompt template shown in this chapter.