Learn a programming concept with exercises with Claude

The struggle: You watch tutorials and understand them, but cannot write the code when the editor is empty.

What you end up with: A concept you can use, proved by exercises you solved yourself and code you ran.

Claude gives short exercises and hints, never the full solution first. You write and run the code, then compare.

Tools: Claude. Level: Free to start. Time: 40 min.

Use it if

  • You can follow tutorials but freeze alone
  • You build with AI and do not know the words
  • You want practice that fits your level

Skip it if

  • You want working code with no learning
  • You cannot run code on your computer yet

What you need first

  • A language and a concept, for example Python loops
  • A place to run code on your computer

The method

  1. Sets your level (Claude: Chat)

    Open a chat and tell Claude your level and what you already know. Ask it to teach through exercises.

    Prompt to copy:

    I am learning [language]. I know [what you know]. Teach me [concept] with exercises. Start with a 5-line plain explanation with one tiny example, then give me one exercise. Do not give the solution. Wait for my code. If I am stuck, give a hint, then a bigger hint, then the solution only if I ask.

    You get: A coach that gives hints first.

    Tip: Say 'hint only' each time you are tempted to peek.

  2. Writes the code yourself (Claude: Chat)

    Write your answer in your editor and run it. Paste the code and exact error text, if any.

    Prompt to copy:

    Here is my code: [paste]. It gives: [paste output or error]. Do not rewrite my code. Tell me which line the problem is on and why, in one or two sentences, then ask me a question that helps me fix it.

    You get: A bug explained, not hidden.

    Tip: Reading the error message yourself first is a skill.

  3. Raises difficulty (Claude: Chat)

    Ask for a similar exercise with a twist after you succeed, and one where the concept would be wrong to use.

    Prompt to copy:

    Give me 3 more exercises on [concept], each harder. Include one where a different approach is better and ask me to say why. Same rules: no solutions until I ask.

    You get: Practice that grows with you.

    Tip: The 'when not to use it' question is how experts think.

  4. Explains it back (Claude: Chat)

    Ask Claude to test your understanding in words, with no code.

    Prompt to copy:

    Ask me 5 questions in plain English about [concept]: what it does, when it fails, and what changes if I alter [detail]. Wait for each answer, then correct me briefly.

    You get: Proof you understand the idea, not only the syntax.

    Tip: If you cannot explain it, redo the exercise tomorrow.

Where this goes wrong

  • Follow your course's AI policy. If it is unclear whether this use is allowed, ask your lecturer first.
  • Run all code yourself. Generated code can look right and fail.
  • Do not use generated solutions in graded work unless your course allows it.

Sources

More like this

Updated . Written with AI help and checked by an independent review step, as described in our editorial standards.