Practice Exercises on One Coding Concept with Self-Check Output and Hidden Solutions
Get five practice exercises on one programming concept, graded from easy to hard, each with exact expected output to check yourself and solutions placed at the end.
Prompt
You are a patient programming tutor who writes practice sets for self-taught learners.
Before writing anything, ask me these questions in one numbered message, then wait for my answers:
1. Which programming language are you learning?
2. Which single concept do you want to practice (for example loops, recursion, string slicing)?
3. What is your level: total beginner, can write small scripts, or comfortable with functions and classes?
4. Is there anything you have not learned yet that I should avoid?
Then write five exercises on that one concept, in rising difficulty.
Rules:
- Exercise 1 needs only the concept itself. Exercise 5 combines it with one other basic skill I already know.
- Each exercise gives a fixed sample input and the exact expected output, so I can check my code by running it.
- Use only features I said I know. No external libraries.
- Keep each task under 80 words.
- Put all solutions after a line reading "SOLUTIONS BELOW: try first". Give each solution a 1-2 sentence explanation of the key idea.
Output format:
## Exercise 1 to 5: title, difficulty (1-5), task, sample input, expected output, one-line hint
## Solutions: numbered code blocks, each with a short explanation
## Common Mistakes: 3 bullets
End with one line naming any assumption you made about my level or any feature you avoided.Example output
Tips and common edits
Why this works
- Asking language, concept and level first keeps the exercises at your level instead of generic ones.
- Exact expected output for each task lets you check your code by running it, with no need to peek at answers.
- Placing solutions after a clear stop line, with short explanations, helps you try first and then learn from the fix.
Use this in ChatGPT, Claude or Gemini after a lesson or tutorial, when you want practice on one concept. Know your language and the concept you want to drill. Scroll slowly so you don't see the solutions too early.
Common edits
- Ask for ten exercises, or a set on two related concepts such as loops and lists.
- Ask for test cases or edge-case inputs in place of a single sample input.
Prompt details
- By
- Prompts-GPT editors
- Published
Keep exploring
More like this
Explain a Confusing Coding Tutorial or Docs Passage in Plain English
Paste a confusing passage from a programming tutorial or docs and get a plain-English rewrite, inline jargon definitions, a tiny runnable example and a list of what to learn first.
Get Socratic Coding Hints in Three Levels Before Seeing the Full Solution
A patient tutor that gives escalating hints on your coding exercise, one level at a time, and shows full code only after you have tried twice.
Plan Your First Coding Portfolio Project in 1-3 Hour Milestones
Get one portfolio project matched to your goal and skills, split into 1-3 hour milestones, each with one new concept and a clear 'done when' check.
Quiz Yourself on a Coding Concept with What-Does-This-Print Questions
An interactive quiz that gives you one short code snippet at a time, checks your predicted output, explains mistakes, and ends with a score and weak spots to review.
Run a Mock Beginner Coding Interview with One Problem and Scored Feedback
Get a step-by-step mock technical interview with one beginner coding problem, a talk-through-your-approach stage, and a scored rubric for clarity, correctness and edge cases.
Choose Your First Programming Language Based on Your Goals, Time and Device
Answers four quick questions, then compares two or three languages in a table against your goals, weekly hours and device, picks one, and gives a two-week starter plan.