Skip to content

Lesson 5 of 40Learning with AI

Learning With AI

Use AI as a patient tutor, not a ghostwriter, with copyable prompts for hints, quizzes, practice problems, codebase tours and a weekly routine.

14 min read0/4 questions

You now know what a model is doing when it answers you, and how to ask it well. This unit turns that into a study habit. AI can make you learn to code much faster, or it can make you feel productive while you learn almost nothing. The difference is not which tool you use; it is how you use it. If you ask it to write your code, you get working code and an empty head. If you ask it to explain, quiz you, give hints and check your reasoning, you get a tutor who never runs out of patience, at any hour, on any topic. This lesson shows you how to be the second kind of learner, with prompt templates you can copy straight into any AI chat.

Tutor, not ghostwriter

A ghostwriter does the work and lets you put your name on it. A tutor makes you do the work and helps you get unstuck. AI will happily play either role, and by default it leans towards ghostwriting, because it was trained to be helpful and the most "helpful" reply to "how do I do X?" is usually the finished answer.

That is fine when you already understand the topic and just need the code. It is a trap when you are learning, because understanding comes from the effort of figuring things out. Reading a correct solution feels like understanding. It is not. The test is simple: close the chat and try to write it again from scratch. If you cannot, you did not learn it; you watched it.

So the first skill is to tell the AI which role you want. One sentence at the start of a conversation changes everything:

I am learning Python and I want to understand this myself. Act as a tutor:
do not write the solution for me. Ask me questions, give one hint at a time
when I am stuck, and only show code if I explicitly ask for it.
Quick check
You are learning recursion. Which way of using AI will help you learn it best?
Need a nudge? A hint rules out a wrong answer.

The productive struggle

Learning researchers talk about productive struggle: the uncomfortable stretch where a problem is hard but within reach. That discomfort is the feeling of your brain building new connections. Remove it completely and you remove the learning.

Copy-pasting AI code removes it completely. You skip the part where you have to hold the problem in your head, try something, see it fail, and figure out why. Worse, you lose the debugging practice, which is most of what programming actually is. Many learners discover this the hard way in their first interview or job, when the AI is not there or its answer is subtly wrong and they cannot tell.

A good rule: struggle for 15 to 20 minutes before asking for help, then ask for the smallest help that unblocks you. A hint before an explanation, an explanation before code. If you do look at a solution, close it and rewrite it yourself the next day.

Here is a practice problem to try the right way. Write your attempt inside compress, then run it. If you get stuck, ask an AI for a hint, not the answer.

Python
# Practice problem (the kind of thing an AI tutor can generate):# Run-length encode a string: "aaabcc" -> "a3b1c2".# Write your attempt in compress(), then run. Do not ask for the answer yet. def compress(text): result = "" # Your code here. Hint: track the current letter and how many times # you have seen it in a row. return result tests = [ ("aaabcc", "a3b1c2"), ("abc", "a1b1c1"), ("zzzz", "z4"), ("", ""), ("aabbaa", "a2b2a2"), # the edge case most first attempts miss]passed = 0for given, expected in tests: got = compress(given) ok = got == expected passed += ok print(f"{'PASS' if ok else 'FAIL'} compress({given!r}) = {got!r}, expected {expected!r}")print(f"\n{passed}/{len(tests)} passing")
Output
Press Run (⌘ Enter) to see what happens.

Socratic prompts: hints, not answers

The Socratic method is teaching by asking questions, so the learner reasons their way to the answer. AI is very good at it if you ask. These are templates you can copy:

Here is my code and the error. Do not fix it. Ask me one question that
would help me find the bug myself.
I am stuck on this problem. Give me the smallest possible hint. If I am
still stuck after that, I will ask for a bigger one.
Here is my solution. Do not rewrite it. Tell me whether it is correct,
and if not, describe one input where it fails, without saying why.

Notice the pattern: each prompt says what not to give you, and asks for something that keeps you thinking. The last one is especially strong. Being handed a failing input and having to work out why is exactly the skill you use when debugging real code.

A tutoring exchange that works
YouAI tutorYour codeMy loop skips the last itemWhat does range(len(x) - 1) give?print(list(range(4 - 1)))[0, 1, 2]Fixed. Why is range exclusive?

You describe the problem and paste the code, with the ask: hint only.

1/5

Explain it back

The fastest way to find gaps in your understanding is to explain the idea in your own words. When you cannot finish the sentence, you have found the gap. AI makes a great listener for this:

I am going to explain how Python dictionaries work, as if to a beginner.
Point out anything wrong, vague or missing, but do not rewrite my
explanation. Then ask me one follow-up question that tests whether I
really understand it.

The same trick works for code. Before you run something, predict the output. Before you ask the AI what code does, write down what you think it does, then compare.

Predict the outputPython

What does this print?

print([n * 2 for n in range(4) if n % 2 == 1])
Need a nudge? Hints walk you through it.

Quizzes and practice problems on demand

AI can generate unlimited practice at exactly your level. Be specific about the level and the format, and ask for answers to be held back:

Quiz me on JavaScript promises. Ask 5 questions, one at a time, starting
easy and getting harder. Wait for my answer before telling me if I am right
and moving on. At the end, tell me which idea I should review.
Give me 3 practice problems about Python string slicing, at beginner level.
For each, include 4 test cases I can run. Do not include solutions. I will
paste my answers and you will review them.

One warning: AI-generated problems and test cases are usually right but not always. If a test looks wrong, it might be. Working out whether the test or your code is wrong is excellent practice either way. The Trust but Verify lesson covers how to check.

Match the pairs0/4 matched

Match each prompt to what it trains.

Choose an item, then its match on the other side.

Learning a codebase with AI

Joining a new project, or reading an open-source repo, is where AI shines for learners and working developers alike. The trick is still to stay active: use AI as a tour guide, then go and look yourself.

I am new to this repository. Give me a tour: what the app does, the main
folders and what each is for, and the path a request takes from the entry
point to the database. Name the actual files. Do not change anything.

Then follow up with questions that make you open the files: "Which file handles login? Walk me through it line by line." "Where would I add a new API endpoint, and which existing one should I copy?" After each answer, open the file and check that it matches. Coding tools like Claude Code and Copilot can read the repository directly; how to use them is covered in the AI Coding Tools unit.

Put it in order4 steps

Put these steps for learning a new codebase with AI in a sensible order.

  1. Tap the steps below in the right order.
Need a nudge? A hint shows where it starts.

When it is fine to let AI write the code

None of this means you must hand-write everything forever. The question is always: is this the skill I am trying to build right now? If you are learning SQL, write the queries yourself. If you are learning SQL and need a quick script to load test data into your database, let the AI write that script; it is not the lesson.

Working developers draw the same line. Boilerplate, config files, one-off scripts and code in a language you will never touch again are good candidates for AI to write. Core logic you will have to maintain, debug and explain to a colleague is not, at least not until you understand it. A useful check before accepting any AI-written code: could you explain every line if someone asked in a code review? If not, ask the AI to walk you through the lines you cannot explain, and do not move on until you can.

Common traps

  • The endless chat. One conversation where you ask 40 questions in a row, each answer building on the last, feels productive. Stop every so often and try to do the thing without the chat open.
  • Asking for "the best way". Early on, you learn more by building the simple, slightly clumsy version yourself and then asking how to improve it, than by starting from an expert solution you cannot yet appreciate.
  • Skipping the docs. AI explanations are a great first pass, but the official documentation is the source of truth. Ask the AI where in the docs to read more, then actually read it.
  • Trusting fluent answers. A confident explanation can still be wrong, especially about new library versions. If something surprises you, test it in a tiny program.

A weekly routine

Consistency beats intensity. Here is a simple routine that uses AI at every step without letting it do your thinking:

One week of learning with AI
  1. Mon

    Learn a concept

    Read or watch one topic. Ask AI to explain anything unclear, with a small example.

  2. Tue

    Explain it back

    Write your own explanation and ask AI to point out gaps without rewriting it.

  3. Wed

    Practice

    Ask for 3 problems at your level, no solutions. Struggle first, then ask for hints.

  4. Thu

    Get reviewed

    Paste your solutions and ask for a review: correctness, edge cases, clearer naming.

  5. Fri

    Build something

    Use the concept in a tiny project of your own. Use hints, not generated code.

  6. Sun

    Quiz yourself

    Ask for a short quiz on the whole week, one question at a time.

Key terms
tutor mode
Asking AI for questions, hints and reviews instead of finished solutions.
productive struggle
The effortful stretch of working on a hard but reachable problem, where learning happens.
Socratic method
Teaching by asking questions so the learner reasons their way to the answer.
explain it back
Explaining an idea in your own words to find the gaps in your understanding.
active recall
Pulling knowledge out of memory, for example in a quiz, rather than re-reading it.
codebase tour
A guided overview of a repository: what it does, its folders, and how a request flows.