DEV Community

Cover image for 5 ChatGPT prompts I wish I had when I started learning Python
Rick
Rick

Posted on

5 ChatGPT prompts I wish I had when I started learning Python

When I started learning Python a while back, I had ChatGPT open
in one tab and the docs in another. The thing is — I was using
ChatGPT wrong. I'd type "explain functions" and get a wall of
text I half-understood.

After a year of trial and error I figured out that how you
ask matters more than what you ask. Here are five prompts
that turned ChatGPT from a fancy search engine into something
that actually taught me Python.

These work just as well in Claude or Gemini.


1. The "explain like I just wrote it" prompt

Explain this Python code line by line as if you're
reviewing it with a beginner. For each line, tell me:

What it does
Why it's needed
What would happen if I removed it

Code:
[paste your code here]

Why it works: that third question is the magic. Forcing the AI
to explain what breaks if you remove a line teaches you the
purpose of every piece, not just the syntax.


2. The "find my bug without giving me the answer" prompt

I have a Python bug. Don't fix it for me.
Instead, ask me three questions that will help me
find the bug myself. Wait for my answers before
giving more hints.
Here's my code and the error:
[paste code and error]

This one changed how I learn. The instinct is to paste your
error and copy whatever fix the AI suggests. But you don't
learn anything that way. This prompt forces you to think
through the problem.


3. The "translate to Python" prompt

I want to do this in Python: [describe in plain English]
Show me three different ways to write it, from beginner
to advanced. Explain when I'd use each version in real code.

Useful when you know what you want to do but not how to
write it. Seeing three versions side by side teaches you
that there's rarely one "right" answer in Python — there
are tradeoffs.


4. The "quiz me" prompt

I just learned [topic, e.g. list comprehensions].
Test my understanding with 5 questions, from easy
to hard. Don't give me the answers yet. After I
respond, tell me which I got right and explain
the ones I missed.

I use this every time I finish a tutorial. Reading code is
passive. Getting tested forces you to actually retrieve what
you learned, which is when it sticks.


5. The "code review for beginners" prompt

Review my Python code as if I'm a junior developer
on your team. Be specific about:

What's good
What works but isn't idiomatic Python
What's actually wrong
One thing I should learn next based on this code

Code:
[paste your code]

This one is gold. Most code reviews online are either too
gentle ("looks great!") or too harsh ("this is terrible").
Asking for a specific format gets you the kind of feedback
a senior dev would actually give you.


A note on using AI to learn

The biggest mistake I made was treating ChatGPT as a
shortcut. It's not. It's a tutor that's available at 2am
when you're stuck. Ask it to explain, not to solve. Ask
it to test you. Ask it to make you uncomfortable.

The day you can write a prompt that teaches you something
you didn't know how to ask for — that's when AI starts
actually making you a better developer.


If these prompts were useful, I've packaged 50 of them
specifically for Python beginners over at
devpromptsbyrick.com.
Same format, organized by what you're learning —
fundamentals, debugging, projects, reading other
people's code.

What prompts do you use when learning Python? Drop them
in the comments — always looking for new ones.

Top comments (0)