LangChain is a framework for Python and JavaScript that lets you build applications powered by large language models (LLMs). Sending a single prompt to a model takes only a couple of lines of code. However, real apps also need reusable instructions, access to your own data, and a way for the model to call your Python code. In this tutorial, you’ll explore how LangChain’s Python library handles each of these.
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by Real Python
LangChain Tutorial: From Prompts to RAG and AI Agents Quiz
Interactive Quiz ⋅ 14 Questions By Joseph Peart In this quiz, you’ll test your understanding of LangChain Tutorial: From Prompts to RAG and AI Agents. You’ll revisit how to steer a chat model with system and human messages, build reusable prompt templates, and chain steps together with the LangChain Expression Language (LCEL). You’ll also review how RAG grounds answers in your own data and how a tool-calling agent decides which functions to run.
DaisyRose 27B Draws a Python Reading a Book
We asked DaisyRose 27B to draw a python reading a book using the turtle module. It’s one of five tasks in Real Python’s informal model comparison, which explores how models handle everyday Python work. Here’s the drawing from this run: We use the same prompts and no system prompt for each model. The results come from the returned code and replies.
Gemini 4 Neon Draws a Python Reading a Book
We asked Gemini 4 Neon to draw a python reading a book using the turtle module. It’s one of five tasks in Real Python’s informal model comparison, which explores how models handle everyday Python work. Here’s the drawing from this run: We use the same prompts and no system prompt for each model. The results come from the returned code and replies.
OpenAI Cuts the Price of Its Best AI Model by 20 Percent
Real Python AI News · Weekly edition · The week of November 14–20, 2026 Stop Falling Behind on AI. Catch Up in Five Minutes. New models, new prices, new agent tools, all the time. Our new AI newsletter gives you the handful of stories you actually need as a developer. Free, straight from the Real Python team. New AI models keep arriving, and AI is now finding software flaws faster than the people who maintain that software can fix them.
How to Refactor Python Code With an AI Agent
Say you have a Python project that works, and nobody is filing bug reports for it. However, every change, fix, or new feature takes longer than it should and requires working on multiple files. Also, you try to avoid touching certain files because small changes there break the whole project. That’s called technical debt, and you can pay it down when you refactor Python code with AI. Refactoring improves the code’s structure without changing what it does.
Python Practice Problems: Parsing CSV Files Quiz
Interactive Quiz ⋅ 10 Questions By Joseph Peart In this quiz, you’ll test your understanding of Python Practice Problems: Parsing CSV Files. By working through this quiz, you’ll revisit how csv.DictReader turns rows into dictionaries, how to find a minimum with min() and a key function, how to refactor similar solutions into shared code, and when pandas is worth the extra dependency. The quiz contains 10 questions and there is no time limit. You’ll get 1 point for each correct answer.
Black Friday Giveaway - Real Python
Win 3 Years of Real Python + All Four of Our Books A grand prize worth $1,090, plus more prizes for runners-up. Time Remaining: … Entries close Friday, November 27 at 11:59 pm PT Free to enter with a free Real Python account, which also gets you a personal learning plan and a free starter kit for the topic you care about. More Prizes Up for Grabs 50% Off an Annual Membership $150+ Value Half price on an individual Real Python membership, and the discount stays for as long as you remain a member.
Hy4 flash Draws a Python Reading a Book
We asked Hy4 flash to draw a python reading a book using the turtle module. It’s one of five tasks in Real Python’s informal model comparison, which explores how models handle everyday Python work. Here’s the drawing from this run: We use the same prompts and no system prompt for each model. The results come from the returned code and replies.
Build an AI Agent From Scratch in Python: The Agentic Loop
You know how LLMs work, and you may already use AI agents to help you write code. However, an LLM isn’t an agent. What sits between them is the agentic loop. In this tutorial, you’ll build an AI agent from scratch in Python by writing the harness that turns a language model into an agent. You’ll do this in about ninety lines of code, with no frameworks.
Exploring the Python math Module Quiz
Interactive Quiz ⋅ 15 Questions By Joseph Peart In this quiz, you’ll test your understanding of Exploring the Python math Module. By working through this quiz, you’ll revisit the constants of the math module, rounding and comparing floats, power, exponential, and logarithmic functions, newer additions like isqrt(), and how math compares with cmath and NumPy. The quiz contains 15 questions and there is no time limit. You’ll get 1 point for each correct answer.
Nuitka: Compile Python Into a Standalone Executable
Nuitka is a Python compiler that turns your code into a native executable. Its distribution modes let you package an application to run on a compatible machine without a separate Python installation. A more common way to do this is to use a bundler like PyInstaller, which ships your application together with the Python runtime and its dependencies. Nuitka instead compiles your Python code to C before building the executable.
GPT-6.2 Astra Draws a Python Reading a Book
We asked GPT-6.2 Astra to draw a python reading a book using the turtle module. It’s one of five tasks in Real Python’s informal model comparison, which explores how models handle everyday Python work. Here’s the drawing from this run: We use the same prompts and no system prompt for each model. The results come from the returned code and replies.
Nuitka: Compile Python Into a Standalone Executable Quiz
Interactive Quiz ⋅ 12 Questions By Joseph Peart In this quiz, you’ll test your understanding of Nuitka: Compile Python Into a Standalone Executable. By working through this quiz, you’ll revisit how Nuitka compiles your code instead of bundling it, how the standalone, onefile, and app build modes differ, which workloads benefit from compilation, and when PyInstaller is the better fit. The quiz contains 12 questions and there is no time limit. You’ll get 1 point for each correct answer.
Getting Started With Git
This video course shows you how to use Git to track changes in a project using just a few core commands and save clean snapshots of your work. If you’ve ever changed a file, broken something, and wished you could undo it, version control makes that possible. Git keeps a running history of your files so you can see what changed and when. In this video course, you’ll set up Git locally and use the core workflow from the terminal to track and record changes in a Python project.
Understanding Python Namespace Packages Quiz
Interactive Quiz ⋅ 10 Questions By Joseph Peart In this quiz, you’ll test your understanding of Understanding Python Namespace Packages. By working through this quiz, you’ll revisit what namespace packages are, how they differ from regular packages, and why they’re a good fit for large collections of related packages.
How to Set Up a Python Project for Agentic Coding
Modern AI agents can write functions, refactor modules, generate tests, and implement entire features from a natural language prompt. But their output is only as reliable as the project they’re working in. A Python project for agentic coding answers the questions an agent would otherwise guess at: how your project is organized and which tools to run. Fortunately, making agents more reliable doesn’t require longer prompts or a different coding agent.
How to Set Up a Python Project for Agentic Coding Quiz
Interactive Quiz ⋅ 12 Questions By Joseph Peart In this quiz, you’ll test your understanding of How to Set Up a Python Project for Agentic Coding. By working through this quiz, you’ll revisit how Ruff, mypy, pytest, and pre-commit hooks give AI coding agents fast feedback, how to configure your tools in pyproject.toml, what belongs in an AGENTS.md file, and how to keep secrets out of your repository. The quiz contains 12 questions and there is no time limit.
Get Started With Meta Muse in Python: Spark and Glimmer
Getting started with Meta Muse in Python takes only a few lines of code, because Meta’s Model API speaks the same protocol as OpenAI’s. Knowing what you get for your money takes a bit longer. In this tutorial, you’ll call Muse Spark and the open-weights Muse Glimmer, stream a conversation, send an image, run a tool call, and parse typed output, with real timings and costs from the test runs. The Muse models are Meta’s family of AI models for developers.
Anthropic and Google Make Their Best AI Models Cheaper
Real Python AI News · Weekly edition · The week of November 7–13, 2026 Stop Falling Behind on AI. Catch Up in Five Minutes. New models, new prices, new agent tools, all the time. Our new AI newsletter gives you the handful of stories you actually need as a developer. Free, straight from the Real Python team. The big AI companies spent the week making their best models cheaper and faster to use.
Episode 319: Mentoring Developers Beyond the Code With Tim Schilling
The Real Python Podcast Nov 13, 2026 1h 8m intermediate career community django web-dev RSS Apple Spotify YouTube Podcast Addict Overcast Pocket Casts CastBox Stitcher Download MP3 What’s it take to be a mentor to developers? Where in an engineer’s career can a mentor make an impact? This week we speak with Tim Schilling, Django Steering Council member and Djangonaut Space administrator, about mentoring Python developers.
Working With JSON in Python Quiz
Interactive Quiz ⋅ 8 Questions By Joseph Peart In this quiz, you’ll test your understanding of the video course Working With JSON in Python. By working through this quiz, you’ll revisit how serialization and deserialization work, how Python types map to JSON, how to read JSON from a web API, and how to encode and decode custom types like complex numbers. The quiz contains 8 questions and there is no time limit. You’ll get 1 point for each correct answer.
Learn With Mentor AI: Working Through a Coding Exercise
Real Python has hundreds of coding exercises that let you practice what you’ve learned in a tutorial or course. Each exercise gives you a task, a code editor, and a set of tests that check your solution. When all the tests pass, you’ve solved the exercise. Sometimes, though, the tests keep failing and you can’t figure out why. At that point, it’s tempting to open the solution and copy it. The tests turn green, but you don’t learn much from it.
Learn With Mentor AI: Working Through a Coding Exercise Quiz
Interactive Quiz ⋅ 9 Questions By Bartosz Zaczyński In this quiz, you’ll test your understanding of Working Through a Coding Exercise With Mentor AI. By working through this quiz, you’ll revisit how Mentor AI helps you get unstuck on a coding exercise without handing you the answer. You’ll also review why mutable default arguments cause bugs and why is None is the right way to check for None. The quiz contains 9 questions and there is no time limit. You’ll get 1 point for each correct answer.
Python HTTPX: Making HTTP Requests With HTTPX2
If you’ve used Requests, then you’ve probably felt its limits the moment you needed to fire off a batch of API calls at once or keep one stalled server from freezing your script. HTTPX2, the Pydantic-maintained fork of Python HTTPX, keeps the Requests-style API you know while adding asynchronous requests, sensible default timeouts, and HTTP/2. In this tutorial, you’ll learn how to move from Requests to HTTPX2.
Python HTTPX: Making HTTP Requests With HTTPX2 Quiz
Interactive Quiz ⋅ 10 Questions By Joseph Peart In this quiz, you’ll test your understanding of Python HTTPX: Making HTTP Requests With HTTPX2. By working through this quiz, you’ll revisit how to reuse connections with a Client, send concurrent requests with AsyncClient, handle timeouts and errors, stream large responses, and enable HTTP/2. HTTPX2 is Pydantic’s fork of the original HTTPX project, and it keeps the Requests-style API that you may already know.
Gemini 4 Carbon Draws a Python Reading a Book
We asked Gemini 4 Carbon to draw a python reading a book using the turtle module. It’s one of five tasks in Real Python’s informal model comparison, which explores how models handle everyday Python work. Here’s the drawing from this run: We use the same prompts and no system prompt for each model. The results come from the returned code and replies.
Python Basics: Introduction to Python
Learning Path ⋅ Skills: Python 3 Fundamentals, Real-World Projects Through this learning path, you’ll jump-start your Python journey by mastering fundamental concepts for Python beginners. You’ll learn by doing, with the guidance of experienced instructors to support you and fast-track your development. With this series of video courses, you’ll soon know “enough to be dangerous” with Python.
Gemini 4 Carbon Explained: Google's Model That Thinks Longer
Gemini 4 Carbon is Google’s new reasoning model. It became generally available in the Gemini API on November 10, 2026, and it thinks longer than its sibling Argon before it answers. In this tutorial, you’ll find out what Carbon is, when it’s worth paying for, and how to call it from Python. You’ll need a paid-tier Gemini API key to follow along. By the end of this tutorial, you’ll understand that: Carbon is Argon with more thinking: same context window, same tools, same price per token.
Claude Fable 5.2 Draws a Python Reading a Book
We asked Claude Fable 5.2 to draw a python reading a book using the turtle module. It’s one of five tasks in Real Python’s informal model comparison, which explores how models handle everyday Python work. Here’s the drawing from this run: We use the same prompts and no system prompt for each model. The results come from the returned code and replies.
Python Coding Interview Practice: Hashing, Pointers, and Windows Original
Build your coding interview skills with hashing, two pointers, and sliding windows. Practice each pattern, choose approaches in mixed problems, and explain the time and space costs of your solutions. Free Kit: Getting ready for interviews? Get the Tech Career Story Kit with career folder templates, a quick reference, and quizzes, including a folder for your interview prep notes. You only need a free Real Python account.
Getting Started With Git Quiz
Interactive Quiz ⋅ 11 Questions By Joseph Peart In this quiz, you’ll test your understanding of Getting Started With Git. By working through this quiz, you’ll revisit how to configure Git, create a repository, stage and commit changes, fix commit messages, undo mistakes with git restore and git reset, and ignore files with .gitignore. Git keeps a running history of your project, so you can always see what changed and go back when something breaks.
Python Coding Interview Practice: Hashing, Pointers, and Windows Quiz
Interactive Quiz ⋅ 13 Questions By Joseph Peart In this quiz, you’ll test your understanding of Python Coding Interview Practice: Hashing, Pointers, and Windows. By working through this quiz, you’ll revisit how sets and dictionaries trade space for time, why each two-pointer move is safe, how a sliding window keeps its summary accurate, and how to choose an approach from a problem’s constraints. The quiz contains 13 questions and there is no time limit. You’ll get 1 point for each correct answer.
TDD With AI Agents: Design the Tests First, Let the Agent Implement
When your test suite passes, you know the code matches your tests. However, if an AI agent wrote both, then all you know is that the agent agrees with itself. TDD with AI agents keeps you in control. First, you design the tests that define what the feature should do, and then the agent writes code to make those tests pass. Test-driven development (TDD) is a cycle in which you write a failing test, make it pass, and then refactor.
TDD With AI Agents: Design the Tests First, Let the Agent Implement Quiz
Interactive Quiz ⋅ 11 Questions By Joseph Peart In this quiz, you’ll test your understanding of TDD With AI Agents: Design the Tests First, Let the Agent Implement. By working through this quiz, you’ll revisit how to define a contract, let an agent draft tests, harden those tests, fence them off while the agent implements, and review the resulting diff. These habits keep you in charge of the design while the agent does the typing, so you can trust the code it hands back.
Variables in Python: Usage and Best Practices
In Python, variables are symbolic names that refer to objects or values stored in your computer’s memory. They allow you to assign descriptive names to data, making it easier to manipulate and reuse values throughout your code. You create a Python variable by assigning a value using the syntax variable_name = value. By the end of this tutorial, you’ll understand that: Variables in Python are symbolic names pointing to objects or values in memory.
Claude Code Hooks Cheat Sheet (PDF) – Real Python
Free Bonus: Claude Code Hooks Cheat Sheet Get a Claude Code Hooks Cheat Sheet (PDF) with the settings layout, lifecycle events, exit-code contract, and copy-paste hook scripts on one page:
A Beginner's Guide (Cheat Sheet) โ Real Python
Get Your Cheat Sheet: Click here to download your free Git cheat sheet and keep the core Git workflow, essential commands, and commit tips at your fingertips.
LLM APIs and MCP Cheat Sheet (PDF) – Real Python
Free Bonus: LLM APIs and MCP Cheat Sheet Get an LLM APIs and MCP Cheat Sheet (PDF) and keep API calls, structured outputs, tool calling, agent loops, and MCP servers at hand on one page:
A Fake Claude Code Extension Tried to Open a Backdoor to Your PC
Real Python AI News · Weekly edition · The week of October 31–November 6, 2026 Stop Falling Behind on AI. Catch Up in Five Minutes. New models, new prices, new agent tools, all the time. Our new AI newsletter gives you the handful of stories you actually need as a developer. Free, straight from the Real Python team. This week’s news is about trust in AI tools: a coding add-on that hides a trap, a model built to find security holes, and new ways to tell where AI-written text comes from.
LBYL vs EAFP: Preventing or Handling Errors in Python Quiz
Interactive Quiz ⋅ 13 Questions By Joseph Peart In this quiz, you’ll test your understanding of LBYL vs EAFP: Preventing or Handling Errors in Python. By working through this quiz, you’ll revisit the look before you leap (LBYL) and easier to ask forgiveness than permission (EAFP) coding styles. You’ll also practice spotting hidden check repetition, race conditions, and common gotchas, and decide which style fits a given situation. The quiz contains 13 questions and there is no time limit.
Episode 318: Free-Threaded Python: Why Python Devs Should Know About the ABI
The Real Python Podcast Nov 06, 2026 1h 8m intermediate community numpy RSS Apple Spotify YouTube Podcast Addict Overcast Pocket Casts CastBox Stitcher Download MP3 Why should every Python developer know about the CPython ABI? This week on the show, we speak with Nathan Goldbaum about free-threaded Python and the changes to the Python Application Binary Interface. Nathan recently joined the CPython core developer team and has been building community support for free-threaded Python.
Mentor AI Coding Exercises Cheat Sheet (PDF) – Real Python
Free Bonus: Mentor AI Coding Exercises Cheat Sheet Get a Mentor AI Coding Exercises Cheat Sheet (PDF) with ready-to-use prompts for getting unstuck on any coding exercise without copying the solution:
Python Cheat Sheet – Real Python
This page contains a condensed overview of the Python programming language.
Learn With Mentor AI: Getting More Out of Video Courses
I like being able to pause video courses. I can replay a command, check my own terminal, or take a minute to work out what happened. But sometimes I want to ask the instructor a question before they move on. That’s what I tried using Mentor AI for while watching a course on Real Python. Mentor AI is Real Python’s AI learning assistant, and it’s part of a Real Python membership. It knows Real Python’s content and what you’ve been learning on the site.
Python Plotting With Matplotlib (Guide) Quiz
Interactive Quiz ⋅ 11 Questions By Joseph Peart In this quiz, you’ll test your understanding of Python Plotting With Matplotlib (Guide). By working through this quiz, you’ll revisit matplotlib’s object hierarchy, the difference between the stateful and object-oriented interfaces, how to work with plt.subplots(), how pandas plotting builds on matplotlib, and how to configure styles and interactive mode. The quiz contains 11 questions and there is no time limit.
Learn With Mentor AI: Getting More Out of Video Courses Quiz
Interactive Quiz ⋅ 9 Questions By Joseph Peart In this quiz, you’ll test your understanding of Learn With Mentor AI: Getting More Out of Video Courses. By working through this quiz, you’ll revisit how to ask Mentor AI about the moment you paused on, point it at a passage in the transcript, and get a different explanation when the first one doesn’t click. You’ll also review what to do when your terminal doesn’t match the recording and how to check what stuck after a lesson.
Claude Code Cheat Sheet (PDF) – Real Python
Free Bonus: Claude Code Cheat Sheet Get a Claude Code Cheat Sheet (PDF) with slash commands, shortcuts, CLI flags, CLAUDE.md, permissions, hooks, skills, subagents, and MCP on two printable pages:
Positron IDE: A Hands-on Python Tutorial
Data analysis often starts with an unfamiliar spreadsheet or CSV file. Before you can write a single transformation, you need to know what’s in it and what’s wrong with it. Positron is a free IDE for data science projects that puts that inspection step in the same workspace as your code, so you can examine the data first and then watch your results take shape as you run your code.
Positron IDE: A Hands-on Python Tutorial Quiz
Interactive Quiz ⋅ 8 Questions By Bartosz Zaczyński In this quiz, you’ll test your understanding of Positron IDE. By working through this quiz, you’ll revisit how to inspect raw data in the Data Explorer, clean and analyze it with code cells in scripts and notebooks, and connect Posit Assistant to an LLM provider. You’ll also review a few limitations to keep in mind before you adopt Positron in your own workflow. The quiz contains 8 questions and there is no time limit.
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with Real
Contact Real, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack