<?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-12-04T14:00:00+00:00</updated>
  <id>https://realpython.com/</id>
  <author>
    <name>Real Python</name>
  </author>

  
    <entry>
      <title>Amazon Releases a Giant Coding AI That Anyone Can Download</title>
      <id>https://realpython.com/ai-news-weekly-2026-12-04/</id>
      <link href="https://realpython.com/ai-news-weekly-2026-12-04/"/>
      <updated>2026-12-04T14:00:00+00:00</updated>
      <summary>Real Python&#x27;s weekly AI news for November 28–December 4, 2026, explained in plain language: Amazon&#x27;s Open Coding AI, Qwen4 Goes Open, and Faster Code Checks.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;em&gt;Real Python AI News · Weekly edition · The week of November 28–December 4, 2026&lt;/em&gt;&lt;/p&gt;
&lt;div class=&quot;card border rounded my-4&quot;&gt;&lt;div class=&quot;card-body&quot;&gt;&lt;div class=&quot;row align-items-center g-3&quot;&gt;&lt;div class=&quot;col-md-6&quot;&gt;&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid &quot; src=&quot;https://files.realpython.com/media/email.593b33f65c83.png&quot; width=&quot;2700&quot; height=&quot;2040&quot; srcset=&quot;/cdn-cgi/image/width=675,format=auto/https://files.realpython.com/media/email.593b33f65c83.png 675w, /cdn-cgi/image/width=900,format=auto/https://files.realpython.com/media/email.593b33f65c83.png 900w, /cdn-cgi/image/width=1350,format=auto/https://files.realpython.com/media/email.593b33f65c83.png 1350w, /cdn-cgi/image/width=2700,format=auto/https://files.realpython.com/media/email.593b33f65c83.png 2700w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;An email from Real Python titled Here Are Your AI News, What Changed and Why It Matters, with lavender newsletter artwork and a What&#x27;s New in AI heading.&quot; data-asset=&quot;7653&quot;&gt;&lt;/figure&gt;
&lt;/div&gt;&lt;div class=&quot;col-md-6&quot;&gt;&lt;p class=&quot;h4 mb-2&quot;&gt;Stop Falling Behind on AI. Catch Up in Five Minutes.&lt;/p&gt;&lt;p class=&quot;mb-3&quot;&gt;New models, new prices, new agent tools, all the time. Our new AI newsletter gives you the handful of stories you actually need as a developer. Free, straight from the Real Python team.&lt;/p&gt;


  &lt;div class=&quot;survey-form__modal&quot;&gt;




&lt;modal-button data-headline=&quot;Stop Falling Behind on AI. Catch Up in Five Minutes.&quot; data-no-footer=&quot;true&quot; data-large=&quot;true&quot; style=&quot;display:inline&quot;&gt;
  &lt;button type=&quot;button&quot; class=&quot;btn btn-primary&quot; data-modal-trigger&gt;
    Get the free roundup
  &lt;/button&gt;
  &lt;template data-modal-content&gt;



&lt;survey-form class=&quot;survey-form d-block&quot; data-slug=&quot;ai-newsletter&quot; data-endpoint=&quot;/api/v1/surveys/ai-newsletter/submissions/&quot; data-draft-endpoint=&quot;/api/v1/surveys/ai-newsletter/draft/&quot; data-view-endpoint=&quot;/api/v1/surveys/ai-newsletter/view/&quot; data-pages=&quot;1&quot; data-definition-hash=&quot;48cf1caeda6e874d&quot; data-captcha=&quot;auto&quot; data-turnstile-sitekey=&quot;0x4AAAAAAAQQUCLRXBi8NnUh&quot; data-surface=&quot;modal&quot; data-authenticated=&quot;0&quot; data-save-progress=&quot;1&quot; data-preview=&quot;0&quot;&gt;
  &lt;template data-resume-notice&gt;
    &lt;div class=&quot;alert alert-light border d-flex justify-content-between align-items-center py-2 mb-4&quot; role=&quot;status&quot;&gt;
      &lt;span class=&quot;text-body-secondary&quot;&gt;&lt;span class=&quot;icon baseline me-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.33eff4228e64.svg#solid--check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;We saved your progress from earlier.&lt;/span&gt;
      &lt;button type=&quot;button&quot; class=&quot;btn btn-link btn-sm p-0&quot; data-action=&quot;start-over&quot;&gt;Start over&lt;/button&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  &lt;div data-form-area&gt;

    &lt;form novalidate data-survey-form autocomplete=&quot;on&quot;&gt;
      &lt;div class=&quot;visually-hidden&quot; aria-hidden=&quot;true&quot;&gt;
        &lt;label for=&quot;ai-newsletter-hp&quot;&gt;Leave this field empty&lt;/label&gt;
        &lt;input type=&quot;text&quot; name=&quot;hp&quot; id=&quot;ai-newsletter-hp&quot; tabindex=&quot;-1&quot; autocomplete=&quot;off&quot;&gt;
      &lt;/div&gt;

        &lt;fieldset data-page=&quot;0&quot; data-next-label=&quot;Next&quot; tabindex=&quot;-1&quot;&gt;


              &lt;div class=&quot;survey-form__markdown article-body mb-4&quot;&gt;&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid rounded&quot; src=&quot;https://files.realpython.com/media/preview.4b4dadd03735.png&quot; width=&quot;2000&quot; height=&quot;834&quot; srcset=&quot;/cdn-cgi/image/width=500,format=auto/https://files.realpython.com/media/preview.4b4dadd03735.png 500w, /cdn-cgi/image/width=666,format=auto/https://files.realpython.com/media/preview.4b4dadd03735.png 666w, /cdn-cgi/image/width=1000,format=auto/https://files.realpython.com/media/preview.4b4dadd03735.png 1000w, /cdn-cgi/image/width=2000,format=auto/https://files.realpython.com/media/preview.4b4dadd03735.png 2000w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;An email from Real Python titled Here Are Your AI News, What Changed and Why It Matters, with lavender newsletter artwork and badges reading New issue in your inbox and In every issue.&quot; data-asset=&quot;7652&quot;&gt;&lt;/figure&gt;

&lt;p&gt;New models, new prices, new agent tools, all the time. Our new AI newsletter gives you the handful of stories you actually need as a developer.&lt;/p&gt;&lt;/div&gt;






&lt;div class=&quot;survey-form__field&quot; data-field=&quot;frequency&quot; data-field-type=&quot;checkbox&quot;&gt;

    &lt;fieldset data-required&gt;
      &lt;legend class=&quot;form-label fw-bold&quot;&gt;How often should it land in your inbox? Pick as many as you like.&lt;/legend&gt;


        &lt;div class=&quot;survey-form__pills&quot; data-pills&gt;

            &lt;span data-option data-value=&quot;daily&quot;&gt;
              &lt;input type=&quot;checkbox&quot; class=&quot;btn-check&quot; name=&quot;frequency&quot; id=&quot;survey-ai-newsletter-8cbcae-frequency-daily&quot; value=&quot;daily&quot;&gt;
              &lt;label class=&quot;btn btn-outline-dark rounded-pill survey-form__pill&quot; for=&quot;survey-ai-newsletter-8cbcae-frequency-daily&quot;&gt;☀️ Daily&lt;/label&gt;
            &lt;/span&gt;

            &lt;span data-option data-value=&quot;weekly&quot;&gt;
              &lt;input type=&quot;checkbox&quot; class=&quot;btn-check&quot; name=&quot;frequency&quot; id=&quot;survey-ai-newsletter-8cbcae-frequency-weekly&quot; value=&quot;weekly&quot;&gt;
              &lt;label class=&quot;btn btn-outline-dark rounded-pill survey-form__pill&quot; for=&quot;survey-ai-newsletter-8cbcae-frequency-weekly&quot;&gt;📬 Weekly&lt;/label&gt;
            &lt;/span&gt;

            &lt;span data-option data-value=&quot;monthly&quot;&gt;
              &lt;input type=&quot;checkbox&quot; class=&quot;btn-check&quot; name=&quot;frequency&quot; id=&quot;survey-ai-newsletter-8cbcae-frequency-monthly&quot; value=&quot;monthly&quot;&gt;
              &lt;label class=&quot;btn btn-outline-dark rounded-pill survey-form__pill&quot; for=&quot;survey-ai-newsletter-8cbcae-frequency-monthly&quot;&gt;🗓️ Monthly&lt;/label&gt;
            &lt;/span&gt;

        &lt;/div&gt;


    &lt;/fieldset&gt;

  &lt;div class=&quot;invalid-feedback d-block&quot; id=&quot;survey-ai-newsletter-8cbcae-frequency-error&quot; data-error-for=&quot;frequency&quot; hidden&gt;&lt;/div&gt;
&lt;/div&gt;








&lt;div class=&quot;survey-form__field&quot; data-field=&quot;email&quot; data-field-type=&quot;email&quot;&gt;

    &lt;label class=&quot;form-label fw-bold&quot; for=&quot;survey-ai-newsletter-8cbcae-email&quot;&gt;Your email address&lt;/label&gt;

    &lt;input type=&quot;email&quot; name=&quot;email&quot; class=&quot;form-control&quot; placeholder=&quot;you@example.com&quot; autocomplete=&quot;email&quot; maxlength=&quot;254&quot; id=&quot;survey-ai-newsletter-8cbcae-email&quot; required&gt;

  &lt;div class=&quot;invalid-feedback d-block&quot; id=&quot;survey-ai-newsletter-8cbcae-email-error&quot; data-error-for=&quot;email&quot; hidden&gt;&lt;/div&gt;
&lt;/div&gt;





              &lt;div class=&quot;survey-form__markdown article-body mb-4&quot;&gt;&lt;p&gt;&lt;strong&gt;Free, straight from the Real Python team. Unsubscribe anytime.&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;






        &lt;/fieldset&gt;

      &lt;div class=&quot;alert alert-danger py-2&quot; data-form-error role=&quot;alert&quot; hidden&gt;&lt;/div&gt;
      &lt;div data-turnstile class=&quot;survey-form__turnstile&quot;&gt;&lt;/div&gt;
      &lt;div class=&quot;d-flex align-items-center flex-wrap gap-3 mt-4&quot;&gt;
        &lt;button type=&quot;button&quot; class=&quot;btn btn-link ps-0&quot; data-action=&quot;back&quot; hidden&gt;« Back&lt;/button&gt;
        &lt;button type=&quot;button&quot; class=&quot;btn btn-dark px-4&quot; data-action=&quot;next&quot; hidden&gt;Next&lt;/button&gt;
        &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary px-4&quot; data-action=&quot;submit&quot;&gt;Sign Me Up&lt;/button&gt;
        &lt;span class=&quot;small text-body-secondary&quot; data-saved-indicator hidden&gt;&lt;span class=&quot;icon baseline text-success me-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.33eff4228e64.svg#solid--check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Saved&lt;/span&gt;
      &lt;/div&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  &lt;noscript&gt;
    &lt;div class=&quot;alert alert-warning mt-3&quot;&gt;This form needs JavaScript to work.&lt;/div&gt;
  &lt;/noscript&gt;
&lt;/survey-form&gt;

  &lt;/template&gt;
&lt;/modal-button&gt;

  &lt;/div&gt;

&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This week, big companies hand out AI models anyone can download and run, while the tools programmers use every day get new names and faster checks. Here is each story in plain language.&lt;/p&gt;
&lt;h2 id=&quot;amazon-puts-a-large-coding-ai-online-for-anyone-to-download&quot;&gt;Amazon Puts a Large Coding AI Online for Anyone to Download&lt;a class=&quot;headerlink&quot; href=&quot;#amazon-puts-a-large-coding-ai-online-for-anyone-to-download&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/s-amazon-ergo-framed.fbbc8a9fd01f.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/s-amazon-ergo-framed.fbbc8a9fd01f.png&quot; width=&quot;2560&quot; height=&quot;1120&quot; srcset=&quot;/cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/s-amazon-ergo-framed.fbbc8a9fd01f.png 640w, /cdn-cgi/image/width=853,format=auto/https://files.realpython.com/media/s-amazon-ergo-framed.fbbc8a9fd01f.png 853w, /cdn-cgi/image/width=1280,format=auto/https://files.realpython.com/media/s-amazon-ergo-framed.fbbc8a9fd01f.png 1280w, /cdn-cgi/image/width=2560,format=auto/https://files.realpython.com/media/s-amazon-ergo-framed.fbbc8a9fd01f.png 2560w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Screenshot of the source page: Introducing Amazon Ergo: A fast, cost-effective open-weights model&quot; data-asset=&quot;8563&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;Amazon now offers an AI model that anyone can download. &lt;strong&gt;&lt;a href=&quot;https://www.aboutamazon.com/amazon-ergo&quot;&gt;Amazon Ergo&lt;/a&gt;&lt;/strong&gt; is made for writing software and for &lt;em&gt;agentic&lt;/em&gt; work, where the AI works through a long chain of steps by itself.&lt;/p&gt;
&lt;p&gt;Ergo is an &lt;em&gt;open-weight model&lt;/em&gt;: Amazon shares its weights, also called &lt;a href=&quot;/ref/ai-coding-glossary/parameter/&quot; class=&quot;ref-link&quot;&gt;parameters&lt;/a&gt;, which are the numbers a model learns during &lt;a href=&quot;/ref/ai-coding-glossary/training/&quot; class=&quot;ref-link&quot;&gt;training&lt;/a&gt;. A business can run Ergo on its own computers or tune it with its own data. It can also rent Ergo through Bedrock, Amazon’s cloud service for AI models, at $1 per million &lt;a href=&quot;/ref/ai-coding-glossary/token/&quot; class=&quot;ref-link&quot;&gt;tokens&lt;/a&gt; sent in and $3 per million sent back. Tokens are the small chunks of text AI services bill by.&lt;/p&gt;
&lt;p&gt;Ergo has 1.1 trillion parameters but uses only 55 billion at each step, a design called &lt;em&gt;mixture of experts&lt;/em&gt; that keeps it cheaper to run. On DeepSWE, a test of real-world programming work, Amazon’s own run has Ergo solving 74.2 percent of the problems. That puts it second behind Kimi K3.1 Pro and first among open-weight models from US companies.&lt;/p&gt;
&lt;div class=&quot;container bg-body-tertiary rounded border p-3 my-4&quot;&gt;
&lt;div class=&quot;row align-items-center&quot;&gt;
&lt;div class=&quot;col-3 col-md-2&quot;&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid rounded-circle&quot; src=&quot;https://files.realpython.com/media/pacsany.19bcf16f5a00.jpg&quot; width=&quot;1920&quot; height=&quot;1920&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/pacsany.19bcf16f5a00.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/pacsany.19bcf16f5a00.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/pacsany.19bcf16f5a00.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/pacsany.19bcf16f5a00.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Philipp Acsany&quot; data-asset=&quot;3678&quot;&gt;&lt;/figure&gt;
&lt;/div&gt;
&lt;div class=&quot;col&quot;&gt;
&lt;p class=&quot;mb-2&quot;&gt;“Many well-known AI models, such as the ones behind &lt;a href=&quot;/ref/ai-coding-tools/chatgpt/&quot; class=&quot;ref-link&quot;&gt;ChatGPT&lt;/a&gt; and &lt;a href=&quot;/ref/ai-coding-tools/claude/&quot; class=&quot;ref-link&quot;&gt;Claude&lt;/a&gt;, are closed, so people can only use them through their maker’s service. Open-weight models let a business keep sensitive data on its own machines and avoid relying on one supplier. Ergo adds a large US option to that list.”&lt;/p&gt;
&lt;p class=&quot;small mb-0&quot;&gt;&lt;strong&gt;— Philipp Acsany&lt;/strong&gt;, Real Python&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&quot;alibabas-new-ai-family-starts-with-a-mid-size-model-anyone-can-download&quot;&gt;Alibaba’s New AI Family Starts With a Mid-Size Model&lt;a class=&quot;headerlink&quot; href=&quot;#alibabas-new-ai-family-starts-with-a-mid-size-model-anyone-can-download&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/s-qwen-qwen4-35b-a3b-framed.cabfb8ec76db.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/s-qwen-qwen4-35b-a3b-framed.cabfb8ec76db.png&quot; width=&quot;2560&quot; height=&quot;1120&quot; srcset=&quot;/cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/s-qwen-qwen4-35b-a3b-framed.cabfb8ec76db.png 640w, /cdn-cgi/image/width=853,format=auto/https://files.realpython.com/media/s-qwen-qwen4-35b-a3b-framed.cabfb8ec76db.png 853w, /cdn-cgi/image/width=1280,format=auto/https://files.realpython.com/media/s-qwen-qwen4-35b-a3b-framed.cabfb8ec76db.png 1280w, /cdn-cgi/image/width=2560,format=auto/https://files.realpython.com/media/s-qwen-qwen4-35b-a3b-framed.cabfb8ec76db.png 2560w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Screenshot of the source page: Qwen/Qwen4-35B-A3B · Hugging Face&quot; data-asset=&quot;8603&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;The first model in Alibaba’s new Qwen4 family that anyone can download is a mid-size one, &lt;strong&gt;&lt;a href=&quot;https://huggingface.co/Qwen/Qwen4-35B-A3B&quot;&gt;Qwen4-35B-A3B&lt;/a&gt;&lt;/strong&gt;. Alibaba, the Chinese tech giant, built it with the same design and training methods as its flagship, Qwen4-Max. It understands pictures as well as text.&lt;/p&gt;
&lt;p&gt;A few terms from the announcement, in plain language:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;35 billion parameters, 3 billion active:&lt;/strong&gt; Parameters are the settings a model adjusts while it learns. A &lt;em&gt;mixture of experts&lt;/em&gt; model wakes only the specialist parts it needs, so it runs quicker than its size suggests.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;1 million tokens of context:&lt;/strong&gt; A &lt;em&gt;token&lt;/em&gt; is a small piece of text. The model can handle thousands of pages at once.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Apache 2.0:&lt;/strong&gt; A free license that lets anyone use, change, and sell products built on the model.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Popular free tools like &lt;a href=&quot;https://realpython.com/huggingface-transformers/&quot;&gt;Transformers&lt;/a&gt;, &lt;a href=&quot;/ref/ai-coding-tools/vllm/&quot; class=&quot;ref-link&quot;&gt;vLLM&lt;/a&gt;, and SGLang run it from the start. Unsloth, a project for running models on ordinary hardware, offers slimmed-down copies. The smallest needs about 9.3 GB of memory. On Unsloth’s tests, a 4-bit copy scores 95.0 percent, against 95.3 percent for the full model.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/ai-news-weekly-2026-12-04/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/ai-news-weekly-2026-12-04/ »&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 #321: Exploring Positron: Data Science Focused IDE</title>
      <id>https://realpython.com/podcasts/rpp/321/</id>
      <link href="https://realpython.com/podcasts/rpp/321/"/>
      <updated>2026-12-04T12:00:00+00:00</updated>
      <summary>What tools can help a data scientist explore data, manage plots, and write Python code? This week on the show, Isabel Zimmerman, Senior Software Engineer at Posit, shares how Positron brings those tasks together in a single IDE.</summary>
      <content type="html">
        &lt;p&gt;What tools can help a data scientist explore data, manage plots, and write Python code? This week on the show, Isabel Zimmerman, Senior Software Engineer at Posit, shares how Positron brings those tasks together in a single IDE.&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: Build a Command-Line To-Do App With Python and Typer</title>
      <id>https://realpython.com/quizzes/python-typer-cli/</id>
      <link href="https://realpython.com/quizzes/python-typer-cli/"/>
      <updated>2026-12-04T12:00:00+00:00</updated>
      <summary>Test your Typer skills by revisiting how to build and test a command-line to-do app in Python with commands, arguments, and options.</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-typer-cli/&quot;&gt;Build a Command-Line To-Do App With Python and Typer&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how Typer turns your functions into commands
with arguments and options, how to add global options and confirmation prompts,
and how to test your CLI with &lt;code&gt;CliRunner&lt;/code&gt; and pytest.&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>What You Need to Know to Manage Users in Django Admin</title>
      <id>https://realpython.com/manage-users-in-django-admin/</id>
      <link href="https://realpython.com/manage-users-in-django-admin/"/>
      <updated>2026-12-03T14:00:00+00:00</updated>
      <summary>Learn how to manage users in Django admin safely. Protect your Python web app from permission escalation and keep user permissions tidy with groups.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;User management in Django admin is a tricky subject. If you enforce too many permissions, then you might interfere with day-to-day operations. If you allow for permissions to be granted freely without supervision, then you put your system at risk.&lt;/p&gt;
&lt;p&gt;Django provides a good authentication framework with tight integration to Django admin. Out of the box, Django admin does not enforce special restrictions on the user admin. This can lead to dangerous scenarios that might compromise your system.&lt;/p&gt;
&lt;p&gt;Did you know staff users that manage other users in the admin can edit their own permissions? Did you know they can also make themselves superusers? There is nothing in Django admin that prevents that, so it’s up to you!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll know how to protect your system:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Protect against permission escalation&lt;/strong&gt; by preventing users from editing their own permissions&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Keep permissions tidy and maintainable&lt;/strong&gt; by only forcing users to manage permissions only using groups&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Prevent permissions from leaking through custom actions&lt;/strong&gt; by explicitly enforcing the necessary permissions&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Follow Along:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To follow along with this tutorial, it’s best to setup a small project to play with. If you aren’t sure how to do that, then check out &lt;a href=&quot;https://realpython.com/get-started-with-django-1/#hello-world&quot;&gt;Get Started With Django&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This tutorial also assumes a basic understanding of user management in Django. If you aren’t familiar with that, then check out &lt;a href=&quot;https://realpython.com/django-user-management/&quot;&gt;Get Started With Django Part 2: Django User Management&lt;/a&gt;.&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;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/django-resources/&quot; class=&quot;alert-link&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#modal-django-resources&quot; markdown&gt;Click here to get access to a free Django Learning Resources Guide (PDF)&lt;/a&gt; that shows you tips and tricks as well as common pitfalls to avoid when building Python + Django web applications.&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 Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/manage-users-in-django-admin-code/&quot; class=&quot;alert-link&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#modal-manage-users-in-django-admin-code&quot; markdown&gt;Click here to download the free sample code&lt;/a&gt; you’ll use to lock down user permissions in Django admin.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;model-permissions&quot;&gt;Model Permissions&lt;a class=&quot;headerlink&quot; href=&quot;#model-permissions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Permissions are tricky. If you don’t &lt;a href=&quot;https://realpython.com/django-view-authorization/&quot;&gt;set permissions&lt;/a&gt;, then you put your system at risk of intruders, data leaks, and human errors. If you abuse permissions or use them too much, then you risk interfering with day-to-day operations.&lt;/p&gt;
&lt;p&gt;Django comes with a built-in &lt;a href=&quot;https://docs.djangoproject.com/en/stable/topics/auth/&quot;&gt;authentication system&lt;/a&gt;. The authentication system includes users, groups, and permissions.&lt;/p&gt;
&lt;p&gt;When a model is created, Django will automatically create four &lt;a href=&quot;https://docs.djangoproject.com/en/stable/topics/auth/default/#default-permissions&quot;&gt;default permissions&lt;/a&gt; for the following actions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;add&lt;/code&gt;:&lt;/strong&gt; Users with this permission can add an &lt;a href=&quot;/ref/glossary/instance/&quot; class=&quot;ref-link&quot;&gt;instance&lt;/a&gt; of the model.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;delete&lt;/code&gt;:&lt;/strong&gt; Users with this permission can delete an instance of the model.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;change&lt;/code&gt;:&lt;/strong&gt; Users with this permission can update an instance of the model.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;view&lt;/code&gt;:&lt;/strong&gt; Users with this permission can view instances of this model. This permission was a much anticipated one, and it was finally added in Django 2.1.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Permission names follow a very specific naming convention:  &lt;code&gt;&amp;lt;app&amp;gt;.&amp;lt;action&amp;gt;_&amp;lt;modelname&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Let’s break that down:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;app&amp;gt;&lt;/code&gt;&lt;/strong&gt; is the name of the app. For example, the &lt;code&gt;User&lt;/code&gt; model is imported from the &lt;code&gt;auth&lt;/code&gt; app (&lt;code&gt;django.contrib.auth&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;action&amp;gt;&lt;/code&gt;&lt;/strong&gt; is one of the actions above (&lt;code&gt;add&lt;/code&gt;, &lt;code&gt;delete&lt;/code&gt;, &lt;code&gt;change&lt;/code&gt;, or &lt;code&gt;view&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;modelname&amp;gt;&lt;/code&gt;&lt;/strong&gt; is the name of the model, in all lowercase letters.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Knowing this naming convention can help you manage permissions more easily. For example, the name of the permission to change a user is &lt;code&gt;auth.change_user&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&quot;how-to-check-permissions&quot;&gt;How to Check Permissions&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-check-permissions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Model permissions are granted to users or groups. To check if a user has a certain permission, you can do the following:&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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;django.contrib.auth.models&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;User&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;u&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;objects&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;create_user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;haki&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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;u&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;has_perm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;auth.change_user&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;False&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.33eff4228e64.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’s worth mentioning that &lt;a href=&quot;https://github.com/django/django/blob/bf9e0e342da3ed2f74ee0ec34e75bdcbedde40a9/django/contrib/auth/models.py#L255&quot;&gt;&lt;code&gt;.has_perm()&lt;/code&gt; will always return &lt;code&gt;True&lt;/code&gt;&lt;/a&gt; for active superuser, even if the permission doesn’t really exist:&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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;django.contrib.auth.models&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;User&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;superuser&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;objects&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;create_superuser&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;superhaki&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;me@hakibenita.com&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;secret&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;superuser&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;has_perm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;does.not.exist&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;True&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.33eff4228e64.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;As you can see, when you’re checking permissions for a superuser, the permissions are not really being checked.&lt;/p&gt;
&lt;h3 id=&quot;how-to-enforce-permissions&quot;&gt;How to Enforce Permissions&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-enforce-permissions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Django models don’t enforce permissions themselves. The only place permissions are enforced out of the box by default is Django Admin.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/manage-users-in-django-admin/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/manage-users-in-django-admin/ »&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>Python&#x27;s min() and max(): Find Smallest and Largest Values</title>
      <id>https://realpython.com/python-min-and-max/</id>
      <link href="https://realpython.com/python-min-and-max/"/>
      <updated>2026-12-03T14:00:00+00:00</updated>
      <summary>Use Python&#x27;s max() and min() to find the largest and smallest values, customize comparisons with a key function, and handle empty iterables.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s built-in functions &lt;code&gt;max()&lt;/code&gt; and &lt;code&gt;min()&lt;/code&gt; allow you to find the largest and smallest values in a dataset. You can use them with iterables, such as lists or tuples, or a series of regular &lt;a href=&quot;/ref/glossary/argument/&quot; class=&quot;ref-link&quot;&gt;arguments&lt;/a&gt;. They can handle numbers, strings, and even dictionaries. Plus, with the optional arguments &lt;code&gt;key&lt;/code&gt; and &lt;code&gt;default&lt;/code&gt;, you can customize their behavior to suit your needs.&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;Python’s &lt;code&gt;max()&lt;/code&gt; and &lt;code&gt;min()&lt;/code&gt;&lt;/strong&gt; can find the &lt;strong&gt;largest and smallest values&lt;/strong&gt; in a dataset.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; can &lt;strong&gt;handle string inputs&lt;/strong&gt; by comparing their alphabetical order.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;key&lt;/code&gt; argument &lt;strong&gt;modifies comparison criteria&lt;/strong&gt; by applying a &lt;a href=&quot;/ref/glossary/function/&quot; class=&quot;ref-link&quot;&gt;function&lt;/a&gt; to each element before comparison.&lt;/li&gt;
&lt;li&gt;You can use &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; with &lt;strong&gt;generator expressions&lt;/strong&gt; for memory-efficient value comparison.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This tutorial explores the practical use cases for &lt;a href=&quot;/ref/builtin-functions/min/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;min()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;/ref/builtin-functions/max/&quot; class=&quot;ref-link&quot;&gt;&lt;code&gt;max()&lt;/code&gt;&lt;/a&gt;, such as removing outliers from lists and processing strings. By the end, you’ll also know how to implement your own versions of &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; to deepen your understanding of these functions.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-mastery-course/&quot; class=&quot;alert-link&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#modal-python-mastery-course&quot; markdown&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you’ll need to take your Python skills to the next level.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To get the most out of this tutorial, you should have some previous knowledge of Python programming, including topics like &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loops&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/list-comprehension-python/&quot;&gt;list comprehensions&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/introduction-to-python-generators/#building-generators-with-generator-expressions&quot;&gt;generator expressions&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/python-min-and-max-code/&quot; class=&quot;alert-link&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#modal-python-min-and-max-code&quot; markdown&gt;Click here to download the free sample code&lt;/a&gt; you’ll use to find smallest and largest values and build your own min() and max().&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Python for Beginners Live Course:&lt;/strong&gt; Want to practice using Python’s built-in functions in real programs? In Real Python’s &lt;a href=&quot;https://realpython.com/workshops/python-for-beginners/&quot;&gt;Python for Beginners&lt;/a&gt; live course, you build real projects with an instructor in a small group, with live help whenever you get stuck. Join the waitlist to hear about the next dates.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;getting-started-with-pythons-min-and-max-functions&quot;&gt;Getting Started With Python’s &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; Functions&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-pythons-min-and-max-functions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python includes several &lt;a href=&quot;/ref/builtin-functions/&quot; class=&quot;ref-link&quot;&gt;built-in functions&lt;/a&gt; that make your life more pleasant and productive because they mean you don’t need to reinvent the wheel. Two examples of these functions are &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt;. They mostly apply to &lt;a href=&quot;/ref/glossary/iterable/&quot; class=&quot;ref-link&quot;&gt;iterables&lt;/a&gt;, but you can use them with multiple regular arguments as well. What’s their job? They take care of &lt;em&gt;finding the smallest and largest values&lt;/em&gt; in their input data.&lt;/p&gt;
&lt;p&gt;Whether you’re using Python’s &lt;code&gt;min()&lt;/code&gt; or &lt;code&gt;max()&lt;/code&gt;, you can use the function to achieve two slightly different behaviors. The standard behavior for each is to &lt;a href=&quot;/ref/keywords/return/&quot; class=&quot;ref-link&quot;&gt;return&lt;/a&gt; the minimum or maximum value through straightforward comparison of the input data as it stands. The alternative behavior is to use a single-argument function to modify the comparison criteria before finding the smallest and largest values.&lt;/p&gt;
&lt;p&gt;To explore the standard behavior of &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt;, you can start by calling each function with either a single iterable as an argument or with two or more regular arguments. That’s what you’ll do right away.&lt;/p&gt;
&lt;h3 id=&quot;calling-min-and-max-with-a-single-iterable-argument&quot;&gt;Calling &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; With a Single Iterable Argument&lt;a class=&quot;headerlink&quot; href=&quot;#calling-min-and-max-with-a-single-iterable-argument&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The built-in &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; have two different signatures that allow you to call them either with an iterable as their first argument or with two or more regular arguments. The signature that accepts a single iterable argument looks 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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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;nb&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iterable&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;p&quot;&gt;[,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&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;n&quot;&gt;minimum_value&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iterable&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;p&quot;&gt;[,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&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;n&quot;&gt;maximum_value&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.33eff4228e64.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;Both functions take a required argument called &lt;code&gt;iterable&lt;/code&gt; and return the minimum and maximum values respectively. They also take two optional &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/#keyword-only-arguments&quot;&gt;keyword-only&lt;/a&gt; arguments: &lt;code&gt;default&lt;/code&gt; and &lt;code&gt;key&lt;/code&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; In the above signatures, the asterisk (&lt;code&gt;*&lt;/code&gt;) means that the following arguments are keyword-only arguments, while the square brackets (&lt;code&gt;[]&lt;/code&gt;) denote that the enclosed content is optional.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Here’s a summary of what the arguments to &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; do:&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-start&quot;&gt;Argument&lt;/th&gt;
&lt;th class=&quot;text-start&quot;&gt;Description&lt;/th&gt;
&lt;th&gt;Required&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&quot;text-start&quot;&gt;&lt;code&gt;iterable&lt;/code&gt;&lt;/td&gt;
&lt;td class=&quot;text-start&quot;&gt;Takes an iterable object, like a &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;list, tuple&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt;, or &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-start&quot;&gt;&lt;code&gt;default&lt;/code&gt;&lt;/td&gt;
&lt;td class=&quot;text-start&quot;&gt;Holds a value to return if the input iterable is empty&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-start&quot;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
&lt;td class=&quot;text-start&quot;&gt;Accepts a single-argument function to customize the comparison criteria&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Later in this tutorial, you’ll learn more about the optional &lt;code&gt;default&lt;/code&gt; and &lt;code&gt;key&lt;/code&gt; arguments. For now, just focus on the &lt;code&gt;iterable&lt;/code&gt; argument, which is a required argument that leverages the standard behavior of &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; in Python:&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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;nb&quot;&gt;min&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;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&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;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-5&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;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([])&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&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;gr&quot;&gt;ValueError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;min() iterable argument is empty&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;max&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;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&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;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;9&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;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([])&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&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;gr&quot;&gt;ValueError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;max() iterable argument is empty&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.33eff4228e64.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 call &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; with a list of integer &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;numbers&lt;/a&gt; and then with an empty list. The first call to &lt;code&gt;min()&lt;/code&gt; returns the smallest number in the input list, &lt;code&gt;-5&lt;/code&gt;. In contrast, the first call to &lt;code&gt;max()&lt;/code&gt; returns the largest number in the list, or &lt;code&gt;9&lt;/code&gt;. If you pass an empty &lt;a href=&quot;/ref/glossary/iterator/&quot; class=&quot;ref-link&quot;&gt;iterator&lt;/a&gt; to &lt;code&gt;min()&lt;/code&gt; or &lt;code&gt;max()&lt;/code&gt;, then you get a &lt;code&gt;ValueError&lt;/code&gt; because there’s nothing to do on an empty iterable.&lt;/p&gt;
&lt;p&gt;An important detail to note about &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; is that all the values in the input iterable must be comparable. Otherwise, you get an error. For example, numeric values work okay:&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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;nb&quot;&gt;min&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;mf&quot;&gt;5.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.0&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;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-5&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;max&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;mf&quot;&gt;5.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.0&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;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;9&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.33eff4228e64.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;These examples combine &lt;code&gt;int&lt;/code&gt; and &lt;code&gt;float&lt;/code&gt; numbers in the calls to &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt;. You get the expected result in both cases because these data &lt;a href=&quot;/ref/glossary/type/&quot; class=&quot;ref-link&quot;&gt;types&lt;/a&gt; are comparable.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-min-and-max/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-min-and-max/ »&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>How to Iterate Through a Dictionary in Python</title>
      <id>https://realpython.com/iterate-through-dictionary-python/</id>
      <link href="https://realpython.com/iterate-through-dictionary-python/"/>
      <updated>2026-12-03T14:00:00+00:00</updated>
      <summary>Learn how to iterate through a dictionary in Python with .items(), .keys(), and .values(), plus comprehensions, sorting, and built-in functions.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python offers several ways to iterate through a dictionary, such as using &lt;code&gt;.items()&lt;/code&gt; to access key-value pairs directly and &lt;code&gt;.values()&lt;/code&gt; to retrieve values only. By understanding these techniques, you’ll be able to efficiently access and manipulate dictionary data.&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;You can &lt;strong&gt;directly iterate&lt;/strong&gt; over the &lt;strong&gt;keys&lt;/strong&gt; of a Python dictionary using a &lt;code&gt;for&lt;/code&gt; &lt;a href=&quot;/ref/glossary/loop/&quot; class=&quot;ref-link&quot;&gt;loop&lt;/a&gt; and access values with &lt;code&gt;dict_object[key]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can iterate through a Python dictionary in different ways using the &lt;strong&gt;dictionary &lt;a href=&quot;/ref/glossary/method/&quot; class=&quot;ref-link&quot;&gt;methods&lt;/a&gt;&lt;/strong&gt; &lt;code&gt;.keys()&lt;/code&gt;, &lt;code&gt;.values()&lt;/code&gt;, and &lt;code&gt;.items()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You should &lt;strong&gt;use &lt;code&gt;.items()&lt;/code&gt;&lt;/strong&gt; to access &lt;strong&gt;key-value pairs&lt;/strong&gt; when iterating through a Python dictionary.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;fastest way&lt;/strong&gt; to access both keys and values when you iterate over a dictionary in Python is to &lt;strong&gt;use &lt;code&gt;.items()&lt;/code&gt;&lt;/strong&gt; with &lt;strong&gt;tuple &lt;a href=&quot;/ref/glossary/unpacking/&quot; class=&quot;ref-link&quot;&gt;unpacking&lt;/a&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should have a basic understanding of Python &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionaries&lt;/a&gt;, know how to use Python &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt;&lt;/a&gt; loops, and be familiar with &lt;a href=&quot;https://realpython.com/list-comprehension-python/&quot;&gt;comprehensions&lt;/a&gt;. Knowing other tools like the built-in &lt;a href=&quot;https://realpython.com/python-map-function/&quot;&gt;&lt;code&gt;map()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-filter-function/&quot;&gt;&lt;code&gt;filter()&lt;/code&gt;&lt;/a&gt; functions, as well as the &lt;a href=&quot;https://realpython.com/python-itertools/&quot;&gt;&lt;code&gt;itertools&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-collections-module/&quot;&gt;&lt;code&gt;collections&lt;/code&gt;&lt;/a&gt; modules, is also a plus.&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/iterate-through-dictionary-python-code/&quot; class=&quot;alert-link&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#modal-iterate-through-dictionary-python-code&quot; markdown&gt;Click here to download the sample code&lt;/a&gt; that shows you how to iterate through a dictionary 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.33eff4228e64.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 Dictionary Iteration” 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-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-dictionary-iteration/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;ratio ratio-16x9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 rounded&quot; style=&quot;object-fit: contain; background: #e5c5ac;&quot; alt=&quot;How to Iterate Through a Dictionary in Python&quot; src=&quot;https://files.realpython.com/media/How-to-Iterate-Through-A-Dictionary-in-Python_Watermarked.06d6547f531b.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-Iterate-Through-A-Dictionary-in-Python_Watermarked.06d6547f531b.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/How-to-Iterate-Through-A-Dictionary-in-Python_Watermarked.06d6547f531b.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/How-to-Iterate-Through-A-Dictionary-in-Python_Watermarked.06d6547f531b.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/How-to-Iterate-Through-A-Dictionary-in-Python_Watermarked.06d6547f531b.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.33eff4228e64.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 position-relative&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-dictionary-iteration/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python Dictionary Iteration&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Dictionaries are one of the most important and useful data structures in Python. Learning how to iterate through a Dictionary can help you solve a wide variety of programming problems in an efficient way. Test your understanding on how you can use them better!&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Python for Beginners Live Course:&lt;/strong&gt; Want to get comfortable looping over dictionaries in your own programs? In Real Python’s &lt;a href=&quot;https://realpython.com/workshops/python-for-beginners/&quot;&gt;Python for Beginners&lt;/a&gt; live course, you work through data structures, control flow, and functions with an instructor and build real projects along the way. Join the waitlist to hear about the next dates.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;getting-started-with-python-dictionaries&quot;&gt;Getting Started With Python Dictionaries&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-python-dictionaries&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Dictionaries are a cornerstone of Python. Many aspects of the language are built around dictionaries. &lt;a href=&quot;https://realpython.com/python-modules-packages/&quot;&gt;Modules&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt;, objects, &lt;a href=&quot;https://realpython.com/python-scope-legb-rule/#globals&quot;&gt;&lt;code&gt;globals()&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-scope-legb-rule/#locals&quot;&gt;&lt;code&gt;locals()&lt;/code&gt;&lt;/a&gt; are all examples of how dictionaries are deeply wired into Python’s implementation.&lt;/p&gt;
&lt;p&gt;Here’s how the Python &lt;a href=&quot;https://docs.python.org/3/index.html&quot;&gt;official documentation&lt;/a&gt; defines a dictionary:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;An associative array, where arbitrary keys are mapped to values. The keys can be any object with &lt;code&gt;__hash__()&lt;/code&gt; and &lt;code&gt;__eq__()&lt;/code&gt; methods. (&lt;a href=&quot;https://docs.python.org/3/glossary.html#term-dictionary&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There are a couple of points to notice in this definition:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Dictionaries map &lt;strong&gt;keys&lt;/strong&gt; to &lt;strong&gt;values&lt;/strong&gt; and store them in an array or &lt;strong&gt;collection&lt;/strong&gt;. The key-value pairs are commonly known as &lt;strong&gt;items&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Dictionary keys must be of a &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-hashable&quot;&gt;hashable&lt;/a&gt; type, which means that they must have a hash value that never changes during the key’s lifetime.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Unlike &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-sequence&quot;&gt;sequences&lt;/a&gt;, which are &lt;a href=&quot;https://realpython.com/python-iterators-iterables/#getting-to-know-python-iterables&quot;&gt;iterables&lt;/a&gt; that support element access using integer indices, dictionaries are indexed by keys. This means that you can access the values stored in a dictionary using the associated key rather than an integer index.&lt;/p&gt;
&lt;p&gt;The keys in a dictionary are much like a &lt;a href=&quot;https://realpython.com/python-sets/&quot;&gt;&lt;code&gt;set&lt;/code&gt;&lt;/a&gt;, which is a collection of &lt;a href=&quot;/ref/glossary/hashable/&quot; class=&quot;ref-link&quot;&gt;hashable&lt;/a&gt; and unique objects. Because the keys need to be hashable, you can’t use &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-mutable&quot;&gt;mutable&lt;/a&gt; objects as dictionary keys.&lt;/p&gt;
&lt;p&gt;On the other hand, dictionary values can be of any Python type, whether they’re hashable or not. There are literally no restrictions for values. You can use anything as a value in a Python dictionary.&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; The concepts and topics that you’ll learn about in this section and throughout this tutorial refer to the &lt;a href=&quot;https://realpython.com/cpython-source-code-guide/&quot;&gt;CPython&lt;/a&gt; implementation of Python. Other implementations, such as &lt;a href=&quot;https://realpython.com/pypy-faster-python/&quot;&gt;PyPy&lt;/a&gt;, &lt;a href=&quot;https://ironpython.net/&quot;&gt;IronPython&lt;/a&gt;, and &lt;a href=&quot;https://www.jython.org/index.html&quot;&gt;Jython&lt;/a&gt;, could exhibit different dictionary behaviors and features that are beyond the scope of this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Before Python 3.6, dictionaries were &lt;em&gt;unordered&lt;/em&gt; &lt;a href=&quot;/ref/glossary/data-structure/&quot; class=&quot;ref-link&quot;&gt;data structures&lt;/a&gt;. This means that the order of items typically wouldn’t match the insertion order:&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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;c1&quot;&gt;# Python 3.5&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;likes&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;s2&quot;&gt;&quot;color&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;fruit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;apple&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;pet&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;dog&quot;&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;likes&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;{&#x27;color&#x27;: &#x27;blue&#x27;, &#x27;pet&#x27;: &#x27;dog&#x27;, &#x27;fruit&#x27;: &#x27;apple&#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.33eff4228e64.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;Note how the order of items in the resulting dictionary doesn’t match the order in which you originally inserted the items.&lt;/p&gt;
&lt;p&gt;In Python 3.6 and greater, the keys and values of a dictionary retain the same order in which you insert them into the underlying dictionary. From 3.6 onward, dictionaries are compact &lt;em&gt;ordered&lt;/em&gt; data structures:&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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;c1&quot;&gt;# Python 3.6&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;likes&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;s2&quot;&gt;&quot;color&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;fruit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;apple&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;pet&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;dog&quot;&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;likes&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;{&#x27;color&#x27;: &#x27;blue&#x27;, &#x27;fruit&#x27;: &#x27;apple&#x27;, &#x27;pet&#x27;: &#x27;dog&#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.33eff4228e64.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;Keeping the items in order is a pretty useful feature. However, if you work with code that supports older Python versions, then you must not rely on this feature, because it can generate buggy behaviors. With newer versions, it’s completely safe to rely on the feature.&lt;/p&gt;
&lt;p&gt;Another important feature of dictionaries is that they’re &lt;a href=&quot;https://realpython.com/python-mutable-vs-immutable-types/#dictionaries&quot;&gt;mutable&lt;/a&gt; data types. This means that you can add, delete, and update their items &lt;a href=&quot;https://en.wikipedia.org/wiki/In-place_algorithm&quot;&gt;in place&lt;/a&gt; as needed. It’s worth noting that this mutability also means that you can’t use a dictionary as a key in another dictionary.&lt;/p&gt;
&lt;h2 id=&quot;understanding-how-to-iterate-through-a-dictionary-in-python&quot;&gt;Understanding How to Iterate Through a Dictionary in Python&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-how-to-iterate-through-a-dictionary-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/iterate-through-dictionary-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/iterate-through-dictionary-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>Natural Language Processing With spaCy in Python</title>
      <id>https://realpython.com/natural-language-processing-spacy-python/</id>
      <link href="https://realpython.com/natural-language-processing-spacy-python/"/>
      <updated>2026-12-03T14:00:00+00:00</updated>
      <summary>Use spaCy for natural language processing in Python. Learn tokenization, lemmatization, part-of-speech tagging, and named-entity recognition.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;spaCy is a robust open-source library for Python, ideal for natural language processing (NLP) tasks. It offers built-in capabilities for tokenization, dependency parsing, and named-entity recognition, making it a popular choice for processing and analyzing text. With spaCy, you can efficiently represent unstructured text in a computer-readable format, enabling automation of text analysis and extraction of meaningful insights.&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;You can use spaCy for &lt;strong&gt;natural language processing&lt;/strong&gt; tasks such as &lt;strong&gt;part-of-speech tagging&lt;/strong&gt;, and &lt;strong&gt;named-entity recognition&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;spaCy&lt;/strong&gt; is often preferred over &lt;strong&gt;NLTK&lt;/strong&gt; for production environments due to its &lt;strong&gt;performance and modern design&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;spaCy provides integration with &lt;strong&gt;&lt;a href=&quot;/ref/ai-coding-glossary/transformer/&quot; class=&quot;ref-link&quot;&gt;transformer&lt;/a&gt; models&lt;/strong&gt;, such as &lt;strong&gt;&lt;span data-invalid-ref=&quot;ai-coding-glossary/bert&quot;&gt;BERT&lt;/span&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You handle &lt;strong&gt;tokenization&lt;/strong&gt; in spaCy by &lt;strong&gt;breaking text into tokens&lt;/strong&gt; using its efficient &lt;strong&gt;built-in tokenizer&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dependency parsing&lt;/strong&gt; in spaCy helps you understand &lt;strong&gt;grammatical structures&lt;/strong&gt; by identifying relationships between &lt;strong&gt;headwords&lt;/strong&gt; and &lt;strong&gt;dependents&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Unstructured text is produced by companies, governments, and the general population at an incredible scale. It’s often important to automate the processing and analysis of text that would be impossible for humans to process. To automate the processing and analysis of text, you need to represent the text in a format that can be understood by computers. spaCy can help you do that.&lt;/p&gt;
&lt;p&gt;If you’re new to NLP, don’t worry! Before you start using spaCy, you’ll first learn about the foundational &lt;strong&gt;terms&lt;/strong&gt; and &lt;strong&gt;concepts&lt;/strong&gt; in NLP. You should be familiar with the &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;basics in Python&lt;/a&gt;, though. The code in this tutorial contains &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionaries&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;lists, tuples&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/list-comprehension-python/&quot;&gt;comprehensions&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object oriented programming&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-lambda/&quot;&gt;lambda functions&lt;/a&gt;, among other fundamental Python concepts.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Free Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/natural-language-processing-spacy-python-code/&quot; class=&quot;alert-link&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#modal-natural-language-processing-spacy-python-code&quot; markdown&gt;Click here to download the free source code&lt;/a&gt; that you’ll use for natural language processing (NLP) in spaCy.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;introduction-to-nlp-and-spacy&quot;&gt;Introduction to NLP and spaCy&lt;a class=&quot;headerlink&quot; href=&quot;#introduction-to-nlp-and-spacy&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;NLP&lt;/strong&gt; is a subfield of &lt;a href=&quot;https://realpython.com/python-ai-neural-network/&quot;&gt;artificial intelligence&lt;/a&gt;, and it’s all about allowing computers to comprehend human language. NLP involves analyzing, quantifying, understanding, and deriving meaning from natural languages.&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; Currently, the most powerful NLP models are transformer based. &lt;a href=&quot;https://en.wikipedia.org/wiki/BERT_(Language_model)&quot;&gt;BERT&lt;/a&gt; from &lt;a href=&quot;https://research.google/research-areas/natural-language-processing/&quot;&gt;Google&lt;/a&gt; and the &lt;a href=&quot;https://en.wikipedia.org/wiki/OpenAI#Generative_models&quot;&gt;GPT family&lt;/a&gt; from &lt;a href=&quot;https://openai.com/&quot;&gt;OpenAI&lt;/a&gt; are examples of such models.&lt;/p&gt;
&lt;p&gt;Since the release of &lt;a href=&quot;https://spacy.io/usage/v3&quot;&gt;version 3.0&lt;/a&gt;, spaCy supports transformer based models. The examples in this tutorial are done with a &lt;a href=&quot;https://spacy.io/models/en&quot;&gt;smaller, CPU-optimized model&lt;/a&gt;. However, you can run the examples &lt;a href=&quot;https://spacy.io/usage/embeddings-transformers#transformers&quot;&gt;with a transformer model&lt;/a&gt; instead. All &lt;a href=&quot;https://huggingface.co/docs/transformers/index&quot;&gt;Hugging Face&lt;/a&gt; transformer models can be used with spaCy.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;NLP helps you extract insights from unstructured text and has many use cases, such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Automatic_summarization&quot;&gt;Automatic summarization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Named-entity_recognition&quot;&gt;Named-entity recognition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Question_answering&quot;&gt;Question answering systems&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/sentiment-analysis-python/&quot;&gt;Sentiment analysis&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;spaCy is a free, open-source library for NLP in Python written in &lt;a href=&quot;https://cython.org/&quot;&gt;Cython&lt;/a&gt;. It’s a modern, production-focused NLP library that emphasizes speed, streamlined workflows, and robust pretrained models. spaCy is designed to make it easy to build systems for information extraction or general-purpose natural language processing.&lt;/p&gt;
&lt;p&gt;Another popular Python NLP library that you may have heard of is Python’s &lt;a href=&quot;https://realpython.com/nltk-nlp-python/&quot;&gt;Natural Language Toolkit (NLTK)&lt;/a&gt;. NLTK is a classic toolkit that’s widely used in research and education. It offers an extensive range of algorithms and corpora but with less emphasis on high-throughput performance than spaCy.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn how to work with spaCy, which is a great choice for building production-ready NLP applications.&lt;/p&gt;
&lt;h2 id=&quot;installation-of-spacy&quot;&gt;Installation of spaCy&lt;a class=&quot;headerlink&quot; href=&quot;#installation-of-spacy&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this section, you’ll install spaCy into a &lt;a href=&quot;/ref/glossary/virtual-environment/&quot; class=&quot;ref-link&quot;&gt;virtual environment&lt;/a&gt; and then download data and models for the English language.&lt;/p&gt;
&lt;p&gt;You can install spaCy using &lt;strong&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/strong&gt;, a Python package manager. It’s a good idea to use a &lt;strong&gt;virtual environment&lt;/strong&gt; to avoid depending on system-wide packages. To learn more about virtual environments and &lt;code&gt;pip&lt;/code&gt;, check out &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;Using Python’s pip to Manage Your Projects’ Dependencies&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;Python Virtual Environments: A Primer&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;First, you’ll create a new virtual environment, activate it, and install spaCy. Select your operating system below to learn how:&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-bs-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 me-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.33eff4228e64.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-bs-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.33eff4228e64.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted me-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.33eff4228e64.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;pscon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header codeblock--yellow&quot;&gt;
    &lt;span class=&quot;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&quot;&gt;Language: &lt;/span&gt;Windows PowerShell&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.33eff4228e64.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;PS&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;gp&quot;&gt;PS&amp;gt; &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;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;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&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;spacy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;18&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.33eff4228e64.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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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;&lt;span class=&quot;nv&quot;&gt;spacy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;.8.18
&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.33eff4228e64.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 spaCy installed in your virtual environment, you’re almost ready to get started with NLP. But there’s one more thing you’ll have to install:&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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 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;spacy&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;download&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;en_core_web_sm
&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.33eff4228e64.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;There are various &lt;a href=&quot;https://spaCy.io/models&quot;&gt;spaCy models&lt;/a&gt; for different languages. The default model for the English language is designated as &lt;code&gt;en_core_web_sm&lt;/code&gt;. Since the models are quite large, it’s best to install them separately—including all languages in one package would make the download too massive.&lt;/p&gt;
&lt;p&gt;Once the &lt;code&gt;en_core_web_sm&lt;/code&gt; model has finished downloading, open up a Python &lt;a href=&quot;/ref/glossary/repl/&quot; class=&quot;ref-link&quot;&gt;REPL&lt;/a&gt; and verify that the installation has been successful:&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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;spacy&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;nlp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;spacy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;load&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;en_core_web_sm&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.33eff4228e64.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/natural-language-processing-spacy-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/natural-language-processing-spacy-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>Async Programming in Python: From Generators to asyncio</title>
      <id>https://realpython.com/python-async-features/</id>
      <link href="https://realpython.com/python-async-features/"/>
      <updated>2026-12-03T14:00:00+00:00</updated>
      <summary>Learn how Python async programming works. Write async functions with async and await, and run slow I/O operations concurrently with asyncio.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Python async&lt;/strong&gt; programming lets a single-threaded program stay busy while it waits on slow work, such as a network request, a database query, or a file read. Instead of blocking the CPU until the result arrives, your code hands control back to an &lt;strong&gt;event loop&lt;/strong&gt;, which runs other work in the meantime.&lt;/p&gt;
&lt;p&gt;You write asynchronous code with the &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;await&lt;/code&gt; keywords and run it with &lt;code&gt;asyncio&lt;/code&gt; from the standard library. An &lt;strong&gt;async function&lt;/strong&gt; is one you define with &lt;code&gt;async def&lt;/code&gt;. Calling it doesn’t run it. It returns a coroutine that runs only once you await it or schedule it on the event loop.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll arrive at that model one step at a time, starting from ordinary synchronous code and adding a single idea at each stage. Along the way, you’ll see how far you can get with &lt;a href=&quot;/ref/glossary/generator/&quot; class=&quot;ref-link&quot;&gt;generators&lt;/a&gt; alone and where &lt;code&gt;asyncio&lt;/code&gt; takes over.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How &lt;strong&gt;synchronous&lt;/strong&gt; and &lt;strong&gt;asynchronous&lt;/strong&gt; programming differ&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;blocking&lt;/strong&gt; and &lt;strong&gt;non-blocking&lt;/strong&gt; code mean in practice&lt;/li&gt;
&lt;li&gt;How the &lt;strong&gt;event loop&lt;/strong&gt; schedules tasks, and how to inspect it while it runs&lt;/li&gt;
&lt;li&gt;How to write an &lt;strong&gt;async function&lt;/strong&gt; with &lt;code&gt;async&lt;/code&gt; and &lt;code&gt;await&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;How to run tasks concurrently with &lt;strong&gt;&lt;code&gt;asyncio.TaskGroup&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The examples run on Python 3.11 and later, and the output shown comes from Python 3.14. You can grab a copy of the code to follow along by clicking the link below:&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-async-features-code/&quot; class=&quot;alert-link&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#modal-python-async-features-code&quot; markdown&gt;Click here to download the free sample code you’ll use&lt;/a&gt; to learn about async features 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.33eff4228e64.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 “Async Programming in Python: From Generators to asyncio” 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-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-async-features/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;ratio ratio-16x9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 rounded&quot; style=&quot;object-fit: contain; background: #ffc873;&quot; alt=&quot;Async Programming in Python: From Generators to asyncio&quot; src=&quot;https://files.realpython.com/media/Understanding-Asynchronous-Programming-in-Python_Watermarked.4b590c7c03ea.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Understanding-Asynchronous-Programming-in-Python_Watermarked.4b590c7c03ea.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Understanding-Asynchronous-Programming-in-Python_Watermarked.4b590c7c03ea.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Understanding-Asynchronous-Programming-in-Python_Watermarked.4b590c7c03ea.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Understanding-Asynchronous-Programming-in-Python_Watermarked.4b590c7c03ea.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.33eff4228e64.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 position-relative&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-async-features/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Async Programming in Python: From Generators to asyncio&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Test your understanding of async features in Python, including async and await, blocking versus non-blocking code, and the event loop.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;understanding-asynchronous-programming&quot;&gt;Understanding Asynchronous Programming&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-asynchronous-programming&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A &lt;strong&gt;synchronous program&lt;/strong&gt; is executed one step at a time. Even with conditional branching, loops, and function calls, you can still think about the code in terms of taking one execution step at a time. When each step is complete, the program moves on to the next one.&lt;/p&gt;
&lt;p&gt;Here are two examples of programs that work this way:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Batch-processing programs&lt;/strong&gt; are often created as synchronous programs. You get some input, process it, and create some output. Steps follow one after the other until the program reaches the desired output. The program only needs to pay attention to the steps and their order.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Quick automation scripts&lt;/strong&gt; are small processes that often run in a terminal. These scripts create something, transform one thing into something else, generate a report, or perhaps list out some data. This can be expressed as a series of program steps that are executed sequentially until the program is done.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;An &lt;strong&gt;asynchronous program&lt;/strong&gt; behaves differently. It still takes one execution step at a time. The difference is that the system may not wait for an execution step to be completed before moving on to the next one.&lt;/p&gt;
&lt;p&gt;This means that the program will move on to future execution steps even though a previous step hasn’t yet finished and is still running elsewhere. This also means that the program knows what to do when a previous step does finish running.&lt;/p&gt;
&lt;p&gt;Why would you want to write a program in this manner? The rest of this tutorial will help you answer that question and give you the tools you need to elegantly solve interesting asynchronous problems.&lt;/p&gt;
&lt;p&gt;To understand the difference between synchronous and asynchronous programming, consider a real-world example: &lt;em&gt;a web server&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;A web server’s basic unit of work is, more or less, the same as batch processing. The server will get some input, process it, and create the output. Written as a synchronous program, this would create a working web server.&lt;/p&gt;
&lt;p&gt;It would also be an &lt;em&gt;absolutely terrible&lt;/em&gt; web server.&lt;/p&gt;
&lt;p&gt;Why? In this case, one unit of work (input, process, output) is not the only purpose. The real purpose is to handle hundreds or even thousands of units of work as quickly as possible. This can happen over long periods of time, and several work units may even arrive all at once.&lt;/p&gt;
&lt;p&gt;Can a synchronous web server be made better? Sure, you could optimize the execution steps so that all the work coming in is handled as quickly as possible. Unfortunately, there are limitations to this approach. The result could be a web server that doesn’t respond fast enough, can’t handle enough work, or even times out when work gets stacked up.&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; There are other limitations you might see if you tried to optimize the above approach. These include network speed, file &lt;a href=&quot;/ref/glossary/input-output/&quot; class=&quot;ref-link&quot;&gt;I/O&lt;/a&gt; speed, database query speed, and the speed of other connected services, to name a few. What these all have in common is that they are all I/O functions. All of these items are orders of magnitude slower than the CPU’s processing speed.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In a synchronous program, if an execution step starts a database query, then the CPU is essentially idle until the query results come back. For batch-oriented programs, this isn’t a priority most of the time. Processing the results of that I/O operation is the goal. Often, this can take longer than the I/O operation itself. Any optimization efforts would be focused on the processing work, not the I/O.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/ref/glossary/asynchronous-programming/&quot; class=&quot;ref-link&quot;&gt;Asynchronous programming&lt;/a&gt; techniques allow your programs to take advantage of relatively slow I/O processes by freeing the CPU to do other work.&lt;/p&gt;
&lt;p&gt;If you’d like a real-world analogy before you start writing code, then expand the section below.&lt;/p&gt;
&lt;div class=&quot;disclosure-panel-wrap&quot;&gt;&lt;disclosure-panel class=&quot;disclosure-panel&quot;&gt;&lt;button type=&quot;button&quot; class=&quot;disclosure-panel__trigger&quot; aria-expanded=&quot;false&quot;&gt;&lt;span class=&quot;disclosure-panel__title&quot;&gt;Thinking Differently About Programming: A Parent’s Analogy&lt;/span&gt;&lt;span class=&quot;icon baseline disclosure-panel__chevron&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.33eff4228e64.svg#regular--chevron-down&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;&lt;div class=&quot;disclosure-panel__body&quot; role=&quot;region&quot; aria-label=&quot;Thinking Differently About Programming: A Parent’s Analogy&quot; inert&gt;&lt;div class=&quot;disclosure-panel__content&quot;&gt;&lt;div class=&quot;disclosure-panel__content-inner&quot;&gt;&lt;p&gt;When you start learning asynchronous programming, you’ll run into a lot of discussion about blocking and &lt;a href=&quot;/ref/glossary/non-blocking-operation/&quot; class=&quot;ref-link&quot;&gt;non-blocking&lt;/a&gt; code. Those terms stay abstract until you connect them to something familiar.&lt;/p&gt;
&lt;p&gt;Writing asynchronous programs asks you to think differently about a program’s flow. That shift can be hard to wrap your head around at first, but the real world is almost entirely asynchronous, and so is the way you move through it.&lt;/p&gt;
&lt;p&gt;Imagine you’re a parent trying to do several things at once. You have to balance the checkbook, do the laundry, and keep an eye on the kids. Somehow, you manage all three without much conscious effort, following a few strategies to keep everything moving along:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Balancing the checkbook is a &lt;strong&gt;synchronous&lt;/strong&gt; task, because one step follows another until it’s done. You’re doing all the work yourself.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Doing the laundry, though, lets you break away from the checkbook. You unload the dryer, move clothes from the washer to the dryer, and start another load in the washer.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Working with the washer and dryer is a synchronous task, but the bulk of the work happens &lt;em&gt;after&lt;/em&gt; the washer and dryer are started. Once you’ve got them going, you can walk away and get back to the checkbook task. At this point, the washer and dryer tasks have become &lt;strong&gt;asynchronous&lt;/strong&gt;. The washer and dryer will run independently until the buzzer goes off (notifying you that the task needs attention).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Watching your kids is another asynchronous task. Once they are set up and playing, they can do so independently for the most part. This changes when someone needs attention, like when someone gets hungry or hurt. When one of your kids yells in alarm, you react. The kids are a long-running task with high priority. Watching them supersedes any other tasks you might be doing, like the checkbook or laundry.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These examples illustrate blocking and non-blocking tasks. In programming terms, you’re the CPU. While you’re moving the laundry around, you’re busy and blocked from doing other work, like balancing the checkbook. That’s fine, because the task is quick.&lt;/p&gt;
&lt;p&gt;On the other hand, starting the washer and dryer doesn’t block you from performing other tasks. It’s an asynchronous task because you don’t have to wait for it to finish. Once it’s started, you can go back to something else. This is called a context switch: the context of what you’re doing has changed, and the machine’s buzzer will notify you sometime in the future when the laundry task is complete.&lt;/p&gt;
&lt;p&gt;As a human, this is how you work all the time. You naturally juggle multiple things at once, often without thinking about it. As a developer, the trick is how to translate this kind of behavior into code that does the same kind of thing.&lt;/p&gt;
&lt;p&gt;If you recognize yourself (or your parents) in the example above, then that’s great! You’ve got a leg up in understanding asynchronous programming. Again, you’re able to switch contexts between competing tasks fairly easily, picking up some tasks and resuming others. Now you’re going to try and program this behavior into virtual parents!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Experiment #1: The Synchronous Parent&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;How would you create a parent program to do the above tasks in a completely synchronous manner? Since watching the kids is a high-priority task, perhaps your program would do just that. The parent watches over the kids while waiting for something to happen that might need their attention. However, nothing else (like the checkbook or laundry) would get done in this scenario.&lt;/p&gt;
&lt;p&gt;Now, you can reprioritize the tasks any way you want, but only one of them would happen at any given time. That’s the result of a synchronous, step-by-step approach. Like the synchronous web server described above, this would work, but it might not be the best way to live.&lt;/p&gt;
&lt;p&gt;The parent couldn’t complete any other task until the kids fell asleep. Everything else would happen afterward, well into the night. A couple of weeks of this and many real parents might jump out the window!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Experiment #2: The Polling Parent&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If you used &lt;a href=&quot;https://en.wikipedia.org/wiki/Polling_(computer_science)&quot;&gt;polling&lt;/a&gt;, then you could change things up so that multiple tasks are completed. In this approach, the parent would periodically break away from the current task and check to see if any other tasks need attention.&lt;/p&gt;
&lt;p&gt;Say the polling interval is fifteen minutes. Every fifteen minutes, your parent checks whether the washer, dryer, or kids need attention. If not, then they go back to the checkbook. If any of those tasks &lt;em&gt;do&lt;/em&gt; need attention, then they handle it before returning to the checkbook. The cycle repeats until the next timeout of the polling loop.&lt;/p&gt;
&lt;p&gt;This approach also works, since multiple tasks are getting attention. However, there are a couple of problems:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;The parent may spend a lot of time checking on things that don’t need attention:&lt;/strong&gt; The washer and dryer haven’t yet finished, and the kids don’t need any attention unless something unexpected happens.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;The parent may miss completed tasks that do need attention:&lt;/strong&gt; For instance, if the washer finished its cycle at the beginning of the polling interval, then it wouldn’t get any attention for up to fifteen minutes! What’s more, watching the kids is supposedly the highest-priority task. They couldn’t tolerate fifteen minutes with no attention when something might be going drastically wrong.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You could address these issues by shortening the polling interval, but now your parent (the CPU) would be spending more time context switching between tasks. This is when you start to hit a point of diminishing returns. (Once again, a couple of weeks living like this and, well… See the previous comment about windows and jumping.)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Experiment #3: The Threading Parent&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;“If I could only clone myself…” If you’re a parent, then you’ve probably had similar thoughts! Since you’re programming virtual parents, you can essentially do this by using threading. This is a mechanism that allows multiple sections of one program to run at the same time. Each section of code that runs independently is known as a &lt;a href=&quot;/ref/glossary/thread/&quot; class=&quot;ref-link&quot;&gt;thread&lt;/a&gt;, and all threads share the same memory space.&lt;/p&gt;
&lt;p&gt;If you think of each task as a part of one program, then you can separate them and run them as threads. In other words, you can “clone” the parent, creating one instance for each task: watching the kids, monitoring the washer, monitoring the dryer, and balancing the checkbook. All of these “clones” are running independently.&lt;/p&gt;
&lt;p&gt;This sounds like a pretty nice solution, but there are some issues here as well. One is that you’ll have to explicitly tell each parent instance what to do in your program. This can lead to some problems since all instances share everything in the program space.&lt;/p&gt;
&lt;p&gt;For example, say that Parent A is monitoring the dryer. The clothes are dry, so Parent A takes control of the dryer and begins unloading them.&lt;/p&gt;
&lt;p&gt;At the same time, Parent B sees that the washer is done and takes control of it to remove the wet clothes. But Parent B also needs the dryer to put those clothes inside, and Parent A is still holding it.&lt;/p&gt;
&lt;p&gt;After a short while, Parent A has finished unloading clothes. Now they want to take control of the washer and start moving clothes into the empty dryer. This can’t happen, either, because Parent B currently has control of the washer!&lt;/p&gt;
&lt;p&gt;These two parents are now &lt;a href=&quot;https://realpython.com/intro-to-python-threading/#deadlock&quot;&gt;deadlocked&lt;/a&gt;. Both have control of their own resource &lt;em&gt;and&lt;/em&gt; want control of the other resource. They’ll wait forever for the other parent instance to release control. As the programmer, you’d have to write code to work this situation out.&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; Threaded programs allow you to create multiple, parallel paths of execution that all share the same memory space. This is both an advantage and a disadvantage. Any memory shared between threads is subject to one or more threads trying to use the same shared memory at the same time. This can lead to data corruption, data read in an invalid state, and data that’s just messy in general.&lt;/p&gt;
&lt;p&gt;In threaded programming, the context switch happens under the system’s control, not the programmer’s. The system controls when to switch contexts and when to give threads access to shared data, thereby changing the context of how the memory is being used. All of these kinds of problems are manageable in threaded code, but it’s difficult to get right and hard to debug when it’s wrong.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Here’s another issue that might arise from threading. Suppose that a child gets hurt and needs to be taken to urgent care. Parent C has been assigned the task of watching over the kids, so they take the child right away. At the urgent care, Parent C needs to write a fairly large check to cover the cost of seeing the doctor.&lt;/p&gt;
&lt;p&gt;Meanwhile, Parent D is at home working on the checkbook. They’re unaware of this large check being written, so they’re very surprised when the family checking account is suddenly overdrawn!&lt;/p&gt;
&lt;p&gt;Remember, these two parent instances are working within the same program. The family checking account is a shared resource, so you’d have to work out a way for the child-watching parent to inform the checkbook-balancing parent. Otherwise, you’d need to provide some kind of locking mechanism so that the checkbook resource can only be used by one parent at a time.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/disclosure-panel&gt;&lt;/div&gt;

&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-async-features/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-async-features/ »&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>Python Constants: Improve Your Code&#x27;s Maintainability</title>
      <id>https://realpython.com/python-constants/</id>
      <link href="https://realpython.com/python-constants/"/>
      <updated>2026-12-03T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to properly define constants in Python. By coding a bunch of practical example, you&#x27;ll also learn how Python constants can improve your code&#x27;s readability, reusability, and maintainability.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In Python, constants are &lt;a href=&quot;/ref/glossary/identifier/&quot; class=&quot;ref-link&quot;&gt;identifiers&lt;/a&gt; for values that don’t change during a program’s execution. Unlike some other languages, Python lacks built-in syntax for constants, treating them as variables that should remain unchanged. You define constants by following a naming convention: use all uppercase letters with underscores separating words. This signals to other developers that these variables should not be reassigned.&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;Constants in Python&lt;/strong&gt; are variables that should remain unchanged throughout execution.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Python lacks built-in syntax&lt;/strong&gt; for constants, relying on conventions to signal immutability.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Defining a constant&lt;/strong&gt; involves using uppercase letters with underscores for clarity.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Best practices&lt;/strong&gt; include defining constants at the top of a file and using descriptive names.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Built-in constants like &lt;code&gt;math.pi&lt;/code&gt;&lt;/strong&gt; offer predefined, reliable values, unlike user-defined ones.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To learn the most from this tutorial, you’ll need basic knowledge of Python &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&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-modules-packages/&quot;&gt;modules, packages&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-namespaces-scope/&quot;&gt;namespaces&lt;/a&gt;. You’ll also need to know the basics of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; in Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Sample Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-constants-code/&quot; class=&quot;alert-link&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#modal-python-constants-code&quot; markdown&gt;Click here to download a Circle class in three versions&lt;/a&gt; that shows how named constants replace a hard-coded 3.14.&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.33eff4228e64.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 Constants: Improve Your Code&#x27;s Maintainability” 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-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-constants/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;ratio ratio-16x9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 rounded&quot; style=&quot;object-fit: contain; background: #b9abe6;&quot; alt=&quot;Python Constants: Improve Your Code&#x27;s Maintainability&quot; src=&quot;https://files.realpython.com/media/Python-Constants_Watermarked.4cc3aa373268.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-Constants_Watermarked.4cc3aa373268.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Python-Constants_Watermarked.4cc3aa373268.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Python-Constants_Watermarked.4cc3aa373268.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Python-Constants_Watermarked.4cc3aa373268.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.33eff4228e64.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 position-relative&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-constants/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python Constants: Improve Your Code&#x27;s Maintainability&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Test your understanding of Python constants. Check how you name them, where you define them, and which ones Python actually enforces.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Python for Beginners Live Course:&lt;/strong&gt; Want to practice writing clean, maintainable Python from the ground up? In Real Python’s &lt;a href=&quot;https://realpython.com/workshops/python-for-beginners/&quot;&gt;Python for Beginners&lt;/a&gt; live course, you build real programs with an instructor in a small group, with live feedback when you get stuck. Join the waitlist to hear about the next dates.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;understanding-constants-and-variables&quot;&gt;Understanding Constants and Variables&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-constants-and-variables&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Variables&lt;/strong&gt; and &lt;strong&gt;constants&lt;/strong&gt; are two historical and fundamental concepts in computer programming. Most programming languages use these concepts to manipulate data and work in an effective and logical fashion.&lt;/p&gt;
&lt;p&gt;Variables and constants will probably be present in each project, app, library, or other piece of code that you’ll ever write. The question is: what are variables and constants in practice?&lt;/p&gt;
&lt;h3 id=&quot;what-variables-are&quot;&gt;What Variables Are&lt;a class=&quot;headerlink&quot; href=&quot;#what-variables-are&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In math, a variable is defined as a symbol that refers to a value or quantity that &lt;em&gt;can&lt;/em&gt; change over time. In programming, a variable is also a symbol or name typically associated with a memory address containing a value, object, or piece of data. Like in math, the content of a programming variable can change during the execution of the code that defines it.&lt;/p&gt;
&lt;p&gt;Variables typically have a descriptive name that’s somehow associated with a target value or object. This target value can be of any data type. So, you can use variables to represent &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;numbers&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt;, sequences, custom objects, and more.&lt;/p&gt;
&lt;p&gt;You can perform two main operations on a variable:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Access&lt;/strong&gt; its value&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Assign&lt;/strong&gt; it a new value&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In most programming languages, you can access the value associated with a variable by citing the variable’s name in your code. To assign a new value to a given variable, you’ll use an &lt;a href=&quot;https://realpython.com/python-variables/#variable-assignment&quot;&gt;assignment&lt;/a&gt; statement, which often consists of the variable’s name, an &lt;a href=&quot;https://realpython.com/python-assignment-operator/&quot;&gt;assignment operator&lt;/a&gt;, and the desired value.&lt;/p&gt;
&lt;p&gt;In practice, you’ll find many examples of magnitudes, data, and objects that you can represent as variables. A few examples include temperature, speed, time, and length. Other examples of data that you can treat as variables include the number of registered users in a &lt;a href=&quot;https://realpython.com/python-web-applications/&quot;&gt;web app&lt;/a&gt;, the number of active characters in a &lt;a href=&quot;https://realpython.com/platformer-python-arcade/&quot;&gt;video game&lt;/a&gt;, and the number of miles covered by a runner.&lt;/p&gt;
&lt;h3 id=&quot;what-constants-are&quot;&gt;What Constants Are&lt;a class=&quot;headerlink&quot; href=&quot;#what-constants-are&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Math also has the concept of &lt;strong&gt;constants&lt;/strong&gt;. The term refers to a value or quantity that &lt;em&gt;never&lt;/em&gt; changes. In programming, constants refer to names associated with values that never change during a program’s execution.&lt;/p&gt;
&lt;p&gt;Just like variables, programming constants consist of two things: a name and an associated value. The name will clearly describe what the constant is all about. The value is the concrete expression of the constant itself.&lt;/p&gt;
&lt;p&gt;Like with variables, the value associated with a given constant can be of any of data type. So, you can define integer constants, floating-point constants, character constants, string constants, and more.&lt;/p&gt;
&lt;p&gt;After you’ve defined a constant, it’ll only allow you to perform a single operation on it. You can only &lt;em&gt;access&lt;/em&gt; the constant’s value but not change it over time. This is different from a variable, which allows you to access its value, but also reassign it.&lt;/p&gt;
&lt;p&gt;You’ll use constants to represent values that won’t change. You’ll find lots of these values in your day-to-day programming. A few examples include the speed of light, the number of minutes in an hour, and the name of a project’s root folder.&lt;/p&gt;
&lt;h3 id=&quot;why-use-constants&quot;&gt;Why Use Constants&lt;a class=&quot;headerlink&quot; href=&quot;#why-use-constants&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In most programming languages, constants protect you from accidentally changing their values somewhere in the code when you’re coding at two in the morning, causing unexpected and hard-to-debug errors. Constants also help you make your code more readable and maintainable.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-constants/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-constants/ »&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>Introducing RealJS: The Real Python Approach, Now for JavaScript</title>
      <id>https://realpython.com/introducing-realjs/</id>
      <link href="https://realpython.com/introducing-realjs/"/>
      <updated>2026-12-03T14:00:00+00:00</updated>
      <summary>RealJS, the JavaScript sibling of Real Python, is live. Here&#x27;s why we built it, what it means for Real Python, and where Python developers can start.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Today, I’m excited to share something our team has been working toward for a long time: &lt;strong&gt;&lt;a href=&quot;https://realjs.com/&quot;&gt;RealJS&lt;/a&gt; is live!&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;It’s the JavaScript sibling of Real Python, built by the same team, with the same approach to teaching that you know from this site.&lt;/p&gt;
&lt;p&gt;We’ve been working on RealJS behind the scenes for a while now. It runs on the same custom learning platform that powers Real Python, and we didn’t want to open the doors until it was ready. &lt;/p&gt;
&lt;p&gt;RealJS launches as a complete package from day one: well over a hundred courses, hundreds of interactive coding exercises, quizzes, guided learning paths, and an AI mentor you can ask for help at any time. Three of our learning paths we built specifically for Python developers.&lt;/p&gt;
&lt;div&gt;





&lt;video-player-next class=&quot;video-player-next rounded mb-3&quot; style=&quot;aspect-ratio: 3840/2160;&quot; data-src=&quot;https://stream.realpython.com/0436fa09-3185-40a5-874b-03f29da63433/playlist.m3u8&quot; data-thumbnails-url=&quot;/video-thumbnails/2c982164-010d-4a57-b957-1c08751630a4.vtt?v=0436fa09-3185-40a5-874b-03f29da63433&quot; data-thumbnails-cols=&quot;6&quot; data-thumbnails-rows=&quot;6&quot; data-title=&quot;Introducing to RealJS&quot;&gt;


    &lt;img class=&quot;video-player-next__poster&quot; src=&quot;/cdn-cgi/image/width=1280,format=auto/https://files.realpython.com/media/realjs-intro-thumb-5.949c1faf1842.jpg&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/realjs-intro-thumb-5.949c1faf1842.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/realjs-intro-thumb-5.949c1faf1842.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/realjs-intro-thumb-5.949c1faf1842.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/realjs-intro-thumb-5.949c1faf1842.jpg 1920w&quot; alt=&quot;Introducing to RealJS&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot;&gt;

&lt;/video-player-next&gt;



&lt;/div&gt;

&lt;p&gt;Before I tell you more about it, let me answer the question you might be asking yourself…&lt;/p&gt;
&lt;h2 id=&quot;real-python-is-here-to-stay&quot;&gt;Real Python Is Here to Stay!&lt;a class=&quot;headerlink&quot; href=&quot;#real-python-is-here-to-stay&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Real Python isn’t slowing down or changing focus. We’ll keep publishing our top-notch learning resources such as tutorials, &lt;a href=&quot;https://realpython.com/courses/&quot;&gt;courses&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/podcasts/rpp/&quot;&gt;podcast episodes&lt;/a&gt; for Pythonistas, just like we have for years. &lt;/p&gt;
&lt;p&gt;RealJS is an addition, not a replacement. In fact, the two go hand in hand! But more on that later.&lt;/p&gt;
&lt;h2 id=&quot;why-javascript-and-why-now&quot;&gt;Why JavaScript, and Why Now&lt;a class=&quot;headerlink&quot; href=&quot;#why-javascript-and-why-now&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Since the early days of Real Python, it’s been my dream to bring the Real Python formula to other programming communities. JavaScript was the logical next step.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/introducing-realjs/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/introducing-realjs/ »&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>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-12-03T14: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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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;Try It Yourself:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-sleep-code/&quot; class=&quot;alert-link&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#modal-python-sleep-code&quot; markdown&gt;Get the code examples&lt;/a&gt; you need 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.33eff4228e64.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-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;ratio ratio-16x9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 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.33eff4228e64.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 position-relative&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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.33eff4228e64.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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    &lt;span class=&quot;me-2&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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; &lt;a href=&quot;/ref/glossary/module/&quot; class=&quot;ref-link&quot;&gt;module&lt;/a&gt;:&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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.33eff4228e64.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 &lt;a href=&quot;/ref/glossary/statement/&quot; class=&quot;ref-link&quot;&gt;statement&lt;/a&gt; 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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    &lt;span class=&quot;me-2&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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 create &lt;code&gt;uptime_bot()&lt;/code&gt;, which takes a URL as its &lt;a href=&quot;/ref/glossary/argument/&quot; class=&quot;ref-link&quot;&gt;argument&lt;/a&gt;. The function then attempts to open that URL with &lt;a href=&quot;https://realpython.com/urllib-request/&quot;&gt;&lt;code&gt;urllib&lt;/code&gt;&lt;/a&gt;. If there’s an &lt;code&gt;HTTPError&lt;/code&gt; or &lt;code&gt;URLError&lt;/code&gt;, then the program catches it and prints out the error. In a live environment, you would log the error and probably send an email to the webmaster or system administrator.&lt;/p&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>Iterators and Iterables in Python: Run Efficient Iterations</title>
      <id>https://realpython.com/python-iterators-iterables/</id>
      <link href="https://realpython.com/python-iterators-iterables/"/>
      <updated>2026-12-03T14:00:00+00:00</updated>
      <summary>Learn what Python iterators and iterables are, how they differ, and how to write your own to make your data processing more efficient.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Understanding iterators and iterables in Python is crucial for running efficient iterations. Iterators control loops, allowing you to traverse arbitrary data containers one item at a time. Iterables, on the other hand, provide the data that you want to iterate over. By mastering these concepts, you can create robust code that handles data efficiently, even when working with large datasets or infinite data streams.&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;Python iterators&lt;/strong&gt; are &lt;a href=&quot;/ref/glossary/object/&quot; class=&quot;ref-link&quot;&gt;objects&lt;/a&gt; with &lt;strong&gt;&lt;code&gt;.__iter__()&lt;/code&gt; and &lt;code&gt;.__next__()&lt;/code&gt;&lt;/strong&gt; &lt;a href=&quot;/ref/glossary/method/&quot; class=&quot;ref-link&quot;&gt;methods&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Iterables&lt;/strong&gt; are objects that can return an iterator using the &lt;strong&gt;&lt;code&gt;.__iter__()&lt;/code&gt;&lt;/strong&gt; method.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Generator functions&lt;/strong&gt; use the &lt;strong&gt;&lt;code&gt;yield&lt;/code&gt; statement&lt;/strong&gt; to create &lt;strong&gt;generator iterators&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Asynchronous iterators&lt;/strong&gt; use &lt;strong&gt;&lt;code&gt;.__aiter__()&lt;/code&gt; and &lt;code&gt;.__anext__()&lt;/code&gt;&lt;/strong&gt; for async operations.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Iterators&lt;/strong&gt; are memory-efficient and can handle &lt;strong&gt;infinite data streams&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Before diving deeper into these topics, you should be familiar with some core concepts like &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;loops and iteration&lt;/a&gt;, &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;, &lt;a href=&quot;https://realpython.com/python-classes/#special-methods-and-protocols&quot;&gt;special methods&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/async-io-python/&quot;&gt;asynchronous programming&lt;/a&gt; in Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown&gt;Free Sample Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-iterators-iterables-code/&quot; class=&quot;alert-link&quot; data-bs-toggle=&quot;modal&quot; data-bs-target=&quot;#modal-python-iterators-iterables-code&quot; markdown&gt;Click here to download a data pipeline example&lt;/a&gt; that chains generators to square, cube, and filter numbers without building lists in memory.&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.33eff4228e64.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 “Iterators and Iterables in Python: Run Efficient Iterations” 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-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-iterators-iterables/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;ratio ratio-16x9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 rounded&quot; style=&quot;object-fit: contain; background: #e5c5ac;&quot; alt=&quot;Iterators and Iterables in Python: Run Efficient Iterations&quot; src=&quot;https://files.realpython.com/media/Iterators-and-Iterables-in-Python-What-Are-They-and-How-to-Use-Them_Watermarked.5df74332ac58.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Iterators-and-Iterables-in-Python-What-Are-They-and-How-to-Use-Them_Watermarked.5df74332ac58.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Iterators-and-Iterables-in-Python-What-Are-They-and-How-to-Use-Them_Watermarked.5df74332ac58.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Iterators-and-Iterables-in-Python-What-Are-They-and-How-to-Use-Them_Watermarked.5df74332ac58.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Iterators-and-Iterables-in-Python-What-Are-They-and-How-to-Use-Them_Watermarked.5df74332ac58.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.33eff4228e64.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 position-relative&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-iterators-iterables/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Iterators and Iterables in Python: Run Efficient Iterations&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;In this quiz, you&#x27;ll test your understanding of Python&#x27;s iterators and iterables. By working through this quiz, you&#x27;ll revisit how to create and work with iterators and iterables, the differences between them, and review how to use generator functions.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Intermediate Python Deep Dive Live Course:&lt;/strong&gt; Want to keep going with iterators and generators? Real Python’s &lt;a href=&quot;https://realpython.com/workshops/intermediate-deep-dive/&quot;&gt;Intermediate Python Deep Dive&lt;/a&gt; live course covers advanced iteration techniques, special methods, and Python’s object model with an instructor and a small cohort. Join the waitlist to hear about the next dates.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;understanding-iteration-in-python&quot;&gt;Understanding Iteration in Python&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-iteration-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When writing computer programs, you often need to repeat a given piece of code multiple times. To do this, you can follow one of the following approaches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Repeating the target code as many times as you need in a sequence&lt;/li&gt;
&lt;li&gt;Putting the target code in a &lt;a href=&quot;/ref/glossary/loop/&quot; class=&quot;ref-link&quot;&gt;loop&lt;/a&gt; that runs as many times as you need&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The first approach has a few drawbacks. The most troublesome issue is the repetitive code itself, which is hard to maintain and not scalable. For example, the following code will print a greeting message on your screen three times:&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&quot;&gt;Language: &lt;/span&gt;Python&lt;/span&gt;
    &lt;span class=&quot;me-2&quot;&gt;&lt;span class=&quot;visually-hidden&quot;&gt;Filename: &lt;/span&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;greeting.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;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;Hello!&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;Hello!&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;Hello!&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.33eff4228e64.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;, then you’ll get &lt;code&gt;&#x27;Hello!&#x27;&lt;/code&gt; printed on your screen three times. This code works. However, what if you decide to update your code to print &lt;code&gt;&#x27;Hello, World!&#x27;&lt;/code&gt; instead of just &lt;code&gt;&#x27;Hello!&#x27;&lt;/code&gt;? In that case, you’ll have to update the greeting message three times, which is a maintenance burden.&lt;/p&gt;
&lt;p&gt;Now imagine a similar situation but with a larger and more complex piece of code. It can become a nightmare for maintainers.&lt;/p&gt;
&lt;p&gt;Using a loop will be a much better way to solve the problem and avoid the maintainability issue. Loops allow you to run a piece of code as often as you need. Consider how you’d write the above example using a &lt;code&gt;while&lt;/code&gt; loop:&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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;times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&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;gp&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;Hello!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello!&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.33eff4228e64.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;This &lt;a href=&quot;https://realpython.com/python-while-loop/&quot;&gt;&lt;code&gt;while&lt;/code&gt; loop&lt;/a&gt; runs as long as the loop-continuation condition (&lt;code&gt;times &amp;lt; 3&lt;/code&gt;) remains true. In each iteration, the loop prints your greeting message and increments the control variable, &lt;code&gt;times&lt;/code&gt;. Now, if you decide to update your message, then you just have to modify one line, which makes your code way more maintainable.&lt;/p&gt;
&lt;p&gt;Python’s &lt;code&gt;while&lt;/code&gt; loop supports what’s known as &lt;a href=&quot;https://realpython.com/python-while-loop/&quot;&gt;indefinite iteration&lt;/a&gt;, which means executing the same block of code over and over again, a potentially undefined number of times.&lt;/p&gt;
&lt;p&gt;You’ll also find a different but similar type of iteration known as definite iteration, which means going through the same code a predefined number of times. This kind of iteration is especially useful when you need to iterate over the items of a data stream one by one in a loop.&lt;/p&gt;
&lt;p&gt;To run an iteration like this, you typically use a &lt;code&gt;for&lt;/code&gt; loop in Python:&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;me-2 noselect&quot;&gt;&lt;span class=&quot;visually-hidden&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.33eff4228e64.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;numbers&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;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&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;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&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;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&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;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;5&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.33eff4228e64.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 example, the &lt;code&gt;numbers&lt;/code&gt; &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;list&lt;/a&gt; represents your stream of data, which you’ll generically refer to as an &lt;a href=&quot;#getting-to-know-python-iterables&quot;&gt;iterable&lt;/a&gt; because you can iterate over it, as you’ll learn later in this tutorial. The loop goes over each value in &lt;code&gt;numbers&lt;/code&gt; and prints it to your screen.&lt;/p&gt;
&lt;p&gt;When you use a &lt;code&gt;while&lt;/code&gt; or &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/a&gt; to repeat a piece of code several times, you’re actually running an &lt;strong&gt;iteration&lt;/strong&gt;. That’s the name given to the process itself.&lt;/p&gt;
&lt;p&gt;In Python, if your iteration process requires going through the values or items in a data collection one item at a time, then you’ll need another piece to complete the puzzle. You’ll need an &lt;strong&gt;iterator&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&quot;getting-to-know-python-iterators&quot;&gt;Getting to Know Python Iterators&lt;a class=&quot;headerlink&quot; href=&quot;#getting-to-know-python-iterators&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-iterators-iterables/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-iterators-iterables/ »&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: Python itertools By Example</title>
      <id>https://realpython.com/quizzes/python-itertools/</id>
      <link href="https://realpython.com/quizzes/python-itertools/"/>
      <updated>2026-12-03T12:00:00+00:00</updated>
      <summary>Test your understanding of Python&#x27;s itertools module by working with batched(), combinations(), accumulate(), groupby(), and other iterator tools.</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-itertools/&quot;&gt;Python itertools By Example&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how &lt;code&gt;itertools&lt;/code&gt; functions compose into
memory-efficient iterator pipelines, how to split data into chunks with &lt;code&gt;batched()&lt;/code&gt;, how
combinatoric and infinite iterators work, and how tools like &lt;code&gt;filterfalse()&lt;/code&gt;, &lt;code&gt;dropwhile()&lt;/code&gt;,
and &lt;code&gt;groupby()&lt;/code&gt; help you analyze real data.&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: Build an AI Agent From Scratch in Python: The Agentic Loop</title>
      <id>https://realpython.com/quizzes/agentic-loop/</id>
      <link href="https://realpython.com/quizzes/agentic-loop/"/>
      <updated>2026-12-02T12:00:00+00:00</updated>
      <summary>Test your understanding of how an AI agent works in Python, from the harness and conversation context to tool calls and the agentic loop.</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/agentic-loop/&quot;&gt;Build an AI Agent From Scratch in Python: The Agentic Loop&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit what turns a language model into an agent: the harness around it, the conversation context it resends, the tools it can ask for, and the loop that lets it chain tool calls until it has an answer.&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>Plotting Declarative Charts With Altair</title>
      <id>https://realpython.com/courses/plotting-declarative-charts-with-altair/</id>
      <link href="https://realpython.com/courses/plotting-declarative-charts-with-altair/"/>
      <updated>2026-12-01T14:00:00+00:00</updated>
      <summary>Learn to build interactive Python charts with Altair by mapping data to visual channels, faceting, linking selections, and exporting to HTML.</summary>
      <content type="html">
        &lt;p&gt;There&amp;rsquo;s a moment many data analysts know well: you have a new dataset and a clear question, and you open a notebook only to find yourself writing boilerplate axis and figure setup before you&amp;rsquo;ve even looked at the data. Matplotlib gives you fine-grained control, but that control comes with a cost. Altair takes a completely different approach to data visualization in Python.&lt;/p&gt;
&lt;p&gt;Instead of scripting every visual detail, you describe &lt;em&gt;what&lt;/em&gt; your data means. This includes specifying which column goes on which axis, what to color, and what to make interactive. Altair then generates the visualization.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re wondering whether it&amp;rsquo;s worth adding another visualization library to your toolkit, here&amp;rsquo;s how Altair and Matplotlib compare:&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;Use Case&lt;/th&gt;
&lt;th class=&quot;text-center&quot;&gt;Pick Altair&lt;/th&gt;
&lt;th class=&quot;text-center&quot;&gt;Pick Matplotlib&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Interactive exploratory charts in notebooks&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pixel-precise publication figures or 3D plots&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;—&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Altair generates &lt;strong&gt;web-native&lt;/strong&gt; charts. The output is HTML and JavaScript, which means charts render right in your notebook and can be saved as standalone HTML files or embedded in web pages. It&amp;rsquo;s not a replacement for Matplotlib, and it doesn&amp;rsquo;t try to be. Think of them as tools you reach for in different situations.&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: Using Python for Data Analysis</title>
      <id>https://realpython.com/quizzes/using-python-for-data-analysis/</id>
      <link href="https://realpython.com/quizzes/using-python-for-data-analysis/"/>
      <updated>2026-12-01T12:00:00+00:00</updated>
      <summary>Test your understanding of a Python data analysis workflow, from cleansing data with pandas to running a linear regression with scikit-learn.</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/using-python-for-data-analysis/&quot;&gt;Using Python for Data Analysis&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit the stages of a data analysis workflow, how
to fix missing values, wrong data types, out-of-range values, and duplicates with pandas, and how to fit
a linear regression with scikit-learn.&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: Generating Python Tests With AI: A Suite You Can Trust</title>
      <id>https://realpython.com/quizzes/ai-python-test-generation/</id>
      <link href="https://realpython.com/quizzes/ai-python-test-generation/"/>
      <updated>2026-11-30T12:00:00+00:00</updated>
      <summary>Check how well you can generate Python tests with AI, from behavior tables and branch coverage to mutation testing with mutmut.</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/ai-python-test-generation/&quot;&gt;Generating Python Tests With AI: A Suite You Can Trust&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how standing testing conventions guide
an AI coding agent, why you review behavior tables before generating tests, how to
test both sides of a boundary, which red flags to look for in AI-generated tests, and
how branch coverage and mutation testing with &lt;code&gt;mutmut&lt;/code&gt; confirm that your suite holds up.&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: What Are Python Wheels and Why Should You Care?</title>
      <id>https://realpython.com/quizzes/python-wheels/</id>
      <link href="https://realpython.com/quizzes/python-wheels/"/>
      <updated>2026-11-29T12:00:00+00:00</updated>
      <summary>Test your understanding of Python wheels, how they compare to source distributions, and how to build portable wheels for your own packages.</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-wheels/&quot;&gt;What Are Python Wheels and Why Should You Care?&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how wheels compare to source distributions,
how to read wheel filename tags, how to tell &lt;code&gt;pip&lt;/code&gt; which formats to install, and how to
build platform and &lt;code&gt;manylinux&lt;/code&gt; wheels that work across many systems.&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: What Are Python Asterisk and Slash Special Parameters For?</title>
      <id>https://realpython.com/quizzes/python-asterisk-and-slash-special-parameters/</id>
      <link href="https://realpython.com/quizzes/python-asterisk-and-slash-special-parameters/"/>
      <updated>2026-11-28T12:00:00+00:00</updated>
      <summary>Test your understanding of how Python&#x27;s asterisk and slash special parameters control positional-only and keyword-only arguments.</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-asterisk-and-slash-special-parameters/&quot;&gt;What Are Python Asterisk and Slash Special Parameters For?&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how the bare asterisk and the slash split
a function&amp;rsquo;s parameters into positional-only, positional-or-keyword, and keyword-only
groups. You&amp;rsquo;ll also review how they relate to &lt;code&gt;*args&lt;/code&gt; and how they help you keep your
functions backward compatible.&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 #320: Optimizing Python Performance &amp; Building a Django Static Site</title>
      <id>https://realpython.com/podcasts/rpp/320/</id>
      <link href="https://realpython.com/podcasts/rpp/320/"/>
      <updated>2026-11-27T12:00:00+00:00</updated>
      <summary>What goes into moving from profiling the performance of a Python program to optimizing it? What are common techniques you should consider for speeding up your code, and which ones should you avoid? 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 moving from profiling the performance of a Python program to optimizing it? What are common techniques you should consider for speeding up your code, and which ones should you avoid? 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: Python Timer Functions: Three Ways to Monitor Your Code</title>
      <id>https://realpython.com/quizzes/python-timer/</id>
      <link href="https://realpython.com/quizzes/python-timer/"/>
      <updated>2026-11-27T12:00:00+00:00</updated>
      <summary>Test your knowledge of Python timer functions, from time.perf_counter() to timers built with classes, context managers, and decorators.</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-timer/&quot;&gt;Python Timer Functions: Three Ways to Monitor Your Code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit why &lt;code&gt;time.perf_counter()&lt;/code&gt; is the go-to clock for
timing code and how to wrap a timer in a class, a context manager, and a decorator. You&amp;rsquo;ll also
review &lt;code&gt;timeit&lt;/code&gt; and &lt;code&gt;cProfile&lt;/code&gt; for benchmarking and profiling your programs.&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: Python and TOML: Read, Write, and Configure with tomllib</title>
      <id>https://realpython.com/quizzes/python-toml/</id>
      <link href="https://realpython.com/quizzes/python-toml/"/>
      <updated>2026-11-26T12:00:00+00:00</updated>
      <summary>Test your knowledge of TOML in Python. Review the syntax for tables and arrays, and read and write config files with tomllib, tomli_w, and tomlkit.</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-toml/&quot;&gt;Python and TOML: Read, Write, and Configure with tomllib&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit TOML syntax, including key-value pairs,
tables, arrays, and dates. You&amp;rsquo;ll also practice loading TOML with &lt;code&gt;tomllib&lt;/code&gt;, writing it
with &lt;code&gt;tomli_w&lt;/code&gt;, and editing existing documents with &lt;code&gt;tomlkit&lt;/code&gt; without losing comments or
formatting.&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: The No AI Slop Manifesto: A Pledge to Own What Agents Ship</title>
      <id>https://realpython.com/quizzes/no-ai-slop-manifesto/</id>
      <link href="https://realpython.com/quizzes/no-ai-slop-manifesto/"/>
      <updated>2026-11-25T12:00:00+00:00</updated>
      <summary>Check what you know about the No AI Slop Manifesto, from how it defines slop to owning AI code and what critics dispute.</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/no-ai-slop-manifesto/&quot;&gt;The No AI Slop Manifesto: A Pledge to Own What Agents Ship&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how the manifesto defines slop, why producing work got cheaper than reviewing it, and what owning AI-generated code means in practice.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll also check which problems linters and type checkers catch, why slop compounds in a codebase, and what critics dispute.&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>Build an AI Agent From Scratch in Python</title>
      <id>https://realpython.com/courses/build-ai-agent-scratch-python/</id>
      <link href="https://realpython.com/courses/build-ai-agent-scratch-python/"/>
      <updated>2026-11-24T14:00:00+00:00</updated>
      <summary>Learn how the agentic loop works by building an AI agent from scratch in Python, with conversation context and tool calling in about 90 lines of code.</summary>
      <content type="html">
        &lt;p&gt;You know how LLMs work, and you may already use AI agents to help you write code. However, an agent isn&amp;rsquo;t an LLM, and an LLM isn&amp;rsquo;t an agent. What sits between them is the agentic loop. In this video course, you&amp;rsquo;ll build an AI agent from scratch in Python by writing the harness that turns a language model into an agent. You&amp;rsquo;ll do this in about 90 lines of code, with no frameworks.&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;An &lt;strong&gt;&lt;a href=&quot;/ref/ai-coding-glossary/agent/&quot; class=&quot;ref-link&quot;&gt;AI agent&lt;/a&gt;&lt;/strong&gt; is a language model wrapped in a &lt;strong&gt;harness&lt;/strong&gt;, which is a loop that passes information between you, the model, and a set of tools.&lt;/li&gt;
&lt;li&gt;The Chat Completions &lt;a href=&quot;/ref/glossary/api/&quot; class=&quot;ref-link&quot;&gt;API&lt;/a&gt; doesn&amp;rsquo;t remember &lt;strong&gt;earlier messages between calls&lt;/strong&gt;, so the harness resends the whole &lt;strong&gt;conversation context&lt;/strong&gt; with every request.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;tool&lt;/strong&gt; is any action the harness can perform for the model, such as running a Python function. The model learns about the tool only through its description, which includes a &lt;strong&gt;&lt;a href=&quot;/ref/glossary/json/&quot; class=&quot;ref-link&quot;&gt;JSON&lt;/a&gt; schema&lt;/strong&gt; for its arguments.&lt;/li&gt;
&lt;li&gt;The model never runs a tool itself. It returns a &lt;strong&gt;tool call&lt;/strong&gt;, and the harness decides whether to run the tool and send back the result.&lt;/li&gt;
&lt;li&gt;Running the model in a &lt;strong&gt;loop&lt;/strong&gt; lets it &lt;strong&gt;chain tool calls&lt;/strong&gt;, using each result to decide its next step until it has an answer.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Build an AI Agent From Scratch Live Course:&lt;/strong&gt; Want to build an agent with an instructor? In Real Python&amp;rsquo;s &lt;a href=&quot;https://realpython.com/workshops/agentic-loops/&quot;&gt;Build an AI Agent From Scratch in Python&lt;/a&gt; live course, you write the loop by hand, then recognize every piece of it in the agents you already use, like Claude Code. Join the waitlist to hear about the next dates.&lt;/p&gt;
&lt;/div&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>Getting Started With Git</title>
      <id>https://realpython.com/courses/getting-started-with-git/</id>
      <link href="https://realpython.com/courses/getting-started-with-git/"/>
      <updated>2026-11-17T14:00:00+00:00</updated>
      <summary>Learn how to set up Git, create a repository, track and commit changes, undo mistakes with git reset, and ignore files using .gitignore.</summary>
      <content type="html">
        &lt;p&gt;This video course shows you how to use Git to track changes in a project using just a few core commands and save clean snapshots of your work. If you&amp;rsquo;ve ever changed a file, broken something, and wished you could undo it, version control makes that possible. Git keeps a running history of your files so you can see what changed and when.&lt;/p&gt;
&lt;p&gt;In this video course, you&amp;rsquo;ll set up Git locally and use the core workflow from the terminal to track and record changes in a Python project. By the end, you&amp;rsquo;ll have a working Git repository with a recorded commit history you can inspect and manage.&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 #319: Mentoring Developers Beyond the Code With Tim Schilling</title>
      <id>https://realpython.com/podcasts/rpp/319/</id>
      <link href="https://realpython.com/podcasts/rpp/319/"/>
      <updated>2026-11-13T12:00:00+00:00</updated>
      <summary>What&#x27;s it take to be a mentor to developers? Where in an engineer&#x27;s career can a mentor make an impact? This week we speak with Tim Schilling, Django Steering Council member and Djangonaut Space administrator, about mentoring Python developers.</summary>
      <content type="html">
        &lt;p&gt;What&#x27;s it take to be a mentor to developers? Where in an engineer&#x27;s career can a mentor make an impact? This week we speak with Tim Schilling, Django Steering Council member and Djangonaut Space administrator, about mentoring Python developers.&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 Coding Interview Practice: Hashing, Pointers, and Windows</title>
      <id>https://realpython.com/courses/coding-interview-practice-hashing-two-pointers-sliding-windows/</id>
      <link href="https://realpython.com/courses/coding-interview-practice-hashing-two-pointers-sliding-windows/"/>
      <updated>2026-11-10T14:00:00+00:00</updated>
      <summary>Practice hashing, two pointers, and sliding windows in Python through 20 coding interview exercises with tests, hints, and guided code reviews.</summary>
      <content type="html">
        &lt;p&gt;Build your coding interview skills with hashing, two pointers, and sliding windows. Practice each pattern, choose approaches in mixed problems, and explain the time and space costs of your solutions.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Free Kit:&lt;/strong&gt; Getting ready for interviews? Get the &lt;a href=&quot;https://realpython.com/kits/tech-career-story/&quot;&gt;Tech Career Story Kit&lt;/a&gt; with career folder templates, a quick reference, and quizzes, including a folder for your interview prep notes. You only need a free Real Python account.&lt;/p&gt;
&lt;/div&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 Coding Interview Practice: Prefix Sums and Binary Search</title>
      <id>https://realpython.com/courses/coding-interview-practice-prefix-sums-binary-search/</id>
      <link href="https://realpython.com/courses/coding-interview-practice-prefix-sums-binary-search/"/>
      <updated>2026-11-10T14:00:00+00:00</updated>
      <summary>Practice prefix sums and binary search in Python through 14 coding interview exercises with tests, efficiency checks, hints, and code reviews.</summary>
      <content type="html">
        &lt;p&gt;Build your coding interview skills with prefix sums and binary search. Practice each pattern, choose approaches in mixed problems, and explain the time and space costs of your solutions.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Free Kit:&lt;/strong&gt; Getting ready for interviews? Get the &lt;a href=&quot;https://realpython.com/kits/tech-career-story/&quot;&gt;Tech Career Story Kit&lt;/a&gt; with career folder templates, a quick reference, and quizzes, including a folder for your interview prep notes. You only need a free Real Python account.&lt;/p&gt;
&lt;/div&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 #318: Free-Threaded Python: Why Python Devs Should Know About the ABI</title>
      <id>https://realpython.com/podcasts/rpp/318/</id>
      <link href="https://realpython.com/podcasts/rpp/318/"/>
      <updated>2026-11-06T12:00:00+00:00</updated>
      <summary>Why should every Python developer know about the CPython ABI? This week on the show, we speak with Nathan Goldbaum about free-threaded Python and the changes to the Python Application Binary Interface.</summary>
      <content type="html">
        &lt;p&gt;Why should every Python developer know about the CPython ABI? This week on the show, we speak with Nathan Goldbaum about free-threaded Python and the changes to the Python Application Binary Interface.&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>Converting Documents to Markdown With MarkItDown</title>
      <id>https://realpython.com/courses/converting-documents-markdown-markitdown/</id>
      <link href="https://realpython.com/courses/converting-documents-markdown-markitdown/"/>
      <updated>2026-11-03T14:00:00+00:00</updated>
      <summary>Learn how to use MarkItDown to convert Excel files, PDFs, and images into clean Markdown that&#x27;s ready for LLMs and AI workflows.</summary>
      <content type="html">
        &lt;p&gt;The MarkItDown library lets you quickly turn PDFs, Office files, images, HTML, and URLs into LLM-ready Markdown. In this video course, you&amp;rsquo;ll install MarkItDown, use it in Python code to convert and batch-process documents, connect it to AI clients through its MCP server, and see where it falls short compared to tools like Pandoc.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Markdown&lt;/strong&gt; keeps text straightforward while preserving document structure, which makes it a good input format for &lt;strong&gt;LLMs&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;install MarkItDown&lt;/strong&gt; with &lt;code&gt;pip&lt;/code&gt; using the &lt;strong&gt;&lt;code&gt;[all]&lt;/code&gt;&lt;/strong&gt; specifier to pull in optional dependencies.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;&lt;code&gt;.convert()&lt;/code&gt;&lt;/strong&gt; method reads the input document and converts it to &lt;strong&gt;Markdown text&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;batch-convert&lt;/strong&gt; a directory of mixed file formats by looping over the files in a Python script.&lt;/li&gt;
&lt;li&gt;You can connect MarkItDown&amp;rsquo;s &lt;strong&gt;MCP server&lt;/strong&gt; to clients like &lt;strong&gt;Claude Desktop&lt;/strong&gt; to expose on-demand conversions to chats.&lt;/li&gt;
&lt;li&gt;MarkItDown can integrate with LLMs to generate &lt;strong&gt;image descriptions&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;MarkItDown has &lt;strong&gt;limitations&lt;/strong&gt; with complex layouts, where a tool like &lt;strong&gt;Pandoc&lt;/strong&gt; is a better fit.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With this foundation, you&amp;rsquo;ll be able to judge when MarkItDown is the fastest route from raw files to useful LLM context and when your project calls for a heavier-duty conversion 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>The Real Python Podcast – Episode #317: Demystifying Python Memory Management &amp; Choosing a Project Layout</title>
      <id>https://realpython.com/podcasts/rpp/317/</id>
      <link href="https://realpython.com/podcasts/rpp/317/"/>
      <updated>2026-10-30T12:00:00+00:00</updated>
      <summary>How does Python manage memory behind the scenes? What are the common ways to lay out a Python project? 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 does Python manage memory behind the scenes? What are the common ways to lay out a Python project? 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>Exploring AI Coding Agent Workflows</title>
      <id>https://realpython.com/courses/exploring-ai-coding-agent-workflows/</id>
      <link href="https://realpython.com/courses/exploring-ai-coding-agent-workflows/"/>
      <updated>2026-10-27T14:00:00+00:00</updated>
      <summary>AI coding agents come in four types: IDE, terminal, PR, and cloud. Learn how each workflow fits into modern Python development.</summary>
      <content type="html">
        &lt;p&gt;AI coding agents can read your code, reason about changes, and act on your behalf. To choose the right one, it helps to understand the four common workflow types: integrated development environment (IDE), terminal, pull request (PR), and cloud.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Identify&lt;/strong&gt; the four common &lt;strong&gt;agent interaction modes&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Understand&lt;/strong&gt; what makes &lt;strong&gt;each workflow distinct&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Recognize&lt;/strong&gt; which mode fits &lt;strong&gt;common development scenarios&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Weigh&lt;/strong&gt; the &lt;strong&gt;risks and tradeoffs&lt;/strong&gt; of each workflow&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Whether you&amp;rsquo;re pairing with an agent in your editor or handing off whole tasks to the cloud, you&amp;rsquo;ll come away knowing how much control each workflow gives you and where it&amp;rsquo;s most likely to trip you up.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Codex Live Course:&lt;/strong&gt; Want hands-on practice with one of these workflows? In Real Python&amp;rsquo;s &lt;a href=&quot;https://realpython.com/workshops/codex/&quot;&gt;Codex for Python Developers&lt;/a&gt; live course, you build an entire Python project with Codex, an AI agent that works inside your codebase. Join the waitlist to hear about the next dates.&lt;/p&gt;
&lt;/div&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>AI for Beginners: Use Agents With Confidence</title>
      <id>https://realpython.com/courses/ai-agents-101/</id>
      <link href="https://realpython.com/courses/ai-agents-101/"/>
      <updated>2026-10-26T14:00:00+00:00</updated>
      <summary>Learn how AI agents really work, from models and harnesses to context and skills, so you can get better results and stay in control.</summary>
      <content type="html">
        &lt;p&gt;AI agents don&amp;rsquo;t just answer questions anymore. They read your files, search the web, and take actions on your behalf. In this video course, you&amp;rsquo;ll learn how they really work, from models and harnesses to context and skills, so you can get better results and stay in control.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An AI app is a &lt;strong&gt;model&lt;/strong&gt; that does the thinking, plus a &lt;strong&gt;harness&lt;/strong&gt; that carries out the actions, and many confusing replies come from that split.&lt;/li&gt;
&lt;li&gt;A model works only with what&amp;rsquo;s in its &lt;strong&gt;context&lt;/strong&gt;, so what you hand it shapes every answer.&lt;/li&gt;
&lt;li&gt;Before an agent works for you, you can check &lt;strong&gt;where it runs, what it can touch, what gets sent, and who sees it&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Asking well&lt;/strong&gt; and &lt;strong&gt;starting fresh&lt;/strong&gt; at the right time get you better results and use fewer tokens.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Skills&lt;/strong&gt; let you package a job once and reuse it, and you can build your own.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Along the way, you&amp;rsquo;ll practice in interactive apps and guided mentor sessions, then finish by finding and fixing five problems in an AI assistant&amp;rsquo;s setup.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Free Kit:&lt;/strong&gt; Get the &lt;a href=&quot;https://realpython.com/kits/junior-dev-ai/&quot;&gt;Junior Dev AI Starter Kit&lt;/a&gt; with videos, cheat sheets, and quizzes. You only need a free Real Python account.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Codex Live Course:&lt;/strong&gt; Ready to put an agent to work on real code? In Real Python&amp;rsquo;s &lt;a href=&quot;https://realpython.com/workshops/codex/&quot;&gt;Codex for Python Developers&lt;/a&gt; live course, you build an entire Python project with Codex, an AI agent that works inside your codebase. Join the waitlist to hear about the next dates.&lt;/p&gt;
&lt;/div&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 #316: The Future of Python Security: Trends, Challenges, and Solutions</title>
      <id>https://realpython.com/podcasts/rpp/316/</id>
      <link href="https://realpython.com/podcasts/rpp/316/"/>
      <updated>2026-10-23T12:00:00+00:00</updated>
      <summary>How is the Python ecosystem adapting to the modern landscape of software security and supply chain defense? This week on the show, we sit down with Seth Larson, the Python Software Foundation&#x27;s Security Developer in Residence.</summary>
      <content type="html">
        &lt;p&gt;How is the Python ecosystem adapting to the modern landscape of software security and supply chain defense? This week on the show, we sit down with Seth Larson, the Python Software Foundation&#x27;s Security Developer in Residence.&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 itertools By Example</title>
      <id>https://realpython.com/courses/python-itertools-by-example/</id>
      <link href="https://realpython.com/courses/python-itertools-by-example/"/>
      <updated>2026-10-21T14:00:00+00:00</updated>
      <summary>Combine Python&#x27;s itertools functions into memory-efficient pipelines as you deal cards, analyze stock data, and pick relay teams.</summary>
      <content type="html">
        &lt;p&gt;Python&amp;rsquo;s &lt;code&gt;itertools&lt;/code&gt; module is one of the hidden gems of the standard library. Knowing the definitions of its functions isn&amp;rsquo;t enough, though. Its real power lies in composing those functions into fast, memory-efficient, and readable code.&lt;/p&gt;
&lt;p&gt;Rather than introducing &lt;code&gt;itertools&lt;/code&gt; one function at a time, this video course works through practical examples that encourage you to think iteratively: you&amp;rsquo;ll shuffle and deal a deck of cards, analyze seventy years of S&amp;amp;P 500 prices, and pick relay teams for a community swim club.&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;The functions in &lt;code&gt;itertools&lt;/code&gt; &lt;strong&gt;operate on iterators&lt;/strong&gt; and compose into data pipelines that use far less memory than list-based code.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;batched()&lt;/code&gt; is the built-in way to &lt;strong&gt;split an iterable into chunks&lt;/strong&gt;, and it replaces the hand-rolled &lt;code&gt;grouper()&lt;/code&gt; recipe for most jobs.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;combinations()&lt;/code&gt;, &lt;code&gt;permutations()&lt;/code&gt;, and &lt;code&gt;product()&lt;/code&gt; let you &lt;strong&gt;brute-force&lt;/strong&gt; a problem, but they can trigger a combinatorial explosion.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;count()&lt;/code&gt;, &lt;code&gt;repeat()&lt;/code&gt;, &lt;code&gt;cycle()&lt;/code&gt;, and &lt;code&gt;accumulate()&lt;/code&gt; generate &lt;strong&gt;infinite sequences&lt;/strong&gt; and running totals.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pairwise()&lt;/code&gt;, &lt;code&gt;groupby()&lt;/code&gt;, &lt;code&gt;takewhile()&lt;/code&gt;, and &lt;code&gt;dropwhile()&lt;/code&gt; turn real &lt;strong&gt;data analysis&lt;/strong&gt; tasks into short, readable pipelines.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The examples in this video course run on Python 3.15. You&amp;rsquo;ll need Python 3.12 or later for &lt;code&gt;batched()&lt;/code&gt;, and Python 3.15 for unpacking in comprehensions.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Intermediate Python Deep Dive Live Course:&lt;/strong&gt; Want to keep going with iterators and data pipelines? Real Python&amp;rsquo;s &lt;a href=&quot;https://realpython.com/workshops/intermediate-deep-dive/&quot;&gt;Intermediate Python Deep Dive&lt;/a&gt; live course covers advanced iteration techniques, special methods, and Python&amp;rsquo;s object model with an instructor and a small cohort. Join the waitlist to hear about the next dates.&lt;/p&gt;
&lt;/div&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 an AI Agent With LangGraph and Python</title>
      <id>https://realpython.com/courses/building-ai-agent-langgraph-python/</id>
      <link href="https://realpython.com/courses/building-ai-agent-langgraph-python/"/>
      <updated>2026-10-20T14:00:00+00:00</updated>
      <summary>Learn LangGraph in Python with this hands-on video course and build a stateful AI agent using state graphs, nodes, and conditional edges.</summary>
      <content type="html">
        &lt;p&gt;LangGraph is a versatile Python framework designed for stateful, cyclic, and multi-actor Large Language Model (LLM) applications. LangGraph builds on its parent library, LangChain, and allows you to build sophisticated workflows that can handle the complexities of real-world LLM applications. Throughout this LangGraph video course, you&amp;rsquo;ll build a complete email-processing agent from the ground up.&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;You can use LangGraph to build LLM workflows by &lt;strong&gt;defining state graphs with nodes and edges&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;LangGraph extends LangChain&amp;rsquo;s capabilities by enabling complex LLM workflows with &lt;strong&gt;state, conditional edges, and cycles&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;LLM agents&lt;/strong&gt; in LangGraph autonomously process tasks by using state graphs to make decisions and interact with tools or APIs.&lt;/li&gt;
&lt;li&gt;You can use LangGraph independently of LangChain, though they&amp;rsquo;re often used together to complement each other.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Follow along with the full video course to gain hands-on experience with LangGraph, including setting up workflows and building a LangGraph agent that can autonomously parse and send emails and interact with API services.&lt;/p&gt;
&lt;p&gt;While you&amp;rsquo;ll get a brief primer on &lt;a href=&quot;https://realpython.com/build-llm-rag-chatbot-with-langchain/&quot;&gt;LangChain&lt;/a&gt; in this course, you&amp;rsquo;ll benefit from prior knowledge of LangChain fundamentals. You&amp;rsquo;ll also want to ensure you have intermediate Python knowledge, specifically in &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; concepts like classes and methods.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;AI Agent From Scratch Live Course:&lt;/strong&gt; Want to see what LangGraph does for you under the hood? In Real Python&amp;rsquo;s &lt;a href=&quot;https://realpython.com/workshops/agentic-loops/&quot;&gt;Build an AI Agent From Scratch in Python&lt;/a&gt; live course, you write the agent loop by hand, then recognize every piece of it in the tools you already use. Join the waitlist to hear about the next dates.&lt;/p&gt;
&lt;/div&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 #315: Python Pitfalls: Common Mistakes and How to Avoid Them</title>
      <id>https://realpython.com/podcasts/rpp/315/</id>
      <link href="https://realpython.com/podcasts/rpp/315/"/>
      <updated>2026-10-16T12:00:00+00:00</updated>
      <summary>What are common mistakes that Python beginners make, and how do you avoid them? 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 are common mistakes that Python beginners make, and how do you avoid them? 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>The Real Python Podcast – Episode #314: Codemoo: Demonstrating How Coding Agents Work</title>
      <id>https://realpython.com/podcasts/rpp/314/</id>
      <link href="https://realpython.com/podcasts/rpp/314/"/>
      <updated>2026-10-09T12:00:00+00:00</updated>
      <summary>How do you assemble the core pieces of a coding agent? How are developers defining projects through conversation and introspection? This week on the show, Geir Arne Hjelle returns to talk about his recent project to demonstrate how coding agents work under the hood.</summary>
      <content type="html">
        &lt;p&gt;How do you assemble the core pieces of a coding agent? How are developers defining projects through conversation and introspection? This week on the show, Geir Arne Hjelle returns to talk about his recent project to demonstrate how coding agents work under the hood.&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 #313: Python 3.15: Exploring the New Features</title>
      <id>https://realpython.com/podcasts/rpp/313/</id>
      <link href="https://realpython.com/podcasts/rpp/313/"/>
      <updated>2026-10-02T12:00:00+00:00</updated>
      <summary>Python 3.15 is (almost*) here! Christopher Trudeau and Bartosz Zaczyński return to discuss the new version. Bartosz coordinated the series of preview articles with members of the Real Python team and wrote the showcase tutorial, &quot;Python 3.15: Cool New Features for You to Try.&quot; Christopher&#x27;s video course &quot;What&#x27;s New in Python 3.15&quot; covers the topics from the article and shows the new features in action.</summary>
      <content type="html">
        &lt;p&gt;Python 3.15 is (almost*) here! Christopher Trudeau and Bartosz Zaczyński return to discuss the new version. Bartosz coordinated the series of preview articles with members of the Real Python team and wrote the showcase tutorial, &quot;Python 3.15: Cool New Features for You to Try.&quot; Christopher&#x27;s video course &quot;What&#x27;s New in Python 3.15&quot; covers the topics from the article and shows the new features in action.&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 #312: Navigating AI in Open Source: Insights From Wagtail</title>
      <id>https://realpython.com/podcasts/rpp/312/</id>
      <link href="https://realpython.com/podcasts/rpp/312/"/>
      <updated>2026-09-25T12:00:00+00:00</updated>
      <summary>How should you manage AI contributions to an open-source project? How do you measure the impact of using AI tools for development, and what generative features do end users want from a content management system? This week on the show, we speak with Thibaud Colas and Meagen Voss from Wagtail about the complex considerations software organizations are currently facing.</summary>
      <content type="html">
        &lt;p&gt;How should you manage AI contributions to an open-source project? How do you measure the impact of using AI tools for development, and what generative features do end users want from a content management system? This week on the show, we speak with Thibaud Colas and Meagen Voss from Wagtail about the complex considerations software organizations are currently facing.&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: FastAPI: Python API Development With Light Speed</title>
      <id>https://realpython.com/learning-paths/fastapi/</id>
      <link href="https://realpython.com/learning-paths/fastapi/"/>
      <updated>2026-07-22T12:00:00+00:00</updated>
      <summary>Learn FastAPI from the ground up. Build REST APIs, serve web pages with Jinja2 templates, and create a complete URL shortener project in Python.</summary>
      <content type="html">
        &lt;p&gt;Learn FastAPI from the ground up. Build REST APIs, serve web pages with Jinja2 templates, and create a complete URL shortener project in Python.&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>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. Choose an editor-based assistant like Cursor or a terminal-based one like Claude Code, then make it part of your daily workflow.</summary>
      <content type="html">
        &lt;p&gt;Use AI coding assistants to write, review, and debug Python code faster. Choose an editor-based assistant like Cursor or a terminal-based one like Claude Code, then make it part of your daily 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>Learning Path: Ace Your Python Coding Interview</title>
      <id>https://realpython.com/learning-paths/python-interview/</id>
      <link href="https://realpython.com/learning-paths/python-interview/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>Prepare for Python coding interviews with practice problems, tips for standing out, and resources from top PyCon talks and Python books.</summary>
      <content type="html">
        &lt;p&gt;Prepare for Python coding interviews with practice problems, tips for standing out, and resources from top PyCon talks and Python books.&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: Python Data Structures</title>
      <id>https://realpython.com/learning-paths/basic-python-data-structures/</id>
      <link href="https://realpython.com/learning-paths/basic-python-data-structures/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>Learn Python&#x27;s built-in data structures: strings, lists, tuples, dictionaries, sets, and bytes, plus sorting, copying, and comprehensions.</summary>
      <content type="html">
        &lt;p&gt;Learn Python&#x27;s built-in data structures: strings, lists, tuples, dictionaries, sets, and bytes, plus sorting, copying, and comprehensions.&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: Testing and Continuous Integration</title>
      <id>https://realpython.com/learning-paths/test-your-python-apps/</id>
      <link href="https://realpython.com/learning-paths/test-your-python-apps/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>Learn how to test Python code with unittest, doctest, pytest, and mock objects. Set up continuous integration with GitHub Actions and Docker.</summary>
      <content type="html">
        &lt;p&gt;Learn how to test Python code with unittest, doctest, pytest, and mock objects. Set up continuous integration with GitHub Actions and Docker.&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: Exceptions, Logging, and Debugging</title>
      <id>https://realpython.com/learning-paths/exception-handling-logging-debugging/</id>
      <link href="https://realpython.com/learning-paths/exception-handling-logging-debugging/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>Learn Python exception handling, logging, and debugging. Work with raise, built-in exceptions, the logging module, and pdb to write reliable code.</summary>
      <content type="html">
        &lt;p&gt;Learn Python exception handling, logging, and debugging. Work with raise, built-in exceptions, the logging module, and pdb to write reliable 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>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>
  

</feed>
