Coding exercises with progressive hints and explained solutions
Practice programming with exercises of rising difficulty: clear tasks, test cases, three levels of hints, commented solutions at the end and a review of your code without rewriting it. Designed for ChatGPT, Claude, Gemini and Microsoft Copilot. It includes 4 customizable variables and you can copy it for free in one click.
Intermediate · Code · Pending editorial review
Prompt
Act as a programming teacher who designs hands-on exercises to lock in one specific concept.
Context:
- Language: {{language}}
- Concept I want to practice: {{concept}}
- My level: {{level}}
- Number of exercises: {{count}}
Deliverables:
1. Exercises of increasing difficulty, all focused on the concept. Each one with:
- A clear task set in a realistic context (not just "write a function that...").
- Example inputs and expected outputs.
- Constraints and edge cases to consider (empty list, negative values, text with accents...).
- Test cases ready to run in the chosen language (for example, with assertions).
2. Hints at three levels for each exercise, in a separate section:
- Hint 1: which idea or concept to apply.
- Hint 2: the approach or algorithm, with no code.
- Hint 3: pseudocode.
3. Solutions at the very end: commented code, an explanation of the design choices, time and space complexity where relevant and one typical mistake people make.
4. An optional bonus challenge that combines the concept with another one.
When I send you my code:
- Trace the test cases mentally and tell me which would fail and why.
- Point out the bug and suggest how to fix it, but do not rewrite my whole solution.
- Comment on readability and naming, marking what is optional and what matters.
Constraints:
- Use only language features suited to my level and no external libraries unless the concept requires them.
- If the concept is too broad, suggest narrowing it down before starting.How to use it
Try each exercise for at least 15 minutes without opening the hints. If you get stuck, reveal only hint 1 and try again. Paste your code into the chat for review before looking at the solution.
Usage example
Language: Python · Concept: dictionaries · Level: beginner who knows the basics · 5 exercises.
Sample output
Exercise 1: Coffee shop order counter
You get the list of drinks ordered in one morning. Return a dictionary with how many times each one was ordered.
- Input:
["latte", "tea", "latte", "juice"]→ Output:{"latte": 2, "tea": 1, "juice": 1} - Edge cases: empty list, different capitalization (
"Latte"and"latte"count as the same).
def count_orders(orders: list[str]) -> dict[str, int]:
# Write your solution here
...
# Tests
assert count_orders([]) == {}
assert count_orders(["latte", "tea", "latte"]) == {"latte": 2, "tea": 1}
assert count_orders(["Latte", "latte"]) == {"latte": 2}
assert count_orders(["juice"]) == {"juice": 1}
print("All tests pass!")
Hints (exercise 1)
- Idea: a dictionary can store one counter per key.
- Approach: loop over the list, normalize each string and add 1 to that key's value, starting at 0 if it isn't there yet.
- Pseudocode:
for each order → key = lowercase(order) → counts[key] = counts.get(key, 0) + 1
Exercise 2: Store inventory
Update a stock dictionary from a list of sales and flag any product that would go negative… …
Key facts
- Category
- Education & study · Programming
- Output type
- Code
- Level
- Intermediate
- Designed for
- ChatGPT, Claude, Gemini and Microsoft Copilot
- Verified in
- Pending editorial verification
- Variables
- Language, Concept to practice, Your level and Number of exercises
- Language
- English
- Price
- Free, no sign-up
- Updated
- Nov 7, 2026
Frequently asked questions
Why three levels of hints?
Seeing the full solution too early removes the effort that makes you learn. Graded hints give you the minimum help you need to keep thinking on your own.
Can I trust the AI to "run" my code correctly?
It is a mental trace, not a real execution, so it can be wrong. Always run the test cases on your machine or in an online sandbox to confirm.
What is this prompt for?
Practice programming with exercises of rising difficulty: clear tasks, test cases, three levels of hints, commented solutions at the end and a review of your code without rewriting it.
Which AI tools does it work with?
It is designed for ChatGPT, Claude, Gemini and Microsoft Copilot. We have not verified it in these tools yet, so results may vary between them.
How do I customize the prompt?
Click “Customize” and fill in the variables (Language, Concept to practice, Your level and Number of exercises). The text updates instantly and you can then copy it in one click. Values are stored only in your browser.
Do I need experience to use it?
It is intermediate: it helps to know the topic so you can provide good context and review the result critically.
Is this prompt free?
Yes. Every HomeCasa Prompts prompt is free, with no sign-up or subscription. You can also use them in professional projects.
Can I trust the AI output?
Treat it as a high-quality draft: always check data, figures and important claims before publishing or making decisions.