Mentor AI

Your personal Python mentor, right where you learn

Mentor AI works alongside you across Real Python. It sees the tutorial, lesson, or exercise you’re on, knows what you’ve been learning, and helps you understand, practice, and keep moving forward.

Your personal Python mentor is almost here. Be first in line.

Mentor AI

Hi, I’m Mentor AI. I’m with you on every page of Real Python, and I can see you’re reading about map(). Ask me anything about it.

Why would I use map() here instead of a plain for loop?
Reading “Python's map(): Processing Iterables Without a Loop”

Fair question, and the honest answer is that on this example you might not. The code above does the same as:

Language: Python
squared = []
for n in numbers:
    squared.append(n ** 2)

map() earns its place when you already have a function to apply. Then it reads as one idea, apply this to everything, with no list to build by hand:

Language: Python
names = map(str.title, ["ada", "grace"])
Want to keep going?

There is. For a small expression like n ** 2, most Python programmers reach for a list comprehension:

Language: Python
squared = [n ** 2 for n in numbers]

Same result as the map() version above, and the loop stays visible. Comprehensions are covered further down this page, so keep reading and I’ll be here if anything is unclear.

Works wherever you learn

  • Tutorials
  • Video courses
  • Exercises
  • Quizzes
  • Learning paths
  • Python reference

Get unstuck

Help the moment you’re stuck

A failing test, a confusing error, or a concept that won’t click can stall you for an hour. Mentor AI sees your exercise, your code, and your test results, then guides you toward the fix one hint at a time.

You still get to solve it yourself, and you come away understanding why it works.

Try it with Mentor AI

Mentor AI
My test keeps failing and I don't see why.
Looking at your exercise attempts

You’re close! Your function counts every word correctly, but the failing test has both "The" and "the" in it and expects them to count as the same word.

Here’s a nudge instead of the answer: what could you do to each word before counting it, so that capitalization stops mattering?

Oh! Make everything lowercase first?

Exactly. Call .lower() on the text before you split it, then run the tests again:

Language: Python
for word in text.lower().split():
    counts[word] = counts.get(word, 0) + 1

If the next test trips over punctuation like python, versus python, let me know and we’ll figure that one out together.

Go deeper

Ask about anything you’re reading

Highlight a sentence in a tutorial, a lesson, a quiz, or a reference page and ask about it. Mentor AI reads the same page you’re on, so its answers build on what’s in front of you.

Ask for another example, a simpler explanation, or how an idea connects to something you already know, and keep going until it clicks.

Try it with Mentor AI

Mentor AI
“without explicitly modifying it”
What does this mean in practice? Doesn't the decorator change my function?
Reading “Primer on Python Decorators”

Your function’s code stays exactly as you wrote it. The decorator builds a new function that wraps yours, and that wrapper takes over the name:

Language: Python
@timer
def download(url):
    ...

# Same as:
download = timer(download)

Calling download() now runs the wrapper, which can do extra work and then call your untouched original inside it.

Where would you like to go from here?

Ask on any code block

Every code example comes with a guide

Each code block on Real Python has an Ask Mentor AI button. Pick a question, and Mentor AI answers with that exact code in front of it: what it does, why it’s written that way, or a line-by-line walkthrough.

Ask it to quiz you on the snippet or turn it into a practice exercise, and a code example becomes something you can learn from.

Try it with Mentor AI

Mentor AI
“for name, age in zip(names, ages):”
Walk me through this line by line.
Reading “Using the Python zip() Function for Parallel Iteration”

Line by line:

  1. names and ages are two lists that belong together by position: "Ada" goes with 36, "Grace" with 45.
  2. zip(names, ages) pairs them up as it goes, giving back ("Ada", 36), then ("Grace", 45).
  3. for name, age in ... unpacks each pair into two variables, so the loop body gets a name and an age at once instead of one tuple.
  4. The f-string prints them: Ada is 36.

One thing to watch: zip() stops at the shorter list. If ages had only one item, Grace would never print.

Want to keep going?

Practice on demand

Exercises made for you, whenever you want them

Just finished a tutorial? Ask for an exercise on exactly what you learned, pitched at your level.

Paste your solution and Mentor AI runs it, reviews it, and points out what to try next. Practice until the new skill feels like your own.

Try it with Mentor AI

Mentor AI
I just finished the list comprehensions tutorial. Can you give me an exercise to practice?
Reviewing your learning activity

Here’s one at your level.

Clean up the guest list: Write normalize_guests(names) that strips the whitespace from each name, capitalizes it, and drops empty entries, all in one list comprehension:

Language: Python
>>> normalize_guests(["  ada ", "GRACE", "", "linus"])
['Ada', 'Grace', 'Linus']

Paste your solution here when you’re ready and I’ll review it.

def normalize_guests(names): return [n.strip().title() for n in names if n]
Running Python code

Nice and readable! One case slips through: a name made of spaces only passes your if n check, because it isn’t empty until after you strip it. It ends up in the result as an empty string.

Can you change the condition so it checks the stripped name instead?

Facts you can check

Current answers about Python itself

Which version added a feature, whether your Python is still supported, what a package needs, where the official docs live: Mentor AI looks these up live instead of guessing from memory.

Answers link to the Python reference, the PEPs, and the docs they came from, so you can read the source and check for yourself.

Try it with Mentor AI

Mentor AI
Can I use match statements? My work project is on Python 3.9.
Looking up “3.9”
Looking up “match statement”

Not on 3.9, unfortunately. The match statement arrived in Python 3.10 with PEP 634, so on 3.9 it’s a syntax error.

Two things worth knowing:

  • Python 3.9 reached end of life in October 2025, so it no longer gets security fixes. That’s a good argument for the upgrade, beyond match.
  • Until then, an if/elif chain covers most of what match does. The reference entry for match has a side-by-side, and Structural Pattern Matching in Python goes deeper once you can use it.

Find the right resource

The right tutorial for what you want to learn

Tell Mentor AI what you want to learn or build. It searches the Real Python library and suggests a sensible order through the tutorials, video courses, and learning paths that fit your goal.

No more guessing where to start.

Try it with Mentor AI

Mentor AI
I want to start building web APIs. Where should I begin?
Searching for “rest api”

Great goal! Here’s an order that builds nicely:

  1. Python and REST APIs: Interacting With Web Services shows how APIs work from the client side, using requests.
  2. Python REST APIs With Flask, Connexion, and SQLAlchemy walks you through building your own API from scratch.
  3. Python REST APIs With FastAPI is a video course on a modern framework, once the basics feel comfortable.

Want me to suggest a small project to build along the way?

Lost in a lesson

Pause the video and ask

Mentor AI knows which lesson you’re watching and how far in you are, so when something doesn’t land you can just ask. It picks up where the instructor left off and explains it another way, at your level, building on what you’ve already learned on Real Python.

It comes along from page to page, too: a question you ask in a lesson can carry on in the exercise after it.

Try it with Mentor AI

Mentor AI
Hang on, I'm a bit lost. What did she mean by the “wrapper” function?
Reading “Decorating Functions With Arguments”
Reviewing your learning activity

This is the part that trips most people up, so good place to pause. Right before you stopped, the instructor defined wrapper() inside my_decorator() and returned it without calling it.

You’ve already met inner functions in the functions tutorial, and that’s all wrapper() is: a new function that stands in for the one you decorated.

Language: Python
def my_decorator(func):
    def wrapper(*args, **kwargs):
        print("Before")
        result = func(*args, **kwargs)
        print("After")
        return result
    return wrapper

After @my_decorator, calling say_hello() really calls wrapper(), which does its extra work and then calls your original say_hello() in the middle. The *args, **kwargs she added just let wrapper() accept whatever arguments the original takes and pass them straight through.

Where to from here?

Built to help you learn

Hints before answers

Mentor AI coaches you toward solutions instead of handing them over, so what you learn sticks. When you want the full answer, just ask.

Grounded in Real Python

Answers draw on Real Python’s tutorials, courses, and Python reference, with links so you can read more on your own.

Picks up where you left off

Mentor AI follows you from page to page, and your conversations are saved, so you can return to one anytime.

A note from our CEO, Dan Bader:

Hey there,

I’ve spent almost two decades helping people become better programmers. One thing has stayed frustratingly constant: the best way to learn is with a great mentor sitting next to you.

A great mentor doesn’t just answer your question. They notice where you’re stuck, ask the question that makes it “click,” and explain things in a way that fits how you think.

A great mentor knows what you already understand and what you’re working toward.

The thing is, almost nobody gets a great mentor. That kind of guidance has always been rare and expensive. For most learners, it simply wasn’t available.

That’s the problem we’ve set out to solve with Real Python Mentor AI.

Mentor AI is an AI learning companion that follows you across every page on Real Python. It knows your learning history and your goals, and it uses that knowledge to meet you where you are.

If a concept in a tutorial isn’t landing, Mentor can break it down differently, connect it to something you already know, or walk you through it step by step until it does.

And we deliberately built Mentor so it doesn’t just hand you the answer:

When you’re working through a coding exercise or a quiz, it engages you in a Socratic dialogue. It helps you spot your own sticking points and work through them, because that “zone of proximal development” is where real learning happens.

When you’re stuck on a coding exercise, Mentor won’t paste the solution. It asks what you’ve tried, points you toward the line that matters, and lets you make the connection yourself.

This is also what makes Mentor AI different from a general-purpose chatbot.

Mentor is grounded in the Real Python library: our textbook-quality tutorials, video courses, interactive quizzes, and coding exercises. It reads the same resources you’re reading.

It can check the official Python docs and PyPI to cross-reference details and make sure what you’re getting is accurate and current. And it interfaces directly with our interactive learning tools, so the help you get is tied to what you’re actually doing, not a vague guess about it.

Why learn to code at all in the age of AI?

Here’s the thing:

AI can write good code. Increasingly, it writes a lot of it. But as engineers, we’re responsible for the outcomes.

We decide what gets built, we judge whether it’s right, and we own the results. You can’t do that well if you don’t understand what’s happening underneath.

Think about how we learned sorting algorithms in school. Almost nobody implements quicksort from scratch on the job. We learned them anyway, because the point was never the implementation. It was building the mental models that let you reason about performance, trade-offs, and correctness.

Those mental models are exactly what you need to direct AI coding agents, catch their mistakes, and contribute real value to a modern software team.

So the skill set hasn’t gone away. If anything, the bar for understanding has gone up. The nitty-gritty typing is increasingly handled for you. The thinking is NOT.

The future of coding education is personal

This technology finally lets us make learning adaptive to each person: paced to you, explained in the way that resonates with you, and focused on what you actually need next.

Honestly, it also makes learning a lot more fun. Getting unstuck quickly, with a patient guide who understands your context, changes how it feels to learn something hard.

That’s the kind of education I wish I’d had. I’m proud that we get to build it, and I’d love for you to try it.

Happy Pythoning!

Dan Bader Dan Bader
CEO and Editor-in-Chief, Real Python

Questions and answers

Mentor AI is part of a Real Python membership. As a member, you’ll find the Mentor AI orb in the corner of every page. Click it to start a conversation.

Mentor AI is rolling out to members in waves. Click Join the waitlist below, leave your email, and we’ll let you know when it’s your turn. Sharing your link with friends moves you up the list.

It can see the page you’re on, any text you highlight and ask about, and your attempts on coding exercises. It also knows your learning goals, your level of experience, and what you’ve been working on at Real Python. It uses all of this to give you guidance that fits where you are in your learning journey.

Yes. The orb and the chat work on phones and tablets, and because your conversations are saved to your account, you can start one on your laptop and pick it up on your phone.

We’d love to hear how Mentor AI is working for you. Send us your thoughts, or rate individual answers right in the chat.

Learn Python with a mentor at your side

Meet Mentor AI: this orb is your personal Python mentor. Click it to join the waitlist and be among the first to say hi.

Your personal Python mentor is almost here. Be first in line.

Your personal Python mentor is almost here. Be first in line: