<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title>Real Python</title>
  <link href="https://realpython.com/atom.xml" rel="self"/>
  <link href="https://realpython.com/"/>
  <updated>2026-06-17T14:00:00+00:00</updated>
  <id>https://realpython.com/</id>
  <author>
    <name>Real Python</name>
  </author>

  
    <entry>
      <title>Context Engineering for Python Codebases</title>
      <id>https://realpython.com/python-context-engineering-ai/</id>
      <link href="https://realpython.com/python-context-engineering-ai/"/>
      <updated>2026-06-17T14:00:00+00:00</updated>
      <summary>Learn how context engineering shapes what your AI coding agent sees on every turn, and use four practical strategies to keep your Python projects on track.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Context engineering is the practice of curating the content that goes into an AI agent’s context window. In Python projects, that may mean pinning your dependency manager in an instruction file, trimming irrelevant history, delegating heavy tasks to subagents, and more.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;context window&lt;/strong&gt; holds everything the agent sees on a single turn, not just your latest prompt.&lt;/li&gt;
&lt;li&gt;Most agent failures come from &lt;strong&gt;bad context&lt;/strong&gt;, not a bad model.&lt;/li&gt;
&lt;li&gt;Bigger context windows don’t fix poor curation—they only &lt;strong&gt;delay the symptoms&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Instruction files&lt;/strong&gt; like &lt;code&gt;AGENTS.md&lt;/code&gt; keep your Python conventions in front of the agent.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Curate&lt;/strong&gt;, &lt;strong&gt;Distill&lt;/strong&gt;, &lt;strong&gt;Delegate&lt;/strong&gt;, and &lt;strong&gt;Externalize&lt;/strong&gt; are strategies that can help you manage the agent’s context.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Modern &lt;a href=&quot;https://realpython.com/ai-coding-agents-guide/&quot;&gt;AI coding agents&lt;/a&gt;, such as Claude Code, Codex CLI, Cursor, Copilot CLI, and Antigravity CLI, work with &lt;em&gt;a fixed-size context window&lt;/em&gt;. Once you know what’s in that window and decide what belongs there for the task at hand, you’ll spend less time arguing with your agent and more time shipping quality Python code.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Get Your Cheat Sheet:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-context-engineering-ai-cheatsheet/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-context-engineering-ai-cheatsheet&quot; markdown&gt;Click here to download a free PDF&lt;/a&gt; with the core techniques for steering AI coding assistants through your own Python codebases.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Context Engineering for Python Codebases” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-context-engineering-ai/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #b9abe6;&quot; alt=&quot;A person in a green coat drops a document into a cabinet labeled CONTEXT WINDOW, beside a token-budget gauge, a Python logo, and a checklist on a tripod.&quot; src=&quot;https://files.realpython.com/media/Context-Engineering-for-Python-Codebases_Watermarked.f3b3797b12c3.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Context-Engineering-for-Python-Codebases_Watermarked.f3b3797b12c3.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Context-Engineering-for-Python-Codebases_Watermarked.f3b3797b12c3.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Context-Engineering-for-Python-Codebases_Watermarked.f3b3797b12c3.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Context-Engineering-for-Python-Codebases_Watermarked.f3b3797b12c3.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-context-engineering-ai/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Context Engineering for Python Codebases&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Build a working framework to manage your AI coding agent&#x27;s context window using four practical strategies for Python projects.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before you start learning about &lt;a href=&quot;/ref/ai-coding-glossary/context-engineering/&quot; class=&quot;ref-link&quot;&gt;context engineering&lt;/a&gt;, you should already have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hands-on experience with at least one AI coding &lt;a href=&quot;/ref/ai-coding-glossary/agent/&quot; class=&quot;ref-link&quot;&gt;agent&lt;/a&gt;, such as &lt;a href=&quot;/ref/ai-coding-tools/claude-code/&quot; class=&quot;ref-link&quot;&gt;Claude Code&lt;/a&gt;, &lt;a href=&quot;/ref/ai-coding-tools/codex-cli/&quot; class=&quot;ref-link&quot;&gt;Codex CLI&lt;/a&gt;, &lt;a href=&quot;/ref/ai-coding-tools/cursor/&quot; class=&quot;ref-link&quot;&gt;Cursor&lt;/a&gt;, &lt;a href=&quot;/ref/ai-coding-tools/copilot-cli/&quot; class=&quot;ref-link&quot;&gt;Copilot CLI&lt;/a&gt;, or &lt;a href=&quot;/ref/ai-coding-tools/google-antigravity/&quot; class=&quot;ref-link&quot;&gt;Antigravity CLI&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Comfort &lt;a href=&quot;https://realpython.com/terminal-commands/&quot;&gt;working from a terminal&lt;/a&gt; and editing plain-text configuration files like &lt;code&gt;.md&lt;/code&gt;, &lt;a href=&quot;https://realpython.com/python-toml/&quot;&gt;&lt;code&gt;.toml&lt;/code&gt;&lt;/a&gt;, or &lt;a href=&quot;https://realpython.com/python-yaml/&quot;&gt;&lt;code&gt;.yaml&lt;/code&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A basic understanding of &lt;a href=&quot;/ref/ai-coding-glossary/llm/&quot; class=&quot;ref-link&quot;&gt;large language models (LLMs)&lt;/a&gt; and concepts like &lt;a href=&quot;/ref/ai-coding-glossary/token/&quot; class=&quot;ref-link&quot;&gt;tokens&lt;/a&gt;, &lt;a href=&quot;/ref/ai-coding-glossary/prompt/&quot; class=&quot;ref-link&quot;&gt;prompts&lt;/a&gt;, and chat history.&lt;/li&gt;
&lt;li&gt;Working knowledge of Python and its ecosystem.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To learn more about these and other related topics, you can check out the resources in this Real Python learning path:&lt;/p&gt;
&lt;div&gt;


&lt;learning-path-card data-path-id=&quot;coding-with-ai&quot; class=&quot;d-block container border rounded mb-4 shadow-sm&quot; data-progress-card&gt;
  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center px-3&quot;&gt;

        &lt;a href=&quot;/learning-paths/coding-with-ai/&quot; aria-hidden=&quot;true&quot; tabindex=&quot;-1&quot; data-not-previewable&gt;&lt;img loading=&quot;lazy&quot; src=&quot;https://files.realpython.com/media/Coding-With-AI-Learning-Path_Watermarked.5c81f9fcda0d.jpg&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Coding-With-AI-Learning-Path_Watermarked.5c81f9fcda0d.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Coding-With-AI-Learning-Path_Watermarked.5c81f9fcda0d.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Coding-With-AI-Learning-Path_Watermarked.5c81f9fcda0d.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Coding-With-AI-Learning-Path_Watermarked.5c81f9fcda0d.jpg 1920w&quot; style=&quot;background: #fe7e73;&quot; class=&quot;rounded img-fluid w-100 my-0&quot; alt=&quot;A person standing next to a brain under a dome representing artificial intelligence. The person is relaxed and supervising the AI doing work on the computer.&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;&lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col px-3 pl-sm-0 mt-3 mt-sm-0&quot;&gt;
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Learning Path&lt;/strong&gt;&lt;/p&gt;
      &lt;a class=&quot;stretched-link&quot; href=&quot;/learning-paths/coding-with-ai/&quot;&gt;&lt;h2 class=&quot;my-0 h3&quot;&gt;Python Coding With AI&lt;/h2&gt;&lt;/a&gt;
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;12 Resources ⋅ &lt;strong&gt;Skills:&lt;/strong&gt; Claude Code, Cursor, Gemini CLI, AI-Assisted Development&lt;/p&gt;


      &lt;div class=&quot;progress mt-2&quot; data-progress-placeholder&gt;
        &lt;div class=&quot;progress-bar bg-light text-black-50 small w-100&quot; data-progress-placeholder-bar&gt;&lt;/div&gt;
      &lt;/div&gt;


      &lt;div class=&quot;progress mt-2 d-none&quot; data-progress-container&gt;
        &lt;div class=&quot;progress-bar small&quot; role=&quot;progressbar&quot; data-progress-bar aria-valuenow=&quot;0&quot; aria-valuemin=&quot;0&quot; aria-valuemax=&quot;100&quot; style=&quot;min-width: 2.5em; cursor: default;&quot;&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/learning-path-card&gt;
&lt;/div&gt;

&lt;p&gt;You don’t need any prior exposure to context engineering itself. The whole point of this tutorial is to give you a working framework to effectively manage your agent’s context window.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Context engineering is different from &lt;a href=&quot;/ref/ai-coding-glossary/prompt-engineering/&quot; class=&quot;ref-link&quot;&gt;prompt engineering&lt;/a&gt;. Context engineering manages everything in the context window. Prompt engineering is about crafting individual prompts.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;With that distinction in mind, the next section opens up the context window so you can see exactly what’s competing for space on every turn.&lt;/p&gt;
&lt;h2 id=&quot;defining-context-for-ai-coding-agents&quot;&gt;Defining Context for AI Coding Agents&lt;a class=&quot;headerlink&quot; href=&quot;#defining-context-for-ai-coding-agents&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&quot;/ref/ai-coding-glossary/context-window/&quot; class=&quot;ref-link&quot;&gt;&lt;strong&gt;context window&lt;/strong&gt;&lt;/a&gt; is everything the agent sees on a single turn. Your most recent &lt;a href=&quot;/ref/ai-coding-glossary/prompt/&quot; class=&quot;ref-link&quot;&gt;prompt&lt;/a&gt; is only the last item on the list. On any given turn, whenever you write a prompt and press &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-enter&quot;&gt;Enter&lt;/kbd&gt;&lt;/span&gt;, the agent’s window typically holds the following layers of content:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;/ref/ai-coding-glossary/system-prompt/&quot; class=&quot;ref-link&quot;&gt;System prompt&lt;/a&gt;:&lt;/strong&gt; The agent’s built-in role and rules, typically set by the vendor.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Instruction files:&lt;/strong&gt; Files like &lt;code&gt;AGENTS.md&lt;/code&gt;, &lt;code&gt;CLAUDE.md&lt;/code&gt;, Cursor rules, or Copilot instructions, auto-loaded into every turn. Skill descriptions also live in this layer. The agent loads a skill’s full body only when it picks the skill for the task.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tool definitions:&lt;/strong&gt; Names, short descriptions, and JSON Schema definitions for every tool the agent can call, including &lt;a href=&quot;/ref/ai-coding-glossary/mcp/&quot; class=&quot;ref-link&quot;&gt;MCP&lt;/a&gt; server tools and, in some frameworks, any &lt;em&gt;subagent&lt;/em&gt; the main agent can delegate to.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Opened files:&lt;/strong&gt; Source files, configuration files, or docs the agent has read in this session.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Search results:&lt;/strong&gt; Results from web searches, internal &lt;a href=&quot;/ref/ai-coding-glossary/retrieval-augmented-generation/&quot; class=&quot;ref-link&quot;&gt;RAG&lt;/a&gt; queries, or file searches.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Conversation history:&lt;/strong&gt; Earlier prompts, replies, and tool outputs from the same session.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Your new prompt:&lt;/strong&gt; The prompt you just typed, plus any attachments.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In practice, all of this content lives inside the context window. The layers are listed separately here to clarify what’s consuming your context budget. The diagram below shows how all seven layers come together as the context window the agent reads before producing a reply:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/context-window-diagram.5ffc42e25091.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid &quot; src=&quot;https://files.realpython.com/media/context-window-diagram.5ffc42e25091.png&quot; width=&quot;1024&quot; height=&quot;576&quot; srcset=&quot;/cdn-cgi/image/width=256,format=auto/https://files.realpython.com/media/context-window-diagram.5ffc42e25091.png 256w, /cdn-cgi/image/width=341,format=auto/https://files.realpython.com/media/context-window-diagram.5ffc42e25091.png 341w, /cdn-cgi/image/width=512,format=auto/https://files.realpython.com/media/context-window-diagram.5ffc42e25091.png 512w, /cdn-cgi/image/width=1024,format=auto/https://files.realpython.com/media/context-window-diagram.5ffc42e25091.png 1024w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;A labeled Context window frame holds seven colored input cards feeding via arrows into a central Agent box, which produces a Generated response box on the right.&quot; data-asset=&quot;7036&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;The Context Window on a Single Agent Turn&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;For a more concrete example, below is a snapshot of what a single turn in a Claude Code session might look like:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;text&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--grey&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Text&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Filename: &lt;/span&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;Context Window&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;[system prompt]        You are Claude Code, an interactive CLI...
[CLAUDE.md]            Use uv. Python 3.14. Run tests with uv run pytest -q.
[tool catalog]         Read, Edit, Bash, Grep, WebFetch, ...
[opened file]          src/api/users.py  (340 lines)
[history turn 1]       User: Add an email validator to the User class.
[history turn 2]       Assistant: &amp;lt;edits users.py&amp;gt;
[tool result turn 2]   Bash: uv run pytest -q -&amp;gt; 3 failed
[history turn 3]       User: Fix the failing tests.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-context-engineering-ai/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-context-engineering-ai/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Context Engineering for Python Codebases</title>
      <id>https://realpython.com/quizzes/python-context-engineering-ai/</id>
      <link href="https://realpython.com/quizzes/python-context-engineering-ai/"/>
      <updated>2026-06-17T12:00:00+00:00</updated>
      <summary>Build a working framework to manage your AI coding agent&#x27;s context window using four practical strategies for Python projects.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of
&lt;a href=&quot;https://realpython.com/python-context-engineering-ai/&quot;&gt;Context Engineering for Python Codebases&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit the layers of an agent&amp;rsquo;s
context window and the four strategies for managing it: Curate, Distill,
Delegate, and Externalize.&lt;/p&gt;
&lt;p&gt;These ideas apply to any modern AI coding agent, so this quiz doubles
as a checkpoint for your day-to-day Python workflow.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Building Python Skills for the Job Market</title>
      <id>https://realpython.com/courses/building-python-skills-for-the-job-market/</id>
      <link href="https://realpython.com/courses/building-python-skills-for-the-job-market/"/>
      <updated>2026-06-16T14:00:00+00:00</updated>
      <summary>Learn which Python skills employers value most and how to build them, using a skill roadmap worksheet, weekly practice plan, and interview prep tips.</summary>
      <content type="html">
        &lt;p&gt;When you&amp;rsquo;re learning Python, the sheer volume of topics to explore can feel overwhelming because there&amp;rsquo;s &lt;em&gt;so much&lt;/em&gt; you could focus on. Should you dive into web frameworks before exploring data science? Is test-driven development something you need right away? And which skills actually matter to employers in the age of AI-assisted software development?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll have:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A clear understanding of which &lt;strong&gt;Python skills&lt;/strong&gt; employers consistently look for&lt;/li&gt;
&lt;li&gt;A personalized &lt;strong&gt;Python developer roadmap&lt;/strong&gt; showing where you are and where you need to go&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;weekly practice plan&lt;/strong&gt; that makes consistent progress feel achievable&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Python itself is relatively beginner-friendly, but its versatility makes it easy to wander without direction. Without a clear plan, you can spend months studying topics that won&amp;rsquo;t help you land your first developer job.&lt;/p&gt;
&lt;p&gt;This course will show you how to build a focused learning strategy that aligns with real job market demands. You&amp;rsquo;ll learn how to research what employers value, assess your current strengths and gaps, and structure a practice routine that turns scattered study sessions into steady progress.&lt;/p&gt;
&lt;p&gt;Instead of guessing what to learn next, you&amp;rsquo;ll have a concrete document that shows you exactly where to focus:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/python-skills-worksheet-link.4e0ad67920ee.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border &quot; src=&quot;https://files.realpython.com/media/python-skills-worksheet-link.4e0ad67920ee.png&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/python-skills-worksheet-link.4e0ad67920ee.png 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/python-skills-worksheet-link.4e0ad67920ee.png 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/python-skills-worksheet-link.4e0ad67920ee.png 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/python-skills-worksheet-link.4e0ad67920ee.png 1920w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;The Python skills worksheet as a table with one row filled out and a link showing on hover&quot; data-asset=&quot;6692&quot;/&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;Work through this course to identify the skills you need and set yourself up for success.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Building Python Skills for the Job Market</title>
      <id>https://realpython.com/quizzes/building-python-skills-for-the-job-market/</id>
      <link href="https://realpython.com/quizzes/building-python-skills-for-the-job-market/"/>
      <updated>2026-06-16T12:00:00+00:00</updated>
      <summary>Test how well you can turn scattered Python study into a focused plan for landing a developer job, from skill roadmap to interview prep.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of &lt;a href=&quot;https://realpython.com/courses/building-python-skills-for-the-job-market/&quot;&gt;Building Python Skills for the Job Market&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through it, you&amp;rsquo;ll revisit how to choose a developer path, research what employers value, build a skill roadmap with SMART goals, design a weekly practice routine, and prepare for technical and AI-enabled interviews.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s no code to write here. Instead, you&amp;rsquo;ll check your grasp of the strategy that turns scattered studying into steady progress toward your first developer job. Good luck!&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Develop Data Visualization Interfaces in Python With Dash</title>
      <id>https://realpython.com/quizzes/python-dash/</id>
      <link href="https://realpython.com/quizzes/python-dash/"/>
      <updated>2026-06-16T12:00:00+00:00</updated>
      <summary>Test your understanding of building interactive Python dashboards with Dash, including layout, styling, callbacks, and deployment.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of
&lt;a href=&quot;https://realpython.com/python-dash/&quot;&gt;Develop Data Visualization Interfaces in Python With Dash&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to build a Dash application with a layout, style components with CSS,
wire up interactivity using the &lt;code&gt;@app.callback&lt;/code&gt; decorator, and deploy your finished dashboard with a WSGI server.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Implementing Interfaces in Python: ABCs and Protocols</title>
      <id>https://realpython.com/python-interface/</id>
      <link href="https://realpython.com/python-interface/"/>
      <updated>2026-06-15T14:00:00+00:00</updated>
      <summary>Learn how to implement interfaces in Python using abstract base classes, Protocols, and duck typing, and enforce method contracts cleanly.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In object-oriented programming (OOP), an interface describes the methods a class must implement to play a specific role. This set of methods expresses the interface contract. Python has no dedicated syntax for interfaces, but it gives you two mechanisms for modeling them: abstract base classes and protocols. Python’s everyday duck typing takes advantage of both.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;abc.ABC&lt;/code&gt;&lt;/strong&gt; combined with &lt;strong&gt;&lt;code&gt;@abstractmethod&lt;/code&gt;&lt;/strong&gt; enforces the contract at &lt;strong&gt;instantiation time&lt;/strong&gt;, raising a &lt;code&gt;TypeError&lt;/code&gt; when a subclass is missing required methods.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;typing.Protocol&lt;/code&gt;&lt;/strong&gt; defines a &lt;strong&gt;structural interface&lt;/strong&gt; that classes satisfy without inheriting from the protocol, verified by static type checkers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Duck typing&lt;/strong&gt; treats any object exposing the expected methods as valid, leveraging Python’s dynamic nature.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;isinstance()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;issubclass()&lt;/code&gt;&lt;/strong&gt; verify contracts at runtime through ABC inheritance, virtual subclass registration, or &lt;strong&gt;&lt;code&gt;@runtime_checkable&lt;/code&gt;&lt;/strong&gt; protocols.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this tutorial, you’ll write code examples that model interfaces with ABCs and protocols, rely on duck typing for behavior-based contracts, and run explicit &lt;code&gt;isinstance()&lt;/code&gt; and &lt;code&gt;issubclass()&lt;/code&gt; checks when you need formal verification at runtime.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-interface-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-interface-code&quot; markdown&gt;Click here to download the free sample code&lt;/a&gt; you’ll use to model interfaces with ABCs and protocols.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Implementing Interfaces in Python: ABCs and Protocols” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/interface-in-python/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #b9abe6;&quot; alt=&quot;Implementing an Interface in Python&quot; src=&quot;https://files.realpython.com/media/Interfaces-in-Python_Watermarked.f9ce5bda238c.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Interfaces-in-Python_Watermarked.f9ce5bda238c.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Interfaces-in-Python_Watermarked.f9ce5bda238c.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Interfaces-in-Python_Watermarked.f9ce5bda238c.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Interfaces-in-Python_Watermarked.f9ce5bda238c.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/interface-in-python/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Implementing Interfaces in Python: ABCs and Protocols&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Check your understanding of Python interfaces with abstract base classes, protocols, and duck typing, and how to enforce method contracts.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;pythons-approach-to-interfaces&quot;&gt;Python’s Approach to Interfaces&lt;a class=&quot;headerlink&quot; href=&quot;#pythons-approach-to-interfaces&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;, an &lt;a href=&quot;/ref/glossary/api/&quot; class=&quot;ref-link&quot;&gt;&lt;strong&gt;interface&lt;/strong&gt;&lt;/a&gt; acts as a &lt;em&gt;blueprint&lt;/em&gt; for implementing concrete &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt;. Interfaces define &lt;a href=&quot;/ref/glossary/method/&quot; class=&quot;ref-link&quot;&gt;methods&lt;/a&gt; that are typically &lt;a href=&quot;/ref/glossary/abstract-method/&quot; class=&quot;ref-link&quot;&gt;&lt;strong&gt;abstract&lt;/strong&gt;&lt;/a&gt;, which means that the interface declares them, but doesn’t implement them.&lt;/p&gt;
&lt;p&gt;The implementation is the job of any class that &lt;strong&gt;implements&lt;/strong&gt; the interface. By prescribing a set of methods, interfaces let you write code that works with many different types without caring about their concrete implementations.&lt;/p&gt;
&lt;p&gt;Python doesn’t have an &lt;code&gt;interface&lt;/code&gt; keyword like &lt;a href=&quot;https://realpython.com/java-vs-python/&quot;&gt;Java&lt;/a&gt; or Go, or a close equivalent like &lt;a href=&quot;https://realpython.com/python-vs-cpp/&quot;&gt;C++&lt;/a&gt;’s pure virtual classes. Instead, it offers two techniques for &lt;strong&gt;modeling&lt;/strong&gt; interfaces:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Inheritance-based interfaces with &lt;a href=&quot;/ref/glossary/abstract-base-class/&quot; class=&quot;ref-link&quot;&gt;&lt;strong&gt;abstract base classes (ABCs)&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Structural subtyping interfaces with &lt;a href=&quot;/ref/glossary/protocol-subtyping/&quot; class=&quot;ref-link&quot;&gt;&lt;strong&gt;protocols&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Python’s approach is just different. Where Java, Go, or C#—each with a dedicated &lt;code&gt;interface&lt;/code&gt; keyword—require a class to explicitly declare which interface it implements, Python relies on inheritance or structural matching.&lt;/p&gt;
&lt;h2 id=&quot;inheritance-based-interfaces-with-abstract-base-classes-abcs&quot;&gt;Inheritance-Based Interfaces With Abstract Base Classes (ABCs)&lt;a class=&quot;headerlink&quot; href=&quot;#inheritance-based-interfaces-with-abstract-base-classes-abcs&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&quot;/ref/stdlib/abc/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;abc&lt;/code&gt;&lt;/a&gt; module in Python’s &lt;a href=&quot;/ref/glossary/standard-library/&quot; class=&quot;ref-link&quot;&gt;standard library&lt;/a&gt; gives you several tools for working with abstract base classes (ABCs) and modeling inheritance-based interfaces. ABCs were Python’s first formal interface mechanism, and they’re built on inheritance. A concrete class declares its intent to satisfy an interface by subclassing the corresponding ABC.&lt;/p&gt;
&lt;p&gt;ABCs &lt;strong&gt;enforce&lt;/strong&gt; the interface contract. Any subclass that’s missing a required method fails with a &lt;a href=&quot;/ref/builtin-exceptions/typeerror/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;TypeError&lt;/code&gt;&lt;/a&gt; the moment you try to instantiate it. This makes ABCs a solid choice when you control the hierarchy and want to strictly enforce a specific interface at instantiation time.&lt;/p&gt;
&lt;h3 id=&quot;defining-an-abc-based-interface&quot;&gt;Defining an ABC-Based Interface&lt;a class=&quot;headerlink&quot; href=&quot;#defining-an-abc-based-interface&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;An ABC declares &lt;strong&gt;abstract methods&lt;/strong&gt; using the &lt;code&gt;@abstractmethod&lt;/code&gt; &lt;a href=&quot;/ref/glossary/decorator/&quot; class=&quot;ref-link&quot;&gt;decorator&lt;/a&gt; from the &lt;a href=&quot;/ref/stdlib/abc/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;abc&lt;/code&gt;&lt;/a&gt; module. Any &lt;a href=&quot;/ref/glossary/subclass/&quot; class=&quot;ref-link&quot;&gt;subclass&lt;/a&gt; must implement every abstract method. Otherwise, Python &lt;a href=&quot;https://realpython.com/python-raise-exception/&quot;&gt;raises&lt;/a&gt; an error the moment you try to instantiate the subclass.&lt;/p&gt;
&lt;p&gt;Say you need an interface for file readers. Readers for different formats like PDFs and emails will require the same methods but with different internal logic. The shared contract is to load a file from a path and return the extracted text.&lt;/p&gt;
&lt;p&gt;Here’s that interface modeled as an ABC:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Filename: &lt;/span&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;readers_abc.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;abc&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ABC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;abstractmethod&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;FileReaderInterface&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ABC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;Interface for file readers.&quot;&quot;&quot;&lt;/span&gt;

    &lt;span class=&quot;nd&quot;&gt;@abstractmethod&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;load_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;Load a file for text extraction.&quot;&quot;&quot;&lt;/span&gt;

    &lt;span class=&quot;nd&quot;&gt;@abstractmethod&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;extract_text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;Return text extracted from the loaded file.&quot;&quot;&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;A few things to notice in this code snippet:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FileReaderInterface&lt;/code&gt; inherits from &lt;code&gt;abc.ABC&lt;/code&gt;, which sets up the &lt;a href=&quot;https://realpython.com/python-metaclasses/&quot;&gt;metaclass&lt;/a&gt; for you.&lt;/li&gt;
&lt;li&gt;Each abstract method is decorated with &lt;code&gt;@abstractmethod&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The body of abstract methods can contain a descriptive &lt;a href=&quot;/ref/glossary/docstring/&quot; class=&quot;ref-link&quot;&gt;docstring&lt;/a&gt;, a bare &lt;a href=&quot;https://realpython.com/python-pass/&quot;&gt;&lt;code&gt;pass&lt;/code&gt; statement&lt;/a&gt;, an &lt;a href=&quot;https://realpython.com/python-ellipsis/&quot;&gt;ellipsis (&lt;code&gt;...&lt;/code&gt;)&lt;/a&gt;, or raise a &lt;a href=&quot;/ref/builtin-exceptions/notimplementederror/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;NotImplementedError&lt;/code&gt;&lt;/a&gt; exception.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now, create two concrete classes, &lt;code&gt;PdfReader&lt;/code&gt; and &lt;code&gt;EmailReader&lt;/code&gt;, which inherit from &lt;code&gt;FileReaderInterface&lt;/code&gt;:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Filename: &lt;/span&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;readers_abc.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;PdfReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FileReaderInterface&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;Extract text from a PDF.&quot;&quot;&quot;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;load_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;Load a PDF file for text extraction.&quot;&quot;&quot;&lt;/span&gt;
        &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Loading PDF from &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;extract_text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;Return text extracted from the loaded PDF.&quot;&quot;&quot;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Extracted PDF text&quot;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;EmailReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FileReaderInterface&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;Extract text from an Email.&quot;&quot;&quot;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;load_file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;Load an EML file for text extraction.&quot;&quot;&quot;&lt;/span&gt;
        &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Loading email from &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;hll&quot;&gt;    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;extract_email_text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;Return text extracted from the loaded email.&quot;&quot;&quot;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Extracted email text&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;&lt;code&gt;PdfReader&lt;/code&gt; implements both abstract methods, so it satisfies the interface. &lt;code&gt;EmailReader&lt;/code&gt; defines &lt;code&gt;.extract_email_text()&lt;/code&gt; instead of the required &lt;code&gt;.extract_text()&lt;/code&gt;, so it doesn’t satisfy the contract.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-interface/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-interface/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Implementing Interfaces in Python: ABCs and Protocols</title>
      <id>https://realpython.com/quizzes/interface-in-python/</id>
      <link href="https://realpython.com/quizzes/interface-in-python/"/>
      <updated>2026-06-15T12:00:00+00:00</updated>
      <summary>Check your understanding of Python interfaces with abstract base classes, protocols, and duck typing, and how to enforce method contracts.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of
&lt;a href=&quot;https://realpython.com/python-interface/&quot;&gt;Implementing Interfaces in Python: ABCs and Protocols&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to model interfaces with abstract base classes and protocols, how to enforce method contracts, and how duck typing lets unrelated classes work together.&lt;/p&gt;
&lt;p&gt;Interfaces help you write code that depends on what objects do rather than what they are. Sharpening these skills will make your object-oriented Python more flexible.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #299: EuroPython 2026: Celebrating 25 Years</title>
      <id>https://realpython.com/podcasts/rpp/299/</id>
      <link href="https://realpython.com/podcasts/rpp/299/"/>
      <updated>2026-06-12T12:00:00+00:00</updated>
      <summary>What&#x27;s happening at EuroPython 2026? The conference celebrates its 25th anniversary this year in Kraków, Poland. This week on the show, organizers Mia Bajić and Daria Linhart Grudzien join me to discuss this year&#x27;s conference.</summary>
      <content type="html">
        &lt;p&gt;What&#x27;s happening at EuroPython 2026? The conference celebrates its 25th anniversary this year in Kraków, Poland. This week on the show, organizers Mia Bajić and Daria Linhart Grudzien join me to discuss this year&#x27;s conference.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Serialize Your Data With Python</title>
      <id>https://realpython.com/quizzes/python-serialize-data/</id>
      <link href="https://realpython.com/quizzes/python-serialize-data/"/>
      <updated>2026-06-11T12:00:00+00:00</updated>
      <summary>Practice serializing Python objects to JSON, pickle, CSV, Parquet, and Protocol Buffers, and learn when to pick each format.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of
&lt;a href=&quot;https://realpython.com/python-serialize-data/&quot;&gt;Serialize Your Data With Python&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to choose between textual and binary formats, when to use schemas, and how to apply tools like &lt;code&gt;pickle&lt;/code&gt;, &lt;code&gt;json&lt;/code&gt;, the &lt;code&gt;csv&lt;/code&gt; module, Parquet, and Protocol Buffers safely and effectively.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Cursor vs Windsurf: Which AI Code Editor Is Best for Python?</title>
      <id>https://realpython.com/cursor-vs-windsurf-python/</id>
      <link href="https://realpython.com/cursor-vs-windsurf-python/"/>
      <updated>2026-06-10T14:00:00+00:00</updated>
      <summary>Compare Cursor vs Windsurf for Python across code completion, multi-file editing, and debugging to choose the right editor for your workflow.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;AI-powered code editors have moved beyond novelty to become everyday tools for many Python developers. Instead of having to switch between your editor and a separate AI chat, you can use tools like Cursor and Windsurf that bring AI directly into your workflow. As a result, the Cursor vs Windsurf question is a common one for developers deciding which to adopt.&lt;/p&gt;
&lt;p&gt;Both Cursor and Windsurf are &lt;a href=&quot;/ref/code-editors-ides/visual-studio-code/&quot; class=&quot;ref-link&quot;&gt;VS Code&lt;/a&gt; forks that import your keybindings, themes, and Python extensions, and both run the same frontier models. They look similar at first but diverge in how they handle changes as you build.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/ref/ai-coding-tools/cursor/&quot; class=&quot;ref-link&quot;&gt;Cursor&lt;/a&gt; focuses on control, surfacing AI-generated edits as reviewable diffs and relying on explicit rules to guide agent behavior. &lt;a href=&quot;/ref/ai-coding-tools/windsurf/&quot; class=&quot;ref-link&quot;&gt;Windsurf&lt;/a&gt; focuses on flow, applying edits directly in the editor while using broader workspace context, including terminal output, recent edits, and conversation history, to shape its behavior.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll compare both editors across:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AI code completion:&lt;/strong&gt; How each editor’s completion system behaves and what context it draws on&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Agentic multi-file editing:&lt;/strong&gt; How each editor handles tasks involving multiple files, directories, and the terminal&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debugging and error correction:&lt;/strong&gt; How each editor reviews generated code and integrates with your linter&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By the end, you’ll have a clear picture of which editor fits your Python workflow. If you’re coming from VS Code, the &lt;a href=&quot;https://realpython.com/python-development-visual-studio-code/&quot;&gt;Python Development in Visual Studio Code&lt;/a&gt; tutorial covers the baseline configuration that carries over to both forks.&lt;/p&gt;
&lt;p&gt;The table below helps you choose the right editor at a glance:&lt;/p&gt;
&lt;div class=&quot;table-responsive&quot;&gt;
&lt;table class=&quot;table table-hover&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th class=&quot;text-left&quot;&gt;Use case&lt;/th&gt;
&lt;th class=&quot;text-left&quot;&gt;Cursor&lt;/th&gt;
&lt;th class=&quot;text-left&quot;&gt;Windsurf&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;You want AI-generated changes shown as reviewable diffs before they’re written to your files, guided by explicit rules&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;✅&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;You want edits applied directly as the agent works, using a broader workspace context (terminal output, recent edits, conversation history, and memory)&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;—&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Cursor is the better fit if you want to review changes before they’re applied. Windsurf is the better fit if you prefer the agent to apply edits directly in your files as it works, drawing on the broader workspace context. To see how this plays out in completion, context management, and debugging, read on.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/cursor-vs-windsurf-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-cursor-vs-windsurf-python-code&quot; markdown&gt;Click here to download the free sample code&lt;/a&gt; for the resilient HTTP client you’ll build with Cursor and Windsurf in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Cursor vs Windsurf: Which AI Code Editor Is Best for Python?” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/cursor-vs-windsurf-python/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #e5c6aa;&quot; alt=&quot;Two people operating a factory machine with conveyor belts and panels labeled Manual Control Center and Automatic Flow Center, with a Python logo on a chip.&quot; src=&quot;https://files.realpython.com/media/Windsurf-vs-Cursor-Which-AI-Powered-Code-Editor-Is-Best-for-Python_Watermarked.5c2bcb8d1965.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Windsurf-vs-Cursor-Which-AI-Powered-Code-Editor-Is-Best-for-Python_Watermarked.5c2bcb8d1965.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Windsurf-vs-Cursor-Which-AI-Powered-Code-Editor-Is-Best-for-Python_Watermarked.5c2bcb8d1965.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Windsurf-vs-Cursor-Which-AI-Powered-Code-Editor-Is-Best-for-Python_Watermarked.5c2bcb8d1965.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Windsurf-vs-Cursor-Which-AI-Powered-Code-Editor-Is-Best-for-Python_Watermarked.5c2bcb8d1965.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/cursor-vs-windsurf-python/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Cursor vs Windsurf: Which AI Code Editor Is Best for Python?&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Test your understanding of how Cursor and Windsurf compare for Python across AI completion, agentic edits, and debugging workflows.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;metrics-comparison-cursor-vs-windsurf&quot;&gt;Metrics Comparison: Cursor vs Windsurf&lt;a class=&quot;headerlink&quot; href=&quot;#metrics-comparison-cursor-vs-windsurf&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As you work through the hands-on sections and eventually bring either editor into your own Python projects, the table below gives you a quick reference for some key differences you might expect from each tool:&lt;/p&gt;
&lt;div class=&quot;table-responsive&quot;&gt;
&lt;table class=&quot;table table-hover&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Cursor&lt;/th&gt;
&lt;th&gt;Windsurf&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;IDE support&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Standalone VS Code fork plus a &lt;a href=&quot;https://plugins.jetbrains.com/plugin/30583-cursorj&quot;&gt;JetBrains plugin&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Standalone VS Code fork plus &lt;a href=&quot;https://docs.windsurf.com/plugins/compatibility#supported-ides-and-versions&quot;&gt;plugins&lt;/a&gt; for JetBrains IDEs, Vim, Neovim, Xcode, Visual Studio, and more&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AI code completion&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fast, line-by-line prediction; strong on single-file typed structures&lt;/td&gt;
&lt;td&gt;Slower but more structurally aware across interconnected files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Startup performance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Faster. Uses lightweight text search that requires no upfront project indexing.&lt;/td&gt;
&lt;td&gt;Slower initial response. Builds a semantic map of your project structure before it begins.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Debugging performance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Identifies and fixes the root cause in one pass&lt;/td&gt;
&lt;td&gt;Reaches passing tests by working around the root cause over multiple iterations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Resource impact&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Light. Low background CPU and RAM usage.&lt;/td&gt;
&lt;td&gt;Heavy. Background indexing can spike local CPU during initial project load.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Billing model&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Monthly credit pool with unlimited &lt;em&gt;Tab&lt;/em&gt; and &lt;em&gt;Auto&lt;/em&gt; mode on Pro&lt;/td&gt;
&lt;td&gt;Daily and weekly usage quotas that refresh automatically on a schedule&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Pro plan pricing&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$20/month&lt;/td&gt;
&lt;td&gt;$20/month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ideal project size&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Small to medium codebases where you already know the structure and can target files manually&lt;/td&gt;
&lt;td&gt;Large, highly interconnected codebases that benefit from its RAG-based context engine and automatic semantic indexing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;In the next sections, you’ll build a resilient HTTP client in Python from scratch and then send the same prompts to both editors to compare their responses.&lt;/p&gt;
&lt;h2 id=&quot;getting-started-installation&quot;&gt;Getting Started: Installation&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-installation&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Both editors ship as standalone desktop applications that closely match the VS Code experience. On first launch, they offer to import your local VS Code configuration, copying your keybindings, extensions, themes, and settings so your environment carries over with minimal setup.&lt;/p&gt;
&lt;p&gt;To follow the hands-on project later in this tutorial, you’ll also want Python 3.12 or later installed on your system. Beyond that, if you need a full VS Code baseline before starting, the &lt;a href=&quot;https://realpython.com/courses/python-development-visual-studio-code-setup-guide/&quot;&gt;Python Development in Visual Studio Code (Setup Guide)&lt;/a&gt; course covers the editor setup from scratch.&lt;/p&gt;
&lt;p&gt;Both Cursor and Windsurf offer free plans with enough model access to work through this comparison, though keep in mind that free-tier usage is limited and may run out under heavy use.&lt;/p&gt;
&lt;h3 id=&quot;installing-cursor&quot;&gt;Installing Cursor&lt;a class=&quot;headerlink&quot; href=&quot;#installing-cursor&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Head to the &lt;a href=&quot;https://cursor.com/download&quot;&gt;Cursor download page&lt;/a&gt; and download the correct version for your system. During setup, Cursor offers to import your VS Code configuration, including extensions, keybindings, and themes, so your environment carries over with minimal setup.&lt;/p&gt;
&lt;p&gt;Once the editor opens, you’re ready to go. You don’t need to configure anything else yet.&lt;/p&gt;
&lt;p&gt;If Cursor is new to you, Real Python’s video course on &lt;a href=&quot;https://realpython.com/courses/tips-using-ai-coding-editor-cursor/&quot;&gt;Tips for Using the AI Coding Editor Cursor&lt;/a&gt; covers setup, &lt;em&gt;Agent&lt;/em&gt; mode, &lt;em&gt;Plan&lt;/em&gt; mode, and model selection in a practical context, making the comparisons later in this tutorial easier to follow.&lt;/p&gt;
&lt;h3 id=&quot;installing-windsurf&quot;&gt;Installing Windsurf&lt;a class=&quot;headerlink&quot; href=&quot;#installing-windsurf&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Download Windsurf from the &lt;a href=&quot;https://windsurf.com/download&quot;&gt;Windsurf download page&lt;/a&gt; and run the installer. The VS Code profile import works identically to Cursor’s.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/cursor-vs-windsurf-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/cursor-vs-windsurf-python/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Accessing Multiple AI Models With the OpenRouter API</title>
      <id>https://realpython.com/courses/multiple-ai-models-openrouter-api/</id>
      <link href="https://realpython.com/courses/multiple-ai-models-openrouter-api/"/>
      <updated>2026-06-09T14:00:00+00:00</updated>
      <summary>Access models from popular AI providers in Python through OpenRouter&#x27;s unified API with smart routing, fallbacks, and cost controls.</summary>
      <content type="html">
        &lt;p&gt;One of the quickest ways to call multiple AI models from a single Python script is to use OpenRouter&amp;rsquo;s API, which acts as a unified routing layer between your code and multiple AI providers. By the end of this course, you&amp;rsquo;ll be able to access models from several providers through one unified API.&lt;/p&gt;
&lt;p&gt;This convenience matters because the AI ecosystem is highly fragmented: each provider exposes its own API, authentication scheme, rate limits, and model lineup. Working with multiple providers often requires additional setup and integration effort, especially when you want to experiment with different models, compare outputs, or evaluate trade-offs for a specific task.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://openrouter.ai/&quot;&gt;OpenRouter&lt;/a&gt; gives you access to thousands of models from leading providers like OpenAI, Anthropic, Mistral, Google, and Meta. You can switch between them without changing your application code.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Accessing Multiple AI Models With the OpenRouter API</title>
      <id>https://realpython.com/quizzes/multiple-ai-models-openrouter-api/</id>
      <link href="https://realpython.com/quizzes/multiple-ai-models-openrouter-api/"/>
      <updated>2026-06-09T12:00:00+00:00</updated>
      <summary>Test your Python skills with OpenRouter: unified API access, intelligent routing, provider strategies, and model fallbacks for reliable apps.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of
&lt;a href=&quot;https://realpython.com/courses/multiple-ai-models-openrouter-api/&quot;&gt;Accessing Multiple AI Models With the OpenRouter API&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how OpenRouter provides a unified routing layer, how to call AI models from a single Python script, how to switch between intelligent routing and a specific model, how to prioritize providers, and how to add model fallbacks for reliability.&lt;/p&gt;
&lt;p&gt;It also reinforces how to weigh trade-offs like cost, latency, and quality when you choose a model for your use case.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Embeddings and Vector Databases With ChromaDB</title>
      <id>https://realpython.com/quizzes/chromadb-vector-database/</id>
      <link href="https://realpython.com/quizzes/chromadb-vector-database/"/>
      <updated>2026-06-09T12:00:00+00:00</updated>
      <summary>Check your grasp of ChromaDB, embeddings, and vector search. Practice cosine similarity, querying collections, and using RAG with LLMs in Python.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of &lt;a href=&quot;https://realpython.com/chromadb-vector-database/&quot;&gt;Embeddings and Vector Databases With ChromaDB&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit key concepts like vectors, cosine similarity, word and text embeddings, ChromaDB collections, metadata filtering, and retrieval-augmented generation (RAG).&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python 3.15 Hits Feature Freeze and Other News for June 2026</title>
      <id>https://realpython.com/python-news-june-2026/</id>
      <link href="https://realpython.com/python-news-june-2026/"/>
      <updated>2026-06-08T14:00:00+00:00</updated>
      <summary>Python 3.15 hits feature freeze with a built-in sentinel, PEP 829 lands, Pydantic forks httpx, and AI goes bug-hunting in C code.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;While the Northern Hemisphere warms up for summer, Python 3.15 went the other way with its &lt;strong&gt;beta 1 feature freeze&lt;/strong&gt; 🥶. Since May 7, the list of what will be included in the next release is final. That list includes a brand-new &lt;strong&gt;&lt;code&gt;sentinel&lt;/code&gt; built-in&lt;/strong&gt; that finally standardizes a pattern Python developers have been hand-rolling for decades.&lt;/p&gt;
&lt;p&gt;And while AI kept writing code, buggy or not, developers also directed it to &lt;em&gt;look&lt;/em&gt; for bugs in code that had been sitting untouched for years. The results were hundreds of bug fixes in Python’s C extensions and in Firefox. Meanwhile, in a quieter corner of the ecosystem, Pydantic forked &lt;code&gt;httpx&lt;/code&gt;, kicking off one of the more interesting governance stories of the year.&lt;/p&gt;
&lt;p&gt;Time to dig into the &lt;strong&gt;Python news&lt;/strong&gt; from the past month!&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Join Now:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/newsletter/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-newsletter&quot; markdown&gt;Click here to join the Real Python Newsletter&lt;/a&gt; and you’ll never miss another Python tutorial, course, or news update.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;python-releases-and-pep-highlights&quot;&gt;Python Releases and PEP Highlights&lt;a class=&quot;headerlink&quot; href=&quot;#python-releases-and-pep-highlights&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The 3.15 release of &lt;a href=&quot;https://realpython.com/cpython-source-code-guide/&quot;&gt;CPython&lt;/a&gt; crossed from alpha into beta, which means its feature set is now frozen, and the &lt;a href=&quot;/ref/glossary/python-steering-council/&quot; class=&quot;ref-link&quot;&gt;Steering Council&lt;/a&gt; cleared out a backlog of proposals before the gate closed. Two of those changes will touch the code you write every day.&lt;/p&gt;
&lt;h3 id=&quot;beta-1-marks-the-315-feature-freeze&quot;&gt;Beta 1 Marks the 3.15 Feature Freeze&lt;a class=&quot;headerlink&quot; href=&quot;#beta-1-marks-the-315-feature-freeze&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Last month, &lt;a href=&quot;https://realpython.com/python-news-may-2026/#python-3150-alpha-8-final-alpha-before-beta-freeze&quot;&gt;the eighth and final alpha&lt;/a&gt; rolled out as the runway to the beta phase. With &lt;a href=&quot;https://www.python.org/downloads/release/python-3150b1/&quot;&gt;Python 3.15.0b1&lt;/a&gt; on May 7 came the &lt;strong&gt;feature freeze&lt;/strong&gt;, which means that from here until the final release of 3.15, the core team works only on bug fixes and polishing.&lt;/p&gt;
&lt;p&gt;That makes the beta releases a good moment to step back and look at the headline features of 3.15, which are now locked:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Explicit lazy imports&lt;/strong&gt; (&lt;a href=&quot;https://realpython.com/python-news-december-2025/#pep-810-accepted-explicit-lazy-imports&quot;&gt;PEP 810&lt;/a&gt;) for faster startup&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;&lt;code&gt;frozendict&lt;/code&gt; built-in&lt;/strong&gt; (&lt;a href=&quot;https://realpython.com/python-news-march-2026/#pep-814-accepted-frozendict-joins-the-built-ins&quot;&gt;PEP 814&lt;/a&gt;) for immutable mappings&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;&lt;code&gt;sentinel&lt;/code&gt; built-in&lt;/strong&gt; (&lt;a href=&quot;https://peps.python.org/pep-0661/&quot;&gt;PEP 661&lt;/a&gt;), which you’ll dig into &lt;a href=&quot;#a-built-in-sentinel-lands-in-python-315&quot;&gt;below&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unpacking in comprehensions&lt;/strong&gt; (&lt;a href=&quot;https://realpython.com/python-news-march-2026/#python-3150-alpha-6-comprehension-unpacking-and-more&quot;&gt;PEP 798&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;UTF-8 as the default &lt;a href=&quot;https://realpython.com/python-encodings-guide/&quot;&gt;encoding&lt;/a&gt;&lt;/strong&gt; (&lt;a href=&quot;https://peps.python.org/pep-0686/&quot;&gt;PEP 686&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;A stable ABI for &lt;a href=&quot;https://realpython.com/python-news-may-2026/#pep-803-accepted-stable-abi-goes-free-threaded&quot;&gt;free-threaded builds&lt;/a&gt; (&lt;a href=&quot;https://peps.python.org/pep-0803/&quot;&gt;PEP 803&lt;/a&gt;), plus C-API modernization (PEPs &lt;a href=&quot;https://peps.python.org/pep-0820/&quot;&gt;820&lt;/a&gt; and &lt;a href=&quot;https://peps.python.org/pep-0793/&quot;&gt;793&lt;/a&gt;) that should make it easier to write C extensions that work across Python versions&lt;/li&gt;
&lt;li&gt;A new &lt;strong&gt;sampling profiler&lt;/strong&gt; in the &lt;a href=&quot;/ref/glossary/standard-library/&quot; class=&quot;ref-link&quot;&gt;standard library&lt;/a&gt; (&lt;a href=&quot;https://peps.python.org/pep-0799/&quot;&gt;PEP 799&lt;/a&gt;) for low-overhead &lt;a href=&quot;https://realpython.com/python-profiling/&quot;&gt;profiling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;a href=&quot;/ref/glossary/jit-compiler/&quot; class=&quot;ref-link&quot;&gt;JIT compiler&lt;/a&gt; also gets faster, with the beta announcement citing an 8–9 percent geometric-mean improvement on x86-64 Linux. If you’ve been putting off testing your code against 3.15, then now is the time to get started! The &lt;a href=&quot;/ref/glossary/api/&quot; class=&quot;ref-link&quot;&gt;API&lt;/a&gt; surface won’t shift under you anymore, and your feedback will help catch regressions before the release candidate phase.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Beta builds are for testing, not production. &lt;a href=&quot;https://realpython.com/python-pre-release/&quot;&gt;Install the pre-release version&lt;/a&gt;, run your test suite against 3.15, and report anything that breaks while there’s still time to fix it before the release candidate.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The first round of improvements already landed with &lt;a href=&quot;https://www.python.org/downloads/release/python-3150b2/&quot;&gt;beta 2&lt;/a&gt; on June 2, and the next big checkpoint is the &lt;a href=&quot;/ref/glossary/release-candidate/&quot; class=&quot;ref-link&quot;&gt;release candidate&lt;/a&gt; phase on August 4, with the final release expected, as usual, this fall.&lt;/p&gt;
&lt;h3 id=&quot;a-built-in-sentinel-lands-in-python-315&quot;&gt;A Built-in &lt;code&gt;sentinel&lt;/code&gt; Lands in Python 3.15&lt;a class=&quot;headerlink&quot; href=&quot;#a-built-in-sentinel-lands-in-python-315&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Here’s the new feature that you’ll likely want to reach for. If you’ve ever needed to tell the difference between a caller passing &lt;code&gt;None&lt;/code&gt; and a caller passing nothing at all, then you’ve probably written something like this:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;_MISSING&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_MISSING&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_MISSING&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# No value was provided&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;It works, but it has rough edges. The &lt;code&gt;repr()&lt;/code&gt; is an unhelpful &lt;code&gt;&amp;lt;object object at 0x7f...&amp;gt;&lt;/code&gt;, the marker can’t be used cleanly in type &lt;a href=&quot;/ref/glossary/annotation/&quot; class=&quot;ref-link&quot;&gt;annotations&lt;/a&gt;, and its identity doesn’t survive copying or pickling. &lt;a href=&quot;https://peps.python.org/pep-0661/&quot;&gt;PEP 661&lt;/a&gt; replaces the idiom with a new &lt;a href=&quot;https://docs.python.org/3.15/library/functions.html#sentinel&quot;&gt;&lt;code&gt;sentinel&lt;/code&gt;&lt;/a&gt; built-in:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;MISSING&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sentinel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;MISSING&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;update&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MISSING&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MISSING&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MISSING&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# No value was provided&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;The signature is &lt;code&gt;sentinel(name, /, *, repr=None)&lt;/code&gt;, and the result is a unique truthy object whose default &lt;code&gt;repr()&lt;/code&gt; is the name you gave it, so &lt;code&gt;MISSING&lt;/code&gt; shows up as &lt;code&gt;MISSING&lt;/code&gt; in &lt;a href=&quot;/ref/glossary/traceback/&quot; class=&quot;ref-link&quot;&gt;tracebacks&lt;/a&gt; instead of a memory address.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Sentinels and &lt;code&gt;None&lt;/code&gt; solve related but different problems. If you’re still fuzzy on when &lt;code&gt;None&lt;/code&gt; is the right tool, then Real Python’s guide to &lt;a href=&quot;https://realpython.com/null-in-python/&quot;&gt;Python’s &lt;code&gt;None&lt;/code&gt;&lt;/a&gt; is worth revisiting.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Because the sentinel is its own type, you can drop it straight into annotations like &lt;code&gt;int | MISSING&lt;/code&gt; without reaching for &lt;code&gt;Literal&lt;/code&gt;. The &lt;a href=&quot;/ref/glossary/pep/&quot; class=&quot;ref-link&quot;&gt;PEP&lt;/a&gt; was first submitted back in 2021, so it’s satisfying to see it cross the finish line.&lt;/p&gt;
&lt;h3 id=&quot;pep-829-graduates-from-draft-to-accepted&quot;&gt;PEP 829 Graduates From Draft to Accepted&lt;a class=&quot;headerlink&quot; href=&quot;#pep-829-graduates-from-draft-to-accepted&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://realpython.com/python-news-may-2026/#pep-829-draft-replacing-pth-files-for-package-startup&quot;&gt;Last month’s roundup&lt;/a&gt; featured PEP 829 while it was still a draft. It’s since been accepted for Python 3.15, so the change is now official.&lt;/p&gt;
&lt;p&gt;As a quick recap, &lt;code&gt;.pth&lt;/code&gt; files in your &lt;code&gt;site-packages&lt;/code&gt; directory can do two things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Extend &lt;code&gt;sys.path&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run arbitrary code through &lt;code&gt;import&lt;/code&gt; lines that Python feeds directly to &lt;a href=&quot;https://realpython.com/python-exec/&quot;&gt;&lt;code&gt;exec()&lt;/code&gt;&lt;/a&gt; at startup&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-june-2026/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-june-2026/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #298: Reducing the Size of Python Docker Containers</title>
      <id>https://realpython.com/podcasts/rpp/298/</id>
      <link href="https://realpython.com/podcasts/rpp/298/"/>
      <updated>2026-06-05T12:00:00+00:00</updated>
      <summary>How can you easily reduce the size of a Python Docker container? What are the exceptions you should catch in your code? Christopher Trudeau is back on the show this week with another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;How can you easily reduce the size of a Python Docker container? What are the exceptions you should catch in your code? Christopher Trudeau is back on the show this week with another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: How to Read User Input From the Keyboard in Python</title>
      <id>https://realpython.com/quizzes/python-keyboard-input/</id>
      <link href="https://realpython.com/quizzes/python-keyboard-input/"/>
      <updated>2026-06-04T12:00:00+00:00</updated>
      <summary>Try your hand at reading Python keyboard input with input(), handling errors, hiding passwords, and validating with PyInputPlus.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of &lt;a href=&quot;https://realpython.com/python-keyboard-input/&quot;&gt;How to Read User Input From the Keyboard in Python&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit the &lt;a href=&quot;/ref/builtin-functions/input/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;input()&lt;/code&gt;&lt;/a&gt; function, type conversion, error handling with &lt;code&gt;try&lt;/code&gt; and &lt;code&gt;except&lt;/code&gt;, the &lt;a href=&quot;/ref/stdlib/getpass/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;getpass&lt;/code&gt;&lt;/a&gt; module for hidden input, and the PyInputPlus library for automatic validation.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>How to Use GitHub Copilot Code Review in Pull Requests</title>
      <id>https://realpython.com/github-copilot-code-review/</id>
      <link href="https://realpython.com/github-copilot-code-review/"/>
      <updated>2026-06-03T14:00:00+00:00</updated>
      <summary>Learn how to use GitHub Copilot code review on pull requests for AI-assisted feedback, one-click fixes, and project-specific custom instructions.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;GitHub offers several AI tools under the Copilot umbrella that cover your entire development workflow. Copilot can provide an AI-powered code review shortly after you open a pull request on GitHub. Rather than waiting for a teammate, you can add Copilot as a reviewer to receive context-aware feedback. With access to your entire codebase, it delivers actionable suggestions that you can apply in just a few clicks:&lt;/p&gt;
&lt;div&gt;





&lt;div class=&quot;embed-responsive rounded mb-3 bg-light video-animation--bordered&quot; style=&quot;aspect-ratio: 1920/1080;&quot;&gt;
  &lt;video-animation data-src=&quot;https://stream.realpython.com/39340f1a-fdb0-4df0-911d-1d3844a18e59/playlist.m3u8&quot;&gt;
    &lt;video class=&quot;embed-responsive-item&quot; muted loop playsinline preload=&quot;none&quot; poster=&quot;https://stream.realpython.com/39340f1a-fdb0-4df0-911d-1d3844a18e59/thumbnail.jpg?width=1280&quot; disablepictureinpicture disableremoteplayback&gt;&lt;/video&gt;
  &lt;/video-animation&gt;
&lt;/div&gt;



&lt;/div&gt;

&lt;p&gt;Pull requests are the standard collaborative workflow provided by GitHub and similar services like GitLab to facilitate code review for projects managed with &lt;a href=&quot;/ref/tools/git/&quot; class=&quot;ref-link&quot;&gt;Git&lt;/a&gt;. A pull request, or a PR for short, is a formal request to merge code from one branch—or fork—into another, and it’s where code review typically happens.&lt;/p&gt;
&lt;p&gt;In practice, code review isn’t always timely or consistent. Some reviewers approve pull requests immediately without much scrutiny, while others leave long lists of minor nitpicks. It can also be difficult to find someone with the right level of experience or enough context about a specific part of the codebase. These issues are common in open-source projects as well, where reviews depend on the limited time of volunteer maintainers.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn how to leverage GitHub Copilot for &lt;strong&gt;AI-assisted code review&lt;/strong&gt; in pull requests and how to integrate it into your workflow to get faster, more structured feedback. Whether you’re working on a commercial project or contributing to an open-source one, Copilot can help you catch issues early and improve your code before it’s merged.&lt;/p&gt;
&lt;p&gt;Think of Copilot’s review as a fast first pass. It can reliably flag correctness mistakes and regressions to documented behavior, often before a human reviewer has even opened the PR.&lt;/p&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before you get started with AI-assisted code reviews, make sure you have the following in place:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Git and GitHub Knowledge:&lt;/strong&gt; You should have a basic familiarity with &lt;a href=&quot;https://realpython.com/python-git-github-intro/&quot;&gt;Git and GitHub&lt;/a&gt;, including how to &lt;a href=&quot;https://realpython.com/python-git-github-intro/#branching-basics&quot;&gt;create branches&lt;/a&gt;, &lt;a href=&quot;https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/about-commits&quot;&gt;commit changes&lt;/a&gt;, and &lt;a href=&quot;https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request&quot;&gt;open pull requests&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Git Client and GitHub CLI:&lt;/strong&gt; You should have the &lt;a href=&quot;https://git-scm.com/docs/git&quot;&gt;&lt;code&gt;git&lt;/code&gt;&lt;/a&gt; client configured in your command line. Additionally, you’ll need the &lt;a href=&quot;https://cli.github.com/&quot;&gt;GitHub CLI&lt;/a&gt; tool, as it simplifies common GitHub-related tasks. Make sure you’re running &lt;a href=&quot;https://github.com/cli/cli/releases/tag/v2.88.0&quot;&gt;v2.88.0&lt;/a&gt; or later, which introduced support for &lt;a href=&quot;https://github.blog/changelog/2026-03-11-request-copilot-code-review-from-github-cli/&quot;&gt;requesting Copilot code reviews&lt;/a&gt; from the command line.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GitHub Account:&lt;/strong&gt; You need a GitHub account with a paid &lt;a href=&quot;https://github.com/features/copilot/plans&quot;&gt;Copilot plan&lt;/a&gt; (Pro, Pro+, Business, or Enterprise). To check your subscription status, visit &lt;a href=&quot;https://github.com/settings/copilot&quot;&gt;GitHub Copilot settings&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Depending on how you use GitHub, you may already have access to GitHub Copilot through your organization. Sometimes, you may qualify for Copilot under special conditions.&lt;/p&gt;
&lt;p&gt;For example, if you’re a student or a teacher, or if you regularly contribute to a popular open-source project, then you might be eligible for &lt;a href=&quot;https://docs.github.com/en/copilot/how-tos/manage-your-account/get-free-access-to-copilot-pro&quot;&gt;free access to GitHub Copilot Pro&lt;/a&gt;. Check out &lt;a href=&quot;https://github.com/education&quot;&gt;GitHub Education&lt;/a&gt; to learn more. Keep in mind that GitHub reassesses whether you qualify for free access on a monthly basis.&lt;/p&gt;
&lt;p&gt;But even on the free plan, you can still try out Copilot’s code review feature for 30 days at no cost. Just &lt;a href=&quot;https://github.com/github-copilot/pro/signup&quot;&gt;subscribe to GitHub Copilot Pro&lt;/a&gt; and cancel before the first billing cycle begins. The trial period is a one-time offer per account, so you won’t be able to start another one after the first one ends.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; At the time of writing, GitHub has temporarily paused new paid subscriptions for Copilot due to exceptionally high demand and the associated infrastructure costs. You can read the &lt;a href=&quot;https://github.blog/news-insights/company-news/changes-to-github-copilot-individual-plans/&quot;&gt;official announcement&lt;/a&gt; on GitHub’s blog to learn more.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To follow along with this tutorial, you’ll also need a &lt;strong&gt;GitHub repository&lt;/strong&gt; where you can freely create branches and pull requests. Although you can &lt;a href=&quot;https://github.com/new&quot;&gt;create a new repository&lt;/a&gt; from scratch or &lt;a href=&quot;https://github.com/new/import&quot;&gt;import one&lt;/a&gt; from another Git-based hosting service, the quickest option is to download the provided supporting materials. They include a small, hands-on project you’ll be working on:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/github-copilot-code-review-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-github-copilot-code-review-code&quot; markdown&gt;Click here to download the free sample code&lt;/a&gt; you’ll use to practice AI-assisted code review on a sample FastAPI pull request with GitHub Copilot.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “How to Use GitHub Copilot Code Review in Pull Requests” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/github-copilot-code-review/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #b9abe6;&quot; alt=&#x27;A robot labeled Copilot says &quot;Reviewing...&quot; while marking bugs on a long printout fed from a machine labeled Planted Bugs with a Python logo.&#x27; src=&quot;https://files.realpython.com/media/How-to-Use-GitHub-Copilot-for-AI-assisted-Code-Review_Watermarked.2c1aa9a36a45.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/How-to-Use-GitHub-Copilot-for-AI-assisted-Code-Review_Watermarked.2c1aa9a36a45.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/How-to-Use-GitHub-Copilot-for-AI-assisted-Code-Review_Watermarked.2c1aa9a36a45.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/How-to-Use-GitHub-Copilot-for-AI-assisted-Code-Review_Watermarked.2c1aa9a36a45.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/How-to-Use-GitHub-Copilot-for-AI-assisted-Code-Review_Watermarked.2c1aa9a36a45.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/github-copilot-code-review/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;How to Use GitHub Copilot Code Review in Pull Requests&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Test your knowledge of GitHub Copilot code review in pull requests, including custom instructions and automatic reviews.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;p&gt;The sample project is a real-time quiz application inspired by &lt;a href=&quot;https://kahoot.it/&quot;&gt;Kahoot!&lt;/a&gt; and &lt;a href=&quot;https://www.mentimeter.com/&quot;&gt;Mentimeter&lt;/a&gt;, featuring a &lt;a href=&quot;https://realpython.com/get-started-with-fastapi/&quot;&gt;FastAPI&lt;/a&gt; backend and a mobile-first &lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/html-css-python/&quot;&gt;HTML, and CSS&lt;/a&gt; frontend. It allows you to make your own quizzes from scratch—and store them in the human-readable &lt;a href=&quot;https://realpython.com/python-yaml/&quot;&gt;YAML format&lt;/a&gt;—or generate a random quiz on the fly using &lt;a href=&quot;https://realpython.com/chatgpt-api-python/&quot;&gt;ChatGPT’s API&lt;/a&gt;:&lt;/p&gt;
&lt;div&gt;





&lt;div class=&quot;embed-responsive rounded mb-3 bg-light video-animation--bordered&quot; style=&quot;aspect-ratio: 1920/1080;&quot;&gt;
  &lt;video-animation data-src=&quot;https://stream.realpython.com/05af2bf6-fbbe-4b92-bb78-23aee5a6e017/playlist.m3u8&quot;&gt;
    &lt;video class=&quot;embed-responsive-item&quot; muted loop playsinline preload=&quot;none&quot; poster=&quot;https://stream.realpython.com/05af2bf6-fbbe-4b92-bb78-23aee5a6e017/thumbnail.jpg?width=1280&quot; disablepictureinpicture disableremoteplayback&gt;&lt;/video&gt;
  &lt;/video-animation&gt;
&lt;/div&gt;



&lt;/div&gt;

&lt;p&gt;Each player is assigned a randomly generated name with an emoji, such as 🐯 Grumpy Tiger, 🦨 Gentle Skunk, or 🐮 Lazy Cow, to keep things light and fun. You can start the server on a local network and have your friends or family connect from their mobile devices using a &lt;a href=&quot;https://realpython.com/python-generate-qr-code/&quot;&gt;QR code&lt;/a&gt; or a &lt;a href=&quot;https://en.wikipedia.org/wiki/Personal_identification_number&quot;&gt;PIN&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Are you ready to dive in?&lt;/p&gt;
&lt;h2 id=&quot;step-1-request-a-code-review-from-github-copilot&quot;&gt;Step 1: Request a Code Review From GitHub Copilot&lt;a class=&quot;headerlink&quot; href=&quot;#step-1-request-a-code-review-from-github-copilot&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you haven’t already, go ahead and grab the supporting materials. The sample Git repository includes a &lt;a href=&quot;https://martinfowler.com/bliki/FeatureBranch.html&quot;&gt;feature branch&lt;/a&gt; with intentional code issues that GitHub Copilot can catch when you request a review. For reference, you’ll also find another branch with the completed code to explore at your own pace:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/github-copilot-code-review-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-github-copilot-code-review-code&quot; markdown&gt;Click here to download the free sample code&lt;/a&gt; you’ll use to practice AI-assisted code review on a sample FastAPI pull request with GitHub Copilot.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;After downloading the materials, upload the local &lt;code&gt;pop-quiz&lt;/code&gt; repository—including all branches—to your GitHub account. This will create a remote copy of the repository for your own experimentation. There are several ways to accomplish this. Although you can handle most tasks through the &lt;a href=&quot;https://github.com/&quot;&gt;GitHub web interface&lt;/a&gt;, the GitHub CLI is often faster and more convenient.&lt;/p&gt;
&lt;p&gt;One straightforward approach is to use the GitHub CLI (&lt;code&gt;gh&lt;/code&gt;) alongside standard &lt;code&gt;git&lt;/code&gt; commands. This allows you to create the repository and push all branches in just two steps once you’re in the downloaded &lt;code&gt;pop-quiz/&lt;/code&gt; directory:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/github-copilot-code-review/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/github-copilot-code-review/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: How to Use GitHub Copilot Code Review in Pull Requests</title>
      <id>https://realpython.com/quizzes/github-copilot-code-review/</id>
      <link href="https://realpython.com/quizzes/github-copilot-code-review/"/>
      <updated>2026-06-03T12:00:00+00:00</updated>
      <summary>Test your knowledge of GitHub Copilot code review in pull requests, including custom instructions and automatic reviews.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of &lt;a href=&quot;https://realpython.com/github-copilot-code-review/&quot;&gt;How to Use GitHub Copilot Code Review in Pull Requests&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to request a review from Copilot on your pull requests, apply or push back on its suggestions, configure automatic reviews, and use custom instructions to make Copilot&amp;rsquo;s feedback follow your team&amp;rsquo;s conventions.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Structuring Your Python Script</title>
      <id>https://realpython.com/courses/structuring-your-python-script/</id>
      <link href="https://realpython.com/courses/structuring-your-python-script/"/>
      <updated>2026-06-02T14:00:00+00:00</updated>
      <summary>Master Python script structure with best practices for shebangs, ordered imports, formatting with Ruff, constants, and a clean entry point.</summary>
      <content type="html">
        &lt;p&gt;You may have begun your Python journey interactively, exploring ideas within Jupyter Notebooks or through the Python REPL. While that&amp;rsquo;s great for quick experimentation and immediate feedback, you&amp;rsquo;ll likely find yourself saving code into &lt;code&gt;.py&lt;/code&gt; files. However, as your codebase grows, knowing where things should go in your script becomes increasingly important.&lt;/p&gt;
&lt;p&gt;Transitioning from interactive environments to structured scripts helps promote readability, enabling better collaboration and more robust development practices. This video course shows you the foundations of organizing a Python script: where the runnable bits go, how to arrange your imports, and how to refactor with constants and a fixed entry point.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll know how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Make a script &lt;strong&gt;directly executable&lt;/strong&gt; on Unix-like systems with a &lt;strong&gt;shebang line&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Organize your &lt;strong&gt;import statements&lt;/strong&gt; using standard grouping conventions&lt;/li&gt;
&lt;li&gt;Automatically sort imports and format your code with the &lt;strong&gt;&lt;code&gt;ruff&lt;/code&gt;&lt;/strong&gt; linter&lt;/li&gt;
&lt;li&gt;Replace hard-coded values with meaningful &lt;strong&gt;constants&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Define a clear script entry point using &lt;code&gt;if __name__ == &quot;__main__&quot;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Without further ado, it&amp;rsquo;s time to start working through a concrete script and progressively shape it into well-organized, shareable code.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Structuring Your Python Script</title>
      <id>https://realpython.com/quizzes/structuring-your-python-script/</id>
      <link href="https://realpython.com/quizzes/structuring-your-python-script/"/>
      <updated>2026-06-02T12:00:00+00:00</updated>
      <summary>Check your understanding of Python script structure, including shebangs, import order, ruff formatting, constants, and a clean entry point.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of the video course &lt;a href=&quot;https://realpython.com/courses/structuring-your-python-script/&quot;&gt;Structuring Your Python Script&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to make a Python script executable with a shebang, organize your imports per PEP 8, automatically sort imports with &lt;code&gt;ruff&lt;/code&gt;, and define a clear entry point using &lt;code&gt;if __name__ == &quot;__main__&quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;These habits help you transition from quick experiments in the REPL to writing Python scripts that are easy to read, share, and grow.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python sleep(): How to Add Time Delays to Your Code</title>
      <id>https://realpython.com/python-sleep/</id>
      <link href="https://realpython.com/python-sleep/"/>
      <updated>2026-06-01T14:00:00+00:00</updated>
      <summary>Learn how to use Python&#x27;s sleep() function to add time delays and pause your code with time.sleep(), decorators, threads, and asyncio.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Sometimes you need to make Python sleep, wait, or pause before running the next line of code. Whether you’re spacing out &lt;a href=&quot;https://realpython.com/python-api/&quot;&gt;API&lt;/a&gt; requests, pacing a thread, or adding a delay to terminal output, Python’s &lt;code&gt;time.sleep()&lt;/code&gt; function is the standard tool:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Pause execution for 3 seconds&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;Beyond &lt;code&gt;time.sleep()&lt;/code&gt;, Python provides different ways to add time delays depending on the context, including threads, async code, and GUI applications.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;time.sleep()&lt;/code&gt;&lt;/strong&gt; suspends execution for a given number of seconds, including &lt;strong&gt;fractional&lt;/strong&gt; values like milliseconds.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Retry decorators&lt;/strong&gt; use &lt;code&gt;time.sleep()&lt;/code&gt; to add a delay between failed attempts.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;Event.wait()&lt;/code&gt;&lt;/strong&gt; is the preferred way to add delays in &lt;strong&gt;threads&lt;/strong&gt; because it can be interrupted cleanly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;asyncio.sleep()&lt;/code&gt;&lt;/strong&gt; pauses a single &lt;strong&gt;coroutine&lt;/strong&gt; without blocking the rest of your async code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GUI frameworks&lt;/strong&gt; like Tkinter provide scheduling methods such as &lt;code&gt;.after()&lt;/code&gt; to &lt;strong&gt;avoid freezing&lt;/strong&gt; the event loop.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following sections cover each of these approaches with working code examples.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-sleep-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-sleep-code&quot; markdown&gt;Click here to download the free sample code&lt;/a&gt; you’ll use to add time delays to scripts, threads, async code, and GUI apps.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Python time.sleep()” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-sleep/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #ffc873;&quot; alt=&quot;Python sleep(): How to Add Time Delays to Your Code&quot; src=&quot;https://files.realpython.com/media/Python-wait-sleep-time-delays-in-Python_Watermarked.f486144e9c69.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Python-wait-sleep-time-delays-in-Python_Watermarked.f486144e9c69.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Python-wait-sleep-time-delays-in-Python_Watermarked.f486144e9c69.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Python-wait-sleep-time-delays-in-Python_Watermarked.f486144e9c69.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Python-wait-sleep-time-delays-in-Python_Watermarked.f486144e9c69.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-sleep/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python time.sleep()&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;In this quiz, you&#x27;ll revisit how to add time delays to your Python programs.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;pause-execution-with-python-sleep&quot;&gt;Pause Execution With Python &lt;code&gt;sleep()&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#pause-execution-with-python-sleep&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python has built-in support for making your program wait. The &lt;a href=&quot;https://realpython.com/python-time-module/&quot;&gt;&lt;code&gt;time&lt;/code&gt; module&lt;/a&gt; has a &lt;a href=&quot;https://docs.python.org/3/library/time.html#time.sleep&quot;&gt;&lt;code&gt;sleep()&lt;/code&gt;&lt;/a&gt; function that you can use to add a delay by suspending execution of the calling thread for the number of seconds you specify:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; aria-label=&quot;Toggle prompts and output&quot; role=&quot;button&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;time&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Sleep for 3 seconds&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;Here’s a quick example of &lt;code&gt;time.sleep()&lt;/code&gt; in action:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Filename: &lt;/span&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;coffee.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;time&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Brewing coffee...&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;This would take like 3 secs...&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Done! Your coffee is ready!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;If you &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;run this script&lt;/a&gt;, you’ll see a three-second pause between the messages while &lt;code&gt;time.sleep()&lt;/code&gt; suspends execution.&lt;/p&gt;
&lt;p&gt;You can also pass fractional seconds to &lt;code&gt;time.sleep()&lt;/code&gt; for finer-grained durations. Here are some common values:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;time&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Wait 500 milliseconds&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.001&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Wait 1 millisecond&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Wait 1.5 seconds&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Wait 1 minute&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;The &lt;code&gt;time.sleep()&lt;/code&gt; function isn’t perfectly precise. The specified value acts as a &lt;em&gt;minimum&lt;/em&gt; delay. The actual pause will almost always be slightly longer in practice due to operating system scheduler overhead and current system load.&lt;/p&gt;
&lt;p&gt;You can test how long the sleep lasts by using Python’s &lt;a href=&quot;/ref/stdlib/timeit/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;timeit&lt;/code&gt;&lt;/a&gt; module:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; aria-label=&quot;Toggle prompts and output&quot; role=&quot;button&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;timeit&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-n&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;import time; time.sleep(3)&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3 loops, best of 5: 3 sec per loop&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;Here, you run the &lt;code&gt;timeit&lt;/code&gt; module with the &lt;code&gt;-n&lt;/code&gt; parameter, which tells &lt;code&gt;timeit&lt;/code&gt; how many times to run the statement per repeat. With the &lt;a href=&quot;https://docs.python.org/3/library/timeit.html#cmdoption-timeit-r&quot;&gt;default of five repeats&lt;/a&gt;, the statement runs 15 times in total (3 × 5). &lt;code&gt;timeit&lt;/code&gt; then reports the best time across all repeats, which is three seconds per loop, as expected.&lt;/p&gt;
&lt;p&gt;For a more realistic example, say you need to monitor whether a website is up. You want to check its status code periodically, but querying the server too often could overload it or get you rate-limited. You can use &lt;code&gt;time.sleep()&lt;/code&gt; to space out the checks:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Filename: &lt;/span&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;uptime_bot.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;time&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;urllib.request&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;urllib.error&lt;/span&gt;

&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;n&quot;&gt;CHECK_INTERVAL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;60&lt;/span&gt;  &lt;span class=&quot;c1&quot;&gt;# Seconds between checks&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;uptime_bot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;urllib&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;urlopen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;except&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urllib&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;HTTPError&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;# Email admin or log&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;HTTPError: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; for &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;except&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urllib&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;URLError&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;# Email admin or log&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;URLError: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reason&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; for &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;# Website is up&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; is up&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;        &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CHECK_INTERVAL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;vm&quot;&gt;__name__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;__main__&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;https://www.google.com/py&quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;uptime_bot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-sleep/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-sleep/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #297: Improving Python Through PEPs and Protocols</title>
      <id>https://realpython.com/podcasts/rpp/297/</id>
      <link href="https://realpython.com/podcasts/rpp/297/"/>
      <updated>2026-05-29T12:00:00+00:00</updated>
      <summary>Have you ever been confused by the naming of modules you&#x27;re importing from a package? Is there a standard way to organize and name your Python virtual environments? This week on the show, Brett Cannon returns to discuss the Python Enhancement Proposals (PEPs) he&#x27;s been working on recently.</summary>
      <content type="html">
        &lt;p&gt;Have you ever been confused by the naming of modules you&#x27;re importing from a package? Is there a standard way to organize and name your Python virtual environments? This week on the show, Brett Cannon returns to discuss the Python Enhancement Proposals (PEPs) he&#x27;s been working on recently.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Sending Emails With Python</title>
      <id>https://realpython.com/python-send-email/</id>
      <link href="https://realpython.com/python-send-email/"/>
      <updated>2026-05-27T14:00:00+00:00</updated>
      <summary>Learn how to send emails with Python using SMTP, attach files, format HTML messages, and personalize bulk emails for your contact list.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;You probably found this tutorial because you want to send emails with Python to automate confirmation messages, password resets, or scheduled notifications. Python’s standard library covers the whole pipeline, from making a server connection to building the message and sending it to one or many recipients. This tutorial walks through every step in working code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A safe testing setup uses a &lt;strong&gt;throwaway Gmail account&lt;/strong&gt; with an &lt;strong&gt;app password&lt;/strong&gt;, a local &lt;code&gt;aiosmtpd&lt;/code&gt; debug server, or a privacy-focused provider like Posteo or Proton Mail.&lt;/li&gt;
&lt;li&gt;A secure SMTP session uses &lt;code&gt;.SMTP_SSL()&lt;/code&gt; with &lt;code&gt;ssl.create_default_context()&lt;/code&gt;, which &lt;strong&gt;validates the server certificate&lt;/strong&gt; and &lt;strong&gt;encrypts&lt;/strong&gt; your credentials and message content.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;EmailMessage&lt;/code&gt; class from the &lt;code&gt;email&lt;/code&gt; package assembles &lt;strong&gt;plain text&lt;/strong&gt;, &lt;strong&gt;HTML alternatives&lt;/strong&gt;, &lt;strong&gt;file attachments&lt;/strong&gt;, and &lt;strong&gt;personalized fields&lt;/strong&gt; through &lt;code&gt;.set_content()&lt;/code&gt;, &lt;code&gt;.add_alternative()&lt;/code&gt;, and &lt;code&gt;.add_attachment()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Setting &lt;code&gt;msg[&quot;reply-to&quot;]&lt;/code&gt; or any other RFC 5322 header on an &lt;code&gt;EmailMessage&lt;/code&gt; routes &lt;strong&gt;replies&lt;/strong&gt; to a different mailbox than the sender address.&lt;/li&gt;
&lt;li&gt;For high-volume sending, &lt;strong&gt;transactional email services&lt;/strong&gt; like SendGrid, Mailgun, and Brevo provide deliverability, statistics, and &lt;strong&gt;API libraries&lt;/strong&gt; that go beyond what &lt;code&gt;smtplib&lt;/code&gt; alone offers.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Before you jump into the code, you’ll set up a throwaway email account or a local debug server so you can experiment freely without spamming real inboxes.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-send-email-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-send-email-code&quot; markdown&gt;Click here to download the free sample code&lt;/a&gt; you’ll use to learn how to send plain-text and HTML emails, attach files, and automate email delivery with Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Sending Emails With Python” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-send-email-update/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #ffc873;&quot; alt=&quot;Sending Emails With Python&quot; src=&quot;https://files.realpython.com/media/Sending-Emails-With-Python_Watermarked.6fee62c5f3b9.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Sending-Emails-With-Python_Watermarked.6fee62c5f3b9.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Sending-Emails-With-Python_Watermarked.6fee62c5f3b9.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Sending-Emails-With-Python_Watermarked.6fee62c5f3b9.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Sending-Emails-With-Python_Watermarked.6fee62c5f3b9.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-send-email-update/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Sending Emails With Python&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Use Python&#x27;s standard library to send email through secure SMTP connections, attach files, include HTML content, and route replies.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;setting-up-an-email-service&quot;&gt;Setting Up an Email Service&lt;a class=&quot;headerlink&quot; href=&quot;#setting-up-an-email-service&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Email is sent from a client to an email server, and from one email server to another, using the Simple Mail Transfer Protocol, or SMTP, defined under &lt;a href=&quot;https://tools.ietf.org/html/rfc821&quot;&gt;RFC 821&lt;/a&gt;. Python comes with the built-in &lt;a href=&quot;https://docs.python.org/3/library/smtplib.html&quot;&gt;&lt;code&gt;smtplib&lt;/code&gt;&lt;/a&gt; &lt;a href=&quot;/ref/glossary/module/&quot; class=&quot;ref-link&quot;&gt;module&lt;/a&gt;, which implements this protocol, allowing you to programmatically send email through any accessible email server.&lt;/p&gt;
&lt;p&gt;While you can certainly use your own email account for this tutorial, it’s recommended that you set up a throwaway email account instead. There are several free and paid email services you can use. In this tutorial, you’ll explore the following options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Setting up a Gmail account for development:&lt;/strong&gt; You’ll learn how to create a dedicated testing account and use app passwords to satisfy modern security requirements.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Setting up a local SMTP server:&lt;/strong&gt; You’ll use the &lt;code&gt;aiosmtpd&lt;/code&gt; library to run a server on your own machine, allowing you to inspect email content without sending any live messages.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Setting up other email accounts for development:&lt;/strong&gt; You’ll see how to connect to alternative services like Posteo or Proton Mail to ensure your code works across different providers.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Understanding the distinction between secure (encrypted) and insecure (unencrypted) connections is vital. Most modern providers require encryption via SSL or TLS to protect your data, while the local debugging server uses no encryption. By the end of this section, you’ll know how to choose the right connection type for your specific service choice.&lt;/p&gt;
&lt;h3 id=&quot;setting-up-a-gmail-account-for-development&quot;&gt;Setting Up a Gmail Account for Development&lt;a class=&quot;headerlink&quot; href=&quot;#setting-up-a-gmail-account-for-development&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To set up a Gmail account for testing your code, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://accounts.google.com/signup&quot;&gt;Create a new Google account&lt;/a&gt;. You need to provide a name, a birthday, and a unique username for the account.&lt;/li&gt;
&lt;li&gt;Set up &lt;a href=&quot;https://myaccount.google.com/signinoptions/twosv&quot;&gt;two-factor authentication&lt;/a&gt; for the new account.&lt;/li&gt;
&lt;li&gt;Add a &lt;a href=&quot;https://myaccount.google.com/apppasswords&quot;&gt;new app password&lt;/a&gt; to allow password sign-ins to the account.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;An app password is a temporary password generated by Google. Instead of using your main account password to authenticate with your username, you use the app password. You can delete and recreate app passwords whenever you like.&lt;/p&gt;
&lt;p&gt;App passwords allow access to Gmail when modern security measures like OAuth2 aren’t available. When creating one, make sure you copy it to a secure location, as you won’t be able to review it after leaving the page.&lt;/p&gt;
&lt;p&gt;If you don’t want to use an app password, check out &lt;a href=&quot;https://developers.google.com/workspace/gmail/api/quickstart/python&quot;&gt;Google’s documentation&lt;/a&gt; on how to obtain access credentials for your Python script using the OAuth2 authorization framework.&lt;/p&gt;
&lt;p&gt;A nice feature of Gmail is that you can use the &lt;code&gt;+&lt;/code&gt; sign to add modifiers to your email address right before the &lt;code&gt;@&lt;/code&gt; sign. For example, emails sent to &lt;code&gt;my+person1@gmail.com&lt;/code&gt; and &lt;code&gt;my+person2@gmail.com&lt;/code&gt; will both arrive at &lt;code&gt;my@gmail.com&lt;/code&gt;. When testing email functionality, you can use this to simulate multiple addresses that all point to the same inbox.&lt;/p&gt;
&lt;h3 id=&quot;setting-up-a-local-smtp-server&quot;&gt;Setting Up a Local SMTP Server&lt;a class=&quot;headerlink&quot; href=&quot;#setting-up-a-local-smtp-server&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can test email functionality by running a local Simple Mail Transfer Protocol (SMTP) debugging server with the &lt;a href=&quot;https://pypi.org/project/aiosmtpd/&quot;&gt;&lt;code&gt;aiosmtpd&lt;/code&gt;&lt;/a&gt; module. Rather than sending emails to a specific address, the local debug server discards the message after printing its content to the console. Running a local debugging server makes it unnecessary to deal with encryption of messages or use credentials to log in to an email server.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;aiosmtpd&lt;/code&gt; is a third-party library that replaces the former built-in &lt;code&gt;smtpd&lt;/code&gt; module, which was initially deprecated in Python 3.4.7. Deprecation notices were repeated in 3.5.4 and 3.6.1, and the module was eventually &lt;a href=&quot;https://docs.python.org/3/whatsnew/3.12.html#whatsnew312-removed&quot;&gt;removed in Python 3.12&lt;/a&gt;, as outlined in &lt;a href=&quot;https://peps.python.org/pep-0594/&quot;&gt;PEP 594&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Install the &lt;code&gt;aiosmtpd&lt;/code&gt; module with the following command:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; aria-label=&quot;Toggle prompts and output&quot; role=&quot;button&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;aiosmtpd
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;Then, start a local SMTP debugging server with this command:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; aria-label=&quot;Toggle prompts and output&quot; role=&quot;button&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;aiosmtpd&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-n
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-send-email/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-send-email/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Connecting LLMs to Your Data With Python MCP Servers</title>
      <id>https://realpython.com/courses/connecting-llms-data-python-mcp-servers/</id>
      <link href="https://realpython.com/courses/connecting-llms-data-python-mcp-servers/"/>
      <updated>2026-05-26T14:00:00+00:00</updated>
      <summary>Build an MCP server in Python that exposes tools, resources, and prompts so AI agents like Cursor can interact with your data.</summary>
      <content type="html">
        &lt;p&gt;The Model Context Protocol (MCP) is a new open protocol that allows AI models to interact with external systems in a standardized, extensible way. In this video course, you&amp;rsquo;ll install MCP, explore its client-server architecture, and work with its core concepts: prompts, resources, and tools. You&amp;rsquo;ll then build and test a Python MCP server that queries e-commerce data and integrate it with an AI agent in Cursor to see real tool calls in action.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll understand:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;strong&gt;MCP&lt;/strong&gt; is and why it was created&lt;/li&gt;
&lt;li&gt;What MCP &lt;strong&gt;prompts&lt;/strong&gt;, &lt;strong&gt;resources&lt;/strong&gt;, and &lt;strong&gt;tools&lt;/strong&gt; are&lt;/li&gt;
&lt;li&gt;How to build an &lt;strong&gt;MCP server&lt;/strong&gt; with customized tools&lt;/li&gt;
&lt;li&gt;How to integrate your MCP server with &lt;strong&gt;AI agents&lt;/strong&gt; like &lt;strong&gt;Cursor&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll get hands-on experience with Python MCP by creating and testing MCP servers and connecting your MCP to AI tools. To keep the focus on learning MCP rather than building a complex project, you&amp;rsquo;ll build a simple MCP server that interacts with a simulated e-commerce database. You&amp;rsquo;ll also use Cursor&amp;rsquo;s MCP client, which saves you from having to implement your own.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>How to Make a Scatter Plot in Python With plt.scatter()</title>
      <id>https://realpython.com/visualizing-python-plt-scatter/</id>
      <link href="https://realpython.com/visualizing-python-plt-scatter/"/>
      <updated>2026-05-25T14:00:00+00:00</updated>
      <summary>Learn how to make scatter plots in Python with plt.scatter() and customize markers by size, color, shape, and transparency.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Visualizing data is a core part of analysis, and Python’s most popular plotting library is &lt;strong&gt;Matplotlib&lt;/strong&gt;. To &lt;strong&gt;make a scatter plot&lt;/strong&gt;, you reach for &lt;strong&gt;&lt;code&gt;plt.scatter()&lt;/code&gt;&lt;/strong&gt; from Matplotlib’s &lt;strong&gt;&lt;code&gt;pyplot&lt;/code&gt;&lt;/strong&gt; submodule, conventionally aliased as &lt;strong&gt;&lt;code&gt;plt&lt;/code&gt;&lt;/strong&gt;. You’ll use it to build both simple two-variable charts and richly customized plots that encode several variables at once.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A scatter plot is created by calling &lt;code&gt;plt.scatter()&lt;/code&gt; with two &lt;strong&gt;array-like sequences&lt;/strong&gt; for the x and y values.&lt;/li&gt;
&lt;li&gt;Marker &lt;strong&gt;size&lt;/strong&gt;, &lt;strong&gt;color&lt;/strong&gt;, &lt;strong&gt;shape&lt;/strong&gt;, and &lt;strong&gt;transparency&lt;/strong&gt; are controlled by the &lt;code&gt;s&lt;/code&gt;, &lt;code&gt;c&lt;/code&gt;, &lt;code&gt;marker&lt;/code&gt;, and &lt;code&gt;alpha&lt;/code&gt; parameters.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;plt.scatter()&lt;/code&gt; enables &lt;strong&gt;per-point customization&lt;/strong&gt; like variable size or color, while &lt;code&gt;plt.plot()&lt;/code&gt; with marker arguments runs &lt;strong&gt;faster&lt;/strong&gt; for basic plots.&lt;/li&gt;
&lt;li&gt;A single scatter plot can represent &lt;strong&gt;more than two variables&lt;/strong&gt; by mapping extra dimensions to &lt;strong&gt;marker properties&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Matplotlib’s &lt;strong&gt;plot styles&lt;/strong&gt;, listed in &lt;code&gt;plt.style.available&lt;/code&gt;, are applied with &lt;code&gt;plt.style.use()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should be familiar with the &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;fundamentals of Python programming&lt;/a&gt; and the basics of &lt;a href=&quot;https://realpython.com/numpy-tutorial/&quot;&gt;NumPy&lt;/a&gt; and its &lt;code&gt;ndarray&lt;/code&gt; object. You don’t need to be familiar with Matplotlib to follow this tutorial, but if you’d like to learn more about the module, then check out &lt;a href=&quot;https://realpython.com/python-matplotlib-guide/&quot;&gt;Python Plotting With Matplotlib (Guide)&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/visualizing-python-plt-scatter-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-visualizing-python-plt-scatter-code&quot; markdown&gt;Click here to download the free sample code&lt;/a&gt; you’ll use to build customized scatter plots in Python with plt.scatter().&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “How to Make a Scatter Plot in Python With plt.scatter()” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/visualizing-python-plt-scatter/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #ffc873;&quot; alt=&quot;Visualizing Data in Python Using plt.scatter()&quot; src=&quot;https://files.realpython.com/media/How-to-Use-plt.scatter_Watermarked.a2f94b29f841.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/How-to-Use-plt.scatter_Watermarked.a2f94b29f841.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/How-to-Use-plt.scatter_Watermarked.a2f94b29f841.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/How-to-Use-plt.scatter_Watermarked.a2f94b29f841.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/How-to-Use-plt.scatter_Watermarked.a2f94b29f841.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/visualizing-python-plt-scatter/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;How to Make a Scatter Plot in Python With plt.scatter()&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Practice using plt.scatter() in Python to create scatter plots and encode multiple variables with marker size, color, shape, and transparency.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;how-to-make-a-scatter-plot-in-python&quot;&gt;How to Make a Scatter Plot in Python&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-make-a-scatter-plot-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A &lt;a href=&quot;https://en.wikipedia.org/wiki/Scatter_plot&quot;&gt;scatter plot&lt;/a&gt; is a visual representation of how two &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt; relate to each other. You can use scatter plots to explore the relationship between two variables, for example by looking for any correlation between them.&lt;/p&gt;
&lt;p&gt;In this section of the tutorial, you’ll become familiar with creating basic scatter plots using Matplotlib. In later sections, you’ll learn how to further customize your plots to represent more complex data using more than two dimensions.&lt;/p&gt;
&lt;h3 id=&quot;getting-started-with-pltscatter&quot;&gt;Getting Started With &lt;code&gt;plt.scatter()&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-pltscatter&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Before you can start working with &lt;a href=&quot;https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.scatter.html&quot;&gt;&lt;code&gt;plt.scatter()&lt;/code&gt;&lt;/a&gt;, you’ll need to install Matplotlib. You can do so using Python’s standard package manager, &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;, by running the following command in the console:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; aria-label=&quot;Toggle prompts and output&quot; role=&quot;button&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;matplotlib
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;Now that you have Matplotlib installed, consider the following use case. A café sells six different types of bottled orange drinks. The owner wants to understand the relationship between the price of the drinks and his daily sales, so he keeps track of how many of each drink he sells every day. You can visualize this relationship as follows:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;matplotlib.pyplot&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;as&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;plt&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;price&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;2.50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.23&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;4.02&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;3.25&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;5.00&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;4.40&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sales_per_day&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;62&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;49&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;19&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scatter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sales_per_day&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;In this Python script, you &lt;a href=&quot;https://realpython.com/python-import/&quot;&gt;import&lt;/a&gt; the &lt;code&gt;pyplot&lt;/code&gt; submodule from Matplotlib using the alias &lt;code&gt;plt&lt;/code&gt;. This alias is generally used by convention to shorten the module and submodule names. You then create &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;lists&lt;/a&gt; with the price and average sales per day for each of the six orange drinks sold.&lt;/p&gt;
&lt;p&gt;Finally, you create the scatter plot by using &lt;code&gt;plt.scatter()&lt;/code&gt; with the two variables you wish to compare as input arguments. As you’re using a Python script, you also need to explicitly display the figure by using &lt;code&gt;plt.show()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;When you’re using an interactive environment, such as a console or a &lt;a href=&quot;https://realpython.com/jupyter-notebook-introduction/&quot;&gt;Jupyter Notebook&lt;/a&gt;, you don’t need to call &lt;code&gt;plt.show()&lt;/code&gt;. All examples in this tutorial are scripts and include the call to &lt;code&gt;plt.show()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Here’s the output from this code:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/scatter_plot_drinks_1.db41b7631bc5.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-75&quot; src=&quot;https://files.realpython.com/media/scatter_plot_drinks_1.db41b7631bc5.png&quot; width=&quot;1280&quot; height=&quot;960&quot; srcset=&quot;/cdn-cgi/image/width=320,format=auto/https://files.realpython.com/media/scatter_plot_drinks_1.db41b7631bc5.png 320w, /cdn-cgi/image/width=426,format=auto/https://files.realpython.com/media/scatter_plot_drinks_1.db41b7631bc5.png 426w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/scatter_plot_drinks_1.db41b7631bc5.png 640w, /cdn-cgi/image/width=1280,format=auto/https://files.realpython.com/media/scatter_plot_drinks_1.db41b7631bc5.png 1280w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Scatter Plot Part 1&quot; data-asset=&quot;3544&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;This plot shows that, in general, the more expensive a drink is, the fewer items are sold. However, the drink that costs $4.02 is an outlier, suggesting that it’s a particularly popular product. When using scatter plots in this way, close inspection can help you explore the relationship between variables. You can then carry out further analysis, whether it’s using &lt;a href=&quot;https://realpython.com/linear-regression-in-python/&quot;&gt;linear regression&lt;/a&gt; or other techniques.&lt;/p&gt;
&lt;h3 id=&quot;comparing-pltscatter-and-pltplot&quot;&gt;Comparing &lt;code&gt;plt.scatter()&lt;/code&gt; and &lt;code&gt;plt.plot()&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#comparing-pltscatter-and-pltplot&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can also produce the scatter plot shown above using another function within &lt;code&gt;matplotlib.pyplot&lt;/code&gt;. Matplotlib’s &lt;a href=&quot;https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.plot.html&quot;&gt;&lt;code&gt;plt.plot()&lt;/code&gt;&lt;/a&gt; is a general-purpose plotting function that will allow you to create various line or marker plots.&lt;/p&gt;
&lt;p&gt;You can achieve the same scatter plot as the one you obtained in the section above with the following call to &lt;code&gt;plt.plot()&lt;/code&gt;, using the same data:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;plot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sales_per_day&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;o&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;In this case, you had to include the marker &lt;code&gt;&quot;o&quot;&lt;/code&gt; as a third argument because otherwise, &lt;code&gt;plt.plot()&lt;/code&gt; would plot a line graph. The plot you created with this code is identical to the plot you created earlier with &lt;code&gt;plt.scatter()&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/visualizing-python-plt-scatter/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/visualizing-python-plt-scatter/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #296: Managing Polars Schema Issues &amp; Profiling GitHub Users</title>
      <id>https://realpython.com/podcasts/rpp/296/</id>
      <link href="https://realpython.com/podcasts/rpp/296/"/>
      <updated>2026-05-22T12:00:00+00:00</updated>
      <summary>How can you avoid schema problems in your Polars data pipeline when adding new columns? How can you quickly examine a GitHub user&#x27;s profile to decide how much to invest in their contributions? Christopher Trudeau is back on the show this week with another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;How can you avoid schema problems in your Polars data pipeline when adding new columns? How can you quickly examine a GitHub user&#x27;s profile to decide how much to invest in their contributions? Christopher Trudeau is back on the show this week with another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>How to Use the Claude API in Python</title>
      <id>https://realpython.com/claude-api-python/</id>
      <link href="https://realpython.com/claude-api-python/"/>
      <updated>2026-05-20T14:00:00+00:00</updated>
      <summary>Learn how to use the Claude API in Python to send prompts, control responses with system instructions, and get structured JSON output.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The fastest way to use the Claude API in Python is to install &lt;code&gt;anthropic&lt;/code&gt;, set your API key, and call &lt;code&gt;client.messages.create()&lt;/code&gt;. You’ll have a working response in under a minute:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/How_to_Use_the_Claude_API_in_Python_for_AI-Powered_Applications_-_screenshot.019ec0681f37.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/How_to_Use_the_Claude_API_in_Python_for_AI-Powered_Applications_-_screenshot.019ec0681f37.png&quot; width=&quot;1822&quot; height=&quot;1320&quot; srcset=&quot;/cdn-cgi/image/width=455,format=auto/https://files.realpython.com/media/How_to_Use_the_Claude_API_in_Python_for_AI-Powered_Applications_-_screenshot.019ec0681f37.png 455w, /cdn-cgi/image/width=607,format=auto/https://files.realpython.com/media/How_to_Use_the_Claude_API_in_Python_for_AI-Powered_Applications_-_screenshot.019ec0681f37.png 607w, /cdn-cgi/image/width=911,format=auto/https://files.realpython.com/media/How_to_Use_the_Claude_API_in_Python_for_AI-Powered_Applications_-_screenshot.019ec0681f37.png 911w, /cdn-cgi/image/width=1822,format=auto/https://files.realpython.com/media/How_to_Use_the_Claude_API_in_Python_for_AI-Powered_Applications_-_screenshot.019ec0681f37.png 1822w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;How to Use the Claude API in Python for AI-Powered Applications&quot; data-asset=&quot;6887&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Example of Using the Claude API in Python&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;&lt;a href=&quot;/ref/ai-coding-tools/claude/&quot; class=&quot;ref-link&quot;&gt;Claude&lt;/a&gt; is Anthropic’s &lt;a href=&quot;/ref/ai-coding-glossary/llm/&quot; class=&quot;ref-link&quot;&gt;large language model&lt;/a&gt;, accessible via a clean &lt;a href=&quot;https://realpython.com/api-integration-in-python/&quot;&gt;REST API&lt;/a&gt; with an official Python SDK. Unlike heavier AI frameworks that require you to wire up multiple components before you see any output, the &lt;code&gt;anthropic&lt;/code&gt; package gets you to a working response in a handful of lines.&lt;/p&gt;
&lt;p&gt;In the following steps, you’ll install the &lt;code&gt;anthropic&lt;/code&gt; SDK, call Claude from Python, shape Claude’s behavior with a &lt;a href=&quot;/ref/ai-coding-glossary/system-prompt/&quot; class=&quot;ref-link&quot;&gt;system prompt&lt;/a&gt;, and then return structured &lt;a href=&quot;https://realpython.com/python-json/&quot;&gt;JSON&lt;/a&gt; output using a schema or &lt;a href=&quot;https://realpython.com/python-pydantic/&quot;&gt;Pydantic&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Claude’s responses are non-deterministic, so the same prompt produces different output each time, which is expected for a large language model. Also, API calls cost money based on the number of &lt;a href=&quot;/ref/ai-coding-glossary/token/&quot; class=&quot;ref-link&quot;&gt;tokens&lt;/a&gt; processed. Keep an eye on your usage in the Claude Console as you follow along.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Each step builds on the last, and the final script is short enough to read in one sitting but complete enough to extend into a real application of your own.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/claude-api-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-claude-api-python-code&quot; markdown&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to use the Claude API in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “How to Use the Claude API in Python” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/claude-api-python/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #abe5b2;&quot; alt=&quot;Two people at a service counter labeled Claude API, where a robot behind the window prints out a long paper response, with a Python logo on the counter.&quot; src=&quot;https://files.realpython.com/media/How-to-Use-the-Claude-API-in-Python-for-AI-Powered-Applications_Watermarked.2bd1f7ed4e48.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/How-to-Use-the-Claude-API-in-Python-for-AI-Powered-Applications_Watermarked.2bd1f7ed4e48.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/How-to-Use-the-Claude-API-in-Python-for-AI-Powered-Applications_Watermarked.2bd1f7ed4e48.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/How-to-Use-the-Claude-API-in-Python-for-AI-Powered-Applications_Watermarked.2bd1f7ed4e48.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/How-to-Use-the-Claude-API-in-Python-for-AI-Powered-Applications_Watermarked.2bd1f7ed4e48.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/claude-api-python/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;How to Use the Claude API in Python&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Test your understanding of using the Claude API in Python. Send prompts, set system instructions, and return structured JSON with a schema.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before diving in, make sure you have the following in place:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Python knowledge:&lt;/strong&gt; You should be comfortable with Python basics, like &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;defining functions&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;running scripts&lt;/a&gt; from the terminal, and working with &lt;a href=&quot;/ref/glossary/virtual-environment/&quot; class=&quot;ref-link&quot;&gt;virtual environments&lt;/a&gt;. If virtual environments are new to you, &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;Python Virtual Environments: A Primer&lt;/a&gt; has you covered before you continue.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Python 3.9 or higher:&lt;/strong&gt; The &lt;code&gt;anthropic&lt;/code&gt; SDK requires Python 3.9 as a minimum. If you’re not sure which version you have, run &lt;code&gt;python --version&lt;/code&gt; in your terminal. If you need to install or upgrade, follow the steps in the &lt;a href=&quot;https://realpython.com/installing-python/&quot;&gt;guide on installing Python&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;An Anthropic account:&lt;/strong&gt; You’ll need an Anthropic account to generate an API key in the Claude Console. Step 1 will show you how to find and secure your key once you’re in.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Don’t worry if you’ve never worked with an &lt;a href=&quot;/ref/glossary/api/&quot; class=&quot;ref-link&quot;&gt;API&lt;/a&gt; before. This tutorial will walk you through authentication and help you make your first request from scratch.&lt;/p&gt;
&lt;h2 id=&quot;step-1-set-up-the-claude-api-in-python&quot;&gt;Step 1: Set Up the Claude API in Python&lt;a class=&quot;headerlink&quot; href=&quot;#step-1-set-up-the-claude-api-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before you can call Claude from Python, you need an API key and the &lt;code&gt;anthropic&lt;/code&gt; package installed. By the end of this step, you’ll have both, and Claude will be responding to your first prompt.&lt;/p&gt;
&lt;h3 id=&quot;get-your-api-key-and-install-anthropic&quot;&gt;Get Your API Key and Install &lt;code&gt;anthropic&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#get-your-api-key-and-install-anthropic&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Log in to the &lt;a href=&quot;https://console.anthropic.com/&quot;&gt;Claude Console&lt;/a&gt; or create a new account. If you’re starting fresh, you can begin using the API after adding $5 of credits.&lt;/p&gt;
&lt;p&gt;Then navigate to the API Keys section. Click &lt;em&gt;Create Key&lt;/em&gt;, give it a descriptive name like &lt;code&gt;real-python-tutorial&lt;/code&gt;, and copy it immediately. You won’t see it again after you close the dialog.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Never paste your API key directly into your code. Instead, store it as an &lt;a href=&quot;/ref/stdlib/os/&quot; class=&quot;ref-link&quot;&gt;environment variable&lt;/a&gt;. The &lt;code&gt;anthropic&lt;/code&gt; SDK automatically reads it from &lt;code&gt;ANTHROPIC_API_KEY&lt;/code&gt; at runtime, so you never need to reference it explicitly in your scripts.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Storing your key as an environment variable means it never touches your source code or version control history. The exact command depends on your operating system:&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-windows&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body active small&quot; id=&quot;windows-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#windows-1&quot; role=&quot;tab&quot; aria-controls=&quot;windows-1&quot; aria-selected=&quot;true&quot;&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Windows&lt;/a&gt;
  &lt;/li&gt;




  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-linuxmacos&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body small&quot; id=&quot;macos-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#linux-macos-1&quot; role=&quot;tab&quot; aria-controls=&quot;linux-macos-1&quot; aria-selected=&quot;false&quot;&gt;&lt;span class=&quot;icon baseline text-muted&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#v4--apple&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Linux + macOS&lt;/a&gt;
  &lt;/li&gt;

&lt;/ul&gt;
&lt;div class=&quot;tab-content mt-2 mb-0 js-platform-widget-content&quot;&gt;
&lt;div aria-labelledby=&quot;windows-tab-1&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;powershell&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;PowerShell Script&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;PS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$env:ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;your-api-key-here&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; aria-label=&quot;Toggle prompts and output&quot; role=&quot;button&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;your-api-key-here&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;With your API key stored safely, you’re ready to install the SDK. Create a fresh virtual environment and activate it before installing anything. This isolation prevents the &lt;code&gt;anthropic&lt;/code&gt; package from conflicting with your system-level tools.&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-windows&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body active small&quot; id=&quot;windows-tab-2&quot; data-toggle=&quot;tab&quot; href=&quot;#windows-2&quot; role=&quot;tab&quot; aria-controls=&quot;windows-2&quot; aria-selected=&quot;true&quot;&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Windows&lt;/a&gt;
  &lt;/li&gt;




  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-linuxmacos&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body small&quot; id=&quot;macos-tab-2&quot; data-toggle=&quot;tab&quot; href=&quot;#linux-macos-2&quot; role=&quot;tab&quot; aria-controls=&quot;linux-macos-2&quot; aria-selected=&quot;false&quot;&gt;&lt;span class=&quot;icon baseline text-muted&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#v4--apple&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Linux + macOS&lt;/a&gt;
  &lt;/li&gt;

&lt;/ul&gt;
&lt;div class=&quot;tab-content mt-2 mb-0 js-platform-widget-content&quot;&gt;
&lt;div aria-labelledby=&quot;windows-tab-2&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-2&quot; role=&quot;tabpanel&quot;&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;powershell&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;PowerShell Script&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;PS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;PS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Scripts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;activate&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pip&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;anthropic&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-2&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-2&quot; role=&quot;tabpanel&quot;&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; aria-label=&quot;Toggle prompts and output&quot; role=&quot;button&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv/
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv/bin/activate
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;anthropic
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&quot;send-your-first-prompt&quot;&gt;Send Your First Prompt&lt;a class=&quot;headerlink&quot; href=&quot;#send-your-first-prompt&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/claude-api-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/claude-api-python/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Tapping Into the Zen of Python</title>
      <id>https://realpython.com/courses/tapping-into-the-zen-of-python/</id>
      <link href="https://realpython.com/courses/tapping-into-the-zen-of-python/"/>
      <updated>2026-05-19T14:00:00+00:00</updated>
      <summary>Explore the Zen of Python and its 19 guiding principles for writing readable, practical code. Learn its history, jokes, and meaning.</summary>
      <content type="html">
        &lt;p&gt;The &lt;strong&gt;Zen of Python&lt;/strong&gt; is a collection of 19 aphorisms that capture the guiding principles behind Python&amp;rsquo;s design. You can display them anytime by running &lt;code&gt;import this&lt;/code&gt; in a Python REPL. Tim Peters wrote them in 1999 as a joke, but they became an iconic part of Python culture that was even formalized as &lt;a href=&quot;/ref/glossary/pep/&quot; class=&quot;ref-link&quot;&gt;PEP&lt;/a&gt; 20.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll understand:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The Zen of Python is a &lt;strong&gt;humorous poem&lt;/strong&gt; of 19 aphorisms describing Python&amp;rsquo;s design philosophy&lt;/li&gt;
&lt;li&gt;Running &lt;code&gt;import this&lt;/code&gt; in a Python &lt;a href=&quot;/ref/glossary/interpreter/&quot; class=&quot;ref-link&quot;&gt;interpreter&lt;/a&gt; displays the &lt;strong&gt;complete text&lt;/strong&gt; of the Zen of Python&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tim Peters&lt;/strong&gt; wrote the Zen of Python in 1999 as a tongue-in-cheek comment on a mailing list&lt;/li&gt;
&lt;li&gt;The aphorisms are &lt;strong&gt;guidelines, not strict rules&lt;/strong&gt;, and some intentionally contradict each other&lt;/li&gt;
&lt;li&gt;The principles promote &lt;strong&gt;readability, simplicity, and explicitness&lt;/strong&gt; while acknowledging that practicality matters&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Experienced Pythonistas often refer to the Zen of Python as a source of wisdom and guidance, especially when they want to settle an argument about certain design decisions in a piece of code. In this video course, you&amp;rsquo;ll explore the origins of the Zen of Python, learn how to interpret its mysterious aphorisms, and discover the Easter eggs hidden within it.&lt;/p&gt;
&lt;p&gt;You don&amp;rsquo;t need to be a Python master to understand the Zen of Python! But you do need to answer an important question: &lt;strong&gt;What exactly is the Zen of Python?&lt;/strong&gt;&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Built-in Functions: A Complete Guide</title>
      <id>https://realpython.com/python-built-in-functions/</id>
      <link href="https://realpython.com/python-built-in-functions/"/>
      <updated>2026-05-18T14:00:00+00:00</updated>
      <summary>Use Python&#x27;s built-in functions for math, data types, iterables, and I/O to write shorter, more Pythonic code.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;strong&gt;built-in functions&lt;/strong&gt; are predefined functions you can use anywhere in your code without any imports. They handle common tasks across math, data type creation, iterable processing, and input and output. Knowing which ones to reach for makes your code shorter and more &lt;strong&gt;Pythonic&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Recognize Python’s &lt;strong&gt;built-in functions&lt;/strong&gt; and the &lt;strong&gt;built-in scope&lt;/strong&gt; they live in&lt;/li&gt;
&lt;li&gt;Use the right built-in for &lt;strong&gt;math&lt;/strong&gt;, &lt;strong&gt;data types&lt;/strong&gt;, &lt;strong&gt;iterables&lt;/strong&gt;, and &lt;strong&gt;I/O&lt;/strong&gt; tasks&lt;/li&gt;
&lt;li&gt;Tell apart true functions and &lt;strong&gt;classes&lt;/strong&gt; that look like functions&lt;/li&gt;
&lt;li&gt;Apply built-ins to solve &lt;strong&gt;practical problems&lt;/strong&gt; without reinventing the wheel&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you’ll need to be familiar with Python programming, including topics like working with built-in &lt;a href=&quot;https://realpython.com/python-data-types/&quot;&gt;data types&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/primer-on-python-decorators/&quot;&gt;decorators&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-scope-legb-rule/&quot;&gt;scopes&lt;/a&gt;, and the &lt;a href=&quot;https://realpython.com/python-import/&quot;&gt;import&lt;/a&gt; system.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-built-in-functions-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-built-in-functions-code&quot; markdown&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to use Python’s built-in functions.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Get the PDF Guide:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-built-in-functions-cheatsheet/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-built-in-functions-cheatsheet&quot; markdown&gt;Click here to download&lt;/a&gt; a free PDF guide that gives you a complete overview of Python’s built-in functions and how to use them.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Python Built-in Functions: A Complete Guide” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-built-in-functions/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #ff7e74;&quot; alt=&quot;Python&#x27;s Built-in Functions: A Complete Exploration&quot; src=&quot;https://files.realpython.com/media/Pythons-Built-in-Functions-A-Quick-Exploration_Watermarked.44a8e102943b.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Pythons-Built-in-Functions-A-Quick-Exploration_Watermarked.44a8e102943b.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Pythons-Built-in-Functions-A-Quick-Exploration_Watermarked.44a8e102943b.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Pythons-Built-in-Functions-A-Quick-Exploration_Watermarked.44a8e102943b.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Pythons-Built-in-Functions-A-Quick-Exploration_Watermarked.44a8e102943b.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-built-in-functions/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python Built-in Functions: A Complete Guide&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Test your understanding of Python&#x27;s built-in functions for math, data types, iterables, and I/O—and when to reach for each one.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;built-in-functions-in-python&quot;&gt;Built-in Functions in Python&lt;a class=&quot;headerlink&quot; href=&quot;#built-in-functions-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python has several &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt; available for you to use directly from anywhere in your code. These functions are known as &lt;a href=&quot;https://docs.python.org/3/library/functions.html&quot;&gt;built-in functions&lt;/a&gt; and they cover many common programming problems, from mathematical computations to Python-specific features.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; All these functions live in the &lt;a href=&quot;https://docs.python.org/3/library/builtins.html&quot;&gt;&lt;code&gt;builtins&lt;/code&gt;&lt;/a&gt; module, which Python loads at startup and exposes through the built-in scope, so you can use them anywhere without importing the module. Importing the module explicitly is useful if you know that you’ll shadow a built-in name with one of your own variables or functions. Doing so keeps the original within reach as &lt;code&gt;builtins.name&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Among these built-ins, you’ll also find classes with function-style names like &lt;a href=&quot;/ref/builtin-types/str/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;str&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;/ref/builtin-types/tuple/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;tuple&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;/ref/builtin-types/list/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;list&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;/ref/builtin-types/dict/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;dict&lt;/code&gt;&lt;/a&gt;, which define built-in data types. These classes are listed in the Python documentation as &lt;em&gt;built-in functions&lt;/em&gt;, so they’re covered in this tutorial too.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In this tutorial, you’ll learn the basics of Python’s built-in functions. By the end, you’ll know what their use cases are and how they work. You’ll start with the built-in functions for math computations.&lt;/p&gt;
&lt;h2 id=&quot;using-math-related-built-in-functions&quot;&gt;Using Math-Related Built-in Functions&lt;a class=&quot;headerlink&quot; href=&quot;#using-math-related-built-in-functions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Python, you’ll find a few built-in functions that take care of common math operations, like computing the absolute value of a &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;number&lt;/a&gt;, calculating powers, and more. Here’s a summary of the math-related built-in functions in Python:&lt;/p&gt;
&lt;div class=&quot;table-responsive&quot;&gt;
&lt;table class=&quot;table table-hover&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Function&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;https://realpython.com/python-absolute-value/&quot;&gt;&lt;code&gt;abs()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Calculates the absolute value of a number&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;https://docs.python.org/3/library/functions.html#divmod&quot;&gt;&lt;code&gt;divmod()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Computes the quotient and remainder of integer division&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;https://realpython.com/python-min-and-max/&quot;&gt;&lt;code&gt;max()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Finds the largest of the given arguments or items in an iterable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;https://realpython.com/python-min-and-max/&quot;&gt;&lt;code&gt;min()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Finds the smallest of the given arguments or items in an iterable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;https://docs.python.org/3/library/functions.html#pow&quot;&gt;&lt;code&gt;pow()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Raises a number to a power&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;https://realpython.com/python-rounding/#pythons-built-in-round-function&quot;&gt;&lt;code&gt;round()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Rounds a floating-point value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;https://realpython.com/python-sum-function/&quot;&gt;&lt;code&gt;sum()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Sums the values in an iterable&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;In the following sections, you’ll learn how these functions work and how to use them in your Python code.&lt;/p&gt;
&lt;h3 id=&quot;getting-the-absolute-value-of-a-number-abs&quot;&gt;Getting the Absolute Value of a Number: &lt;code&gt;abs()&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#getting-the-absolute-value-of-a-number-abs&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Absolute_value&quot;&gt;absolute value&lt;/a&gt; or &lt;strong&gt;modulus&lt;/strong&gt; of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Real_number&quot;&gt;real number&lt;/a&gt; is its non-negative value. In other words, the absolute value is the number without its &lt;a href=&quot;https://en.wikipedia.org/wiki/Sign_(mathematics)&quot;&gt;sign&lt;/a&gt;. For example, the absolute value of &lt;em&gt;-5&lt;/em&gt; is &lt;em&gt;5&lt;/em&gt;, and the absolute value of &lt;em&gt;5&lt;/em&gt; is also &lt;em&gt;5&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; To learn more about &lt;code&gt;abs()&lt;/code&gt;, check out the &lt;a href=&quot;https://realpython.com/python-absolute-value/&quot;&gt;How to Find an Absolute Value in Python&lt;/a&gt; tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Python’s built-in &lt;code&gt;abs()&lt;/code&gt; function allows you to quickly compute the absolute value of a &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;number&lt;/a&gt;. Here’s its signature:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;python_syntax&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python Syntax&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;The &lt;code&gt;number&lt;/code&gt; argument can be any numeric value, including integers, floating-point numbers, complex numbers, fractions, and decimals. Take a look at a few examples:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; aria-label=&quot;Toggle prompts and output&quot; role=&quot;button&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;decimal&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Decimal&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;fractions&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Fraction&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;42&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;42&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;42.42&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;42.42&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;42.42&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;42.42&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;complex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-2+3j&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3.605551275463989&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;complex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2+3j&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3.605551275463989&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Fraction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-1/2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Fraction(1, 2)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Fraction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1/2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Fraction(1, 2)&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Decimal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;-0.5&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Decimal(&#x27;0.5&#x27;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Decimal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0.5&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Decimal(&#x27;0.5&#x27;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;p&gt;In these examples, you compute the absolute value of different numeric types using the &lt;code&gt;abs()&lt;/code&gt; function. First, you use integer numbers, then floating-point and complex numbers, and finally, fractional and decimal numbers. In all cases, when you call the function with a negative value, the final result removes the sign.&lt;/p&gt;
&lt;p&gt;For a practical example, say that you need to compute the total profits and losses of your company from a month’s transactions:&lt;/p&gt;
&lt;code-block class=&quot;mb-3&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot;&gt;&lt;span class=&quot;sr-only&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; aria-label=&quot;Toggle prompts and output&quot; role=&quot;button&quot; tabindex=&quot;0&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;codeblock__contents&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transactions&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;500&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;incomes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;income&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;income&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;transactions&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;income&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;expenses&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;expense&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;expense&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;transactions&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;expense&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Total incomes: $&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;incomes&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Total incomes: $800&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Total expenses: $&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;expenses&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Total expenses: $300&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Total profit: $&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;incomes&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;expenses&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Total profit: $500&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot; aria-label=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.0830b16e38c4.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    
  &lt;/div&gt;
&lt;/code-block&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-built-in-functions/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-built-in-functions/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #295: Agentic Architecture: Why Files Aren&#x27;t Always Enough</title>
      <id>https://realpython.com/podcasts/rpp/295/</id>
      <link href="https://realpython.com/podcasts/rpp/295/"/>
      <updated>2026-05-15T12:00:00+00:00</updated>
      <summary>What are the limitations of using a file-based agent workflow? Why do massive context windows tend to collapse? This week on the show, Mikiko Bazeley from MongoDB joins us to discuss agentic architecture and context engineering.</summary>
      <content type="html">
        &lt;p&gt;What are the limitations of using a file-based agent workflow? Why do massive context windows tend to collapse? This week on the show, Mikiko Bazeley from MongoDB joins us to discuss agentic architecture and context engineering.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Building Type-Safe LLM Agents With Pydantic AI</title>
      <id>https://realpython.com/courses/building-type-safe-llm-agents-with-pydantic-ai/</id>
      <link href="https://realpython.com/courses/building-type-safe-llm-agents-with-pydantic-ai/"/>
      <updated>2026-05-12T14:00:00+00:00</updated>
      <summary>Build type-safe LLM agents in Python with Pydantic AI using structured outputs, function calling, and dependency injection.</summary>
      <content type="html">
        &lt;p&gt;Pydantic AI is a Python framework for building LLM agents that return validated, structured outputs using Pydantic models. Instead of parsing raw strings from LLMs, you get type-safe objects with automatic validation.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;ve used FastAPI or Pydantic before, then you&amp;rsquo;ll recognize the familiar pattern of defining schemas with type hints and letting the framework handle the type validation for you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pydantic AI&lt;/strong&gt; uses &lt;code&gt;BaseModel&lt;/code&gt; classes to define structured outputs that guarantee &lt;strong&gt;type safety&lt;/strong&gt; and automatic &lt;strong&gt;validation&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;@agent.tool&lt;/code&gt; &lt;strong&gt;decorator&lt;/strong&gt; registers Python functions that &lt;strong&gt;LLMs can invoke&lt;/strong&gt; based on user queries and docstrings.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dependency injection&lt;/strong&gt; with &lt;code&gt;deps_type&lt;/code&gt; provides &lt;strong&gt;type-safe&lt;/strong&gt; runtime context like database connections without using &lt;strong&gt;global state&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Validation retries&lt;/strong&gt; automatically rerun queries when the LLM returns invalid data, which increases &lt;strong&gt;reliability&lt;/strong&gt; but also &lt;strong&gt;API costs&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Google Gemini&lt;/strong&gt;, &lt;strong&gt;OpenAI&lt;/strong&gt;, and &lt;strong&gt;Anthropic&lt;/strong&gt; models support structured outputs best, while other providers have &lt;strong&gt;varying capabilities&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #294: Declarative Charts in Python &amp; Discerning Iterators vs Iterables</title>
      <id>https://realpython.com/podcasts/rpp/294/</id>
      <link href="https://realpython.com/podcasts/rpp/294/"/>
      <updated>2026-05-08T12:00:00+00:00</updated>
      <summary>What if you could build charts in Python by describing what your data means, instead of scripting every visual detail? Christopher Trudeau is back on the show this week with another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What if you could build charts in Python by describing what your data means, instead of scripting every visual detail? Christopher Trudeau is back on the show this week with another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Use Codex CLI to Enhance Your Python Projects</title>
      <id>https://realpython.com/courses/use-codex-cli-enhance-your-python-projects/</id>
      <link href="https://realpython.com/courses/use-codex-cli-enhance-your-python-projects/"/>
      <updated>2026-05-05T14:00:00+00:00</updated>
      <summary>Learn how to use Codex CLI to add features to Python projects directly from your terminal, without needing a browser or IDE plugins.</summary>
      <content type="html">
        &lt;p&gt;After watching this video course, you&amp;rsquo;ll be able to use Codex CLI to add features to a Python project directly from your terminal. &lt;strong&gt;Codex CLI&lt;/strong&gt; is an AI-powered coding assistant that runs inside your terminal. It understands your project structure, reads your files, and proposes multi-file changes using natural language instructions.&lt;/p&gt;
&lt;p&gt;Instead of copying code from a browser or relying on an IDE plugin, you&amp;rsquo;ll use Codex CLI to implement a real feature in a multi-file Python project directly from your terminal.&lt;/p&gt;
&lt;p&gt;In the following lessons, you&amp;rsquo;ll install and configure Codex CLI, use it to implement a deletion feature in a contact book app, and then refine that feature through iterative prompting.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #293: Agentic Data Science Pair Programming With marimo pair</title>
      <id>https://realpython.com/podcasts/rpp/293/</id>
      <link href="https://realpython.com/podcasts/rpp/293/"/>
      <updated>2026-05-01T12:00:00+00:00</updated>
      <summary>How do you add agent skills to your data science workflow? How can a coding agent assist with data wrangling and research? This week on the show, Trevor Manz from marimo joins us to discuss marimo pair.</summary>
      <content type="html">
        &lt;p&gt;How do you add agent skills to your data science workflow? How can a coding agent assist with data wrangling and research? This week on the show, Trevor Manz from marimo joins us to discuss marimo pair.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Testing Your Code With Python&#x27;s unittest</title>
      <id>https://realpython.com/courses/testing-your-code-with-pythons-unittest/</id>
      <link href="https://realpython.com/courses/testing-your-code-with-pythons-unittest/"/>
      <updated>2026-04-28T14:00:00+00:00</updated>
      <summary>Learn how to use Python&#x27;s unittest framework to write unit tests for your code, including test cases, fixtures, and test suites.</summary>
      <content type="html">
        &lt;p&gt;The Python &lt;a href=&quot;https://docs.python.org/3/library/index.html&quot;&gt;standard library&lt;/a&gt; ships with a testing framework named &lt;strong&gt;&lt;code&gt;unittest&lt;/code&gt;&lt;/strong&gt;, which you can use to write automated tests for your code. The &lt;code&gt;unittest&lt;/code&gt; package has an object-oriented approach where test cases derive from a base class, which has several useful methods.&lt;/p&gt;
&lt;p&gt;The framework supports many features that will help you write consistent unit tests for your code. These features include test cases, fixtures, test suites, and test discovery capabilities.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Write &lt;code&gt;unittest&lt;/code&gt; tests with the &lt;strong&gt;&lt;code&gt;TestCase&lt;/code&gt;&lt;/strong&gt; class&lt;/li&gt;
&lt;li&gt;Explore the &lt;strong&gt;assert&lt;/strong&gt; methods that &lt;code&gt;TestCase&lt;/code&gt; provides&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;unittest&lt;/code&gt; from the &lt;strong&gt;command line&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Group test cases using the &lt;strong&gt;&lt;code&gt;TestSuite&lt;/code&gt;&lt;/strong&gt; class&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;fixtures&lt;/strong&gt; to handle &lt;strong&gt;setup&lt;/strong&gt; and &lt;strong&gt;teardown&lt;/strong&gt; logic&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this video course, you should be familiar with some important Python concepts, such as &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/inheritance-composition-python/&quot;&gt;inheritance&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-assert-statement/&quot;&gt;assertions&lt;/a&gt;. Having a good understanding of code &lt;a href=&quot;https://realpython.com/python-testing/&quot;&gt;testing&lt;/a&gt; is a plus.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #292: Becoming a Better Python Developer Through Learning Rust</title>
      <id>https://realpython.com/podcasts/rpp/292/</id>
      <link href="https://realpython.com/podcasts/rpp/292/"/>
      <updated>2026-04-24T12:00:00+00:00</updated>
      <summary>How can learning Rust help make you a better Python Developer? How do techniques required by a compiled language translate to improving your Python code? Christopher Trudeau is back on the show this week with another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;How can learning Rust help make you a better Python Developer? How do techniques required by a compiled language translate to improving your Python code? Christopher Trudeau is back on the show this week with another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Leverage OpenAI&#x27;s API in Your Python Projects</title>
      <id>https://realpython.com/courses/leverage-openais-api-in-your-python-projects/</id>
      <link href="https://realpython.com/courses/leverage-openais-api-in-your-python-projects/"/>
      <updated>2026-04-21T14:00:00+00:00</updated>
      <summary>Learn how to use the ChatGPT API with Python&#x27;s openai library to send prompts, control AI behavior with roles, and get structured outputs.</summary>
      <content type="html">
        &lt;p&gt;Python&amp;rsquo;s &lt;code&gt;openai&lt;/code&gt; library provides the tools you need to integrate the ChatGPT API into your Python applications. With it, you can send text prompts to the API and receive AI-generated responses. You can also guide the AI&amp;rsquo;s behavior with &lt;code&gt;developer&lt;/code&gt; role messages and handle both simple text generation and more complex code creation tasks.&lt;/p&gt;
&lt;p&gt;After watching this video course, you&amp;rsquo;ll understand how examples like this work under the hood. You&amp;rsquo;ll learn the fundamentals of using the ChatGPT API from Python and have code examples you can adapt for your own projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #291: Reassessing the LLM Landscape &amp; Summoning Ghosts</title>
      <id>https://realpython.com/podcasts/rpp/291/</id>
      <link href="https://realpython.com/podcasts/rpp/291/"/>
      <updated>2026-04-17T12:00:00+00:00</updated>
      <summary>What are the current techniques being employed to improve the performance of LLM-based systems? How is the industry shifting from post-training towards context engineering and multi-agent orchestration? This week on the show, Jodie Burchell, data scientist and Python Advocacy Team Lead at JetBrains, returns to discuss the current AI coding landscape.</summary>
      <content type="html">
        &lt;p&gt;What are the current techniques being employed to improve the performance of LLM-based systems? How is the industry shifting from post-training towards context engineering and multi-agent orchestration? This week on the show, Jodie Burchell, data scientist and Python Advocacy Team Lead at JetBrains, returns to discuss the current AI coding landscape.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Learning Path: Python Game Development</title>
      <id>https://realpython.com/learning-paths/python-game-development/</id>
      <link href="https://realpython.com/learning-paths/python-game-development/"/>
      <updated>2026-04-16T12:00:00+00:00</updated>
      <summary>Build Python games from command-line projects to 2D graphical games with turtle, Tkinter, Pygame, and Arcade.</summary>
      <content type="html">
        &lt;p&gt;Build Python games from command-line projects to 2D graphical games with turtle, Tkinter, Pygame, and Arcade.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Vector Databases and Embeddings With ChromaDB</title>
      <id>https://realpython.com/courses/vector-databases-embeddings-chromadb/</id>
      <link href="https://realpython.com/courses/vector-databases-embeddings-chromadb/"/>
      <updated>2026-04-14T14:00:00+00:00</updated>
      <summary>Learn how to use ChromaDB, an open-source vector database, to store embeddings and give context to large language models in Python.</summary>
      <content type="html">
        &lt;p&gt;The era of &lt;a href=&quot;https://en.wikipedia.org/wiki/Large_language_model&quot;&gt;large language models&lt;/a&gt; (LLMs) is here, bringing with it rapidly evolving libraries like &lt;a href=&quot;https://docs.trychroma.com/&quot;&gt;ChromaDB&lt;/a&gt; that help augment LLM applications. You&amp;rsquo;ve most likely heard of chatbots like OpenAI&amp;rsquo;s &lt;a href=&quot;https://realpython.com/chatgpt-coding-mentor-python/&quot;&gt;ChatGPT&lt;/a&gt;, and perhaps you&amp;rsquo;ve even experienced their remarkable ability to reason about &lt;a href=&quot;https://en.wikipedia.org/wiki/Natural_language_processing&quot;&gt;natural language processing (NLP)&lt;/a&gt; problems.&lt;/p&gt;
&lt;p&gt;Modern LLMs, while imperfect, can accurately solve a wide range of problems and provide correct answers to many questions. However, due to the limits of their training and the number of text tokens they can process, LLMs aren&amp;rsquo;t a silver bullet for all tasks.&lt;/p&gt;
&lt;p&gt;You wouldn&amp;rsquo;t expect an LLM to deliver relevant responses about topics that don&amp;rsquo;t appear in its training data. For example, if you asked ChatGPT to summarize information in confidential company documents, you&amp;rsquo;d be out of luck. You could show some of these documents to ChatGPT, but there&amp;rsquo;s a limit to how many documents you can upload before you exceed ChatGPT&amp;rsquo;s maximum token count. How would you select which documents to show ChatGPT?&lt;/p&gt;
&lt;p&gt;To address these limitations and scale your LLM applications, a great option is to use a vector database like ChromaDB. A &lt;strong&gt;vector database&lt;/strong&gt; allows you to store encoded unstructured objects, like text, as lists of numbers that can be compared to one another. For instance, you can find a collection of documents relevant to a question you&amp;rsquo;d like an LLM to answer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Representing &lt;strong&gt;unstructured objects&lt;/strong&gt; with &lt;strong&gt;vectors&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Using &lt;strong&gt;word&lt;/strong&gt; and &lt;strong&gt;text embeddings&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Harnessing the power of &lt;strong&gt;vector databases&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Encoding&lt;/strong&gt; and &lt;strong&gt;querying&lt;/strong&gt; over documents with ChromaDB&lt;/li&gt;
&lt;li&gt;Providing &lt;strong&gt;context&lt;/strong&gt; to &lt;strong&gt;LLMs&lt;/strong&gt; like ChatGPT with ChromaDB&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After watching, you&amp;rsquo;ll have the foundational knowledge to use ChromaDB in your NLP or LLM applications. Before watching, you should be comfortable with the &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;basics of Python&lt;/a&gt; and high school math.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #290: Advice on Managing Projects &amp; Making Python Classes Friendly</title>
      <id>https://realpython.com/podcasts/rpp/290/</id>
      <link href="https://realpython.com/podcasts/rpp/290/"/>
      <updated>2026-04-10T12:00:00+00:00</updated>
      <summary>What goes into managing a major project? What techniques can you employ for a project that&#x27;s in crisis? Christopher Trudeau is back on the show this week with another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What goes into managing a major project? What techniques can you employ for a project that&#x27;s in crisis? Christopher Trudeau is back on the show this week with another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Learning Path: LLM Application Development With Python</title>
      <id>https://realpython.com/learning-paths/llm-application-development-python/</id>
      <link href="https://realpython.com/learning-paths/llm-application-development-python/"/>
      <updated>2026-03-19T12:00:00+00:00</updated>
      <summary>Build LLM-powered applications in Python. Call model APIs, craft prompts, add retrieval-augmented generation, create AI agents, and connect via MCP.</summary>
      <content type="html">
        &lt;p&gt;Build LLM-powered applications in Python. Call model APIs, craft prompts, add retrieval-augmented generation, create AI agents, and connect via MCP.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Learning Path: Python Coding With AI</title>
      <id>https://realpython.com/learning-paths/coding-with-ai/</id>
      <link href="https://realpython.com/learning-paths/coding-with-ai/"/>
      <updated>2025-12-07T12:00:00+00:00</updated>
      <summary>Use AI coding assistants to write, review, and debug Python code faster. Pick from Claude Code, Cursor, or Gemini CLI and start coding.</summary>
      <content type="html">
        &lt;p&gt;Use AI coding assistants to write, review, and debug Python code faster. Pick from Claude Code, Cursor, or Gemini CLI and start coding.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Learning Path: Python Control Flow and Loops</title>
      <id>https://realpython.com/learning-paths/python-control-flow-and-loops/</id>
      <link href="https://realpython.com/learning-paths/python-control-flow-and-loops/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>Learn Python control flow and loops. Use conditional statements, Boolean operators, for and while loops, and keywords like break and continue.</summary>
      <content type="html">
        &lt;p&gt;Learn Python control flow and loops. Use conditional statements, Boolean operators, for and while loops, and keywords like break and continue.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Learning Path: Perfect Your Python Development Setup</title>
      <id>https://realpython.com/learning-paths/perfect-your-python-development-setup/</id>
      <link href="https://realpython.com/learning-paths/perfect-your-python-development-setup/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>Set up a Python development environment with VS Code, PyCharm, virtual environments, Git, pyenv, Docker, and AI coding tools like Claude Code and Cursor.</summary>
      <content type="html">
        &lt;p&gt;Set up a Python development environment with VS Code, PyCharm, virtual environments, Git, pyenv, Docker, and AI coding tools like Claude Code and Cursor.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Learning Path: Network Programming and Security</title>
      <id>https://realpython.com/learning-paths/network-programming-and-security/</id>
      <link href="https://realpython.com/learning-paths/network-programming-and-security/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>Learn network programming and security in Python. Work with CRUD operations, REST APIs, HTTPS, and socket programming to build networked apps.</summary>
      <content type="html">
        &lt;p&gt;Learn network programming and security in Python. Work with CRUD operations, REST APIs, HTTPS, and socket programming to build networked apps.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Learning Path: Create Graphical User Interfaces (GUI)</title>
      <id>https://realpython.com/learning-paths/python-gui-programming/</id>
      <link href="https://realpython.com/learning-paths/python-gui-programming/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>Build Python GUI applications with Tkinter, PyQt, wxPython, and Kivy. Learn layouts, event handling, threading, and database integration.</summary>
      <content type="html">
        &lt;p&gt;Build Python GUI applications with Tkinter, PyQt, wxPython, and Kivy. Learn layouts, event handling, threading, and database integration.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Learning Path: Important Standard Library Modules</title>
      <id>https://realpython.com/learning-paths/standard-library-modules-you-should-know/</id>
      <link href="https://realpython.com/learning-paths/standard-library-modules-you-should-know/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>Explore Python standard library modules including math, datetime, JSON, CSV, regex, subprocess, and argparse through hands-on tutorials and courses.</summary>
      <content type="html">
        &lt;p&gt;Explore Python standard library modules including math, datetime, JSON, CSV, regex, subprocess, and argparse through hands-on tutorials and courses.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Learning Path: Modules and Packages</title>
      <id>https://realpython.com/learning-paths/modules-and-packages/</id>
      <link href="https://realpython.com/learning-paths/modules-and-packages/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>Learn Python&#x27;s import system, organize code into modules and packages, manage dependencies with pip, and publish to PyPI.</summary>
      <content type="html">
        &lt;p&gt;Learn Python&#x27;s import system, organize code into modules and packages, manage dependencies with pip, and publish to PyPI.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Learning Path: Functions and Scopes</title>
      <id>https://realpython.com/learning-paths/functions-and-scopes/</id>
      <link href="https://realpython.com/learning-paths/functions-and-scopes/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>Learn to define Python functions, use parameters and return values, create inner functions, and understand namespaces and scope.</summary>
      <content type="html">
        &lt;p&gt;Learn to define Python functions, use parameters and return values, create inner functions, and understand namespaces and scope.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  

</feed>
