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

  
    <entry>
      <title>NumPy Techniques and Practical Examples</title>
      <id>https://realpython.com/courses/numpy-techniques-practical-examples/</id>
      <link href="https://realpython.com/courses/numpy-techniques-practical-examples/"/>
      <updated>2025-02-04T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to use NumPy by exploring several interesting examples. You&#x27;ll read data from a file into an array and analyze structured arrays to perform a reconciliation. You&#x27;ll also learn how to quickly chart an analysis &amp; turn a custom function into a vectorized function.</summary>
      <content type="html">
        &lt;p&gt;The &lt;a href=&quot;https://numpy.org/doc/stable/reference/index.html#python-api&quot;&gt;NumPy library&lt;/a&gt; is a Python library used for scientific computing. It provides you with a multidimensional array object for storing and analyzing data in a wide variety of ways. In this video course, you&amp;rsquo;ll see examples of some features NumPy provides that aren&amp;rsquo;t always highlighted in other tutorials. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create &lt;strong&gt;multidimensional arrays&lt;/strong&gt; from data stored in files&lt;/li&gt;
&lt;li&gt;Identify and remove &lt;strong&gt;duplicate data&lt;/strong&gt; from a NumPy array&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;structured NumPy arrays&lt;/strong&gt; to reconcile the differences between datasets&lt;/li&gt;
&lt;li&gt;Analyze and chart specific parts of &lt;strong&gt;hierarchical&lt;/strong&gt; data&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;vectorized&lt;/strong&gt; versions of your own functions&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python for Loops: The Pythonic Way</title>
      <id>https://realpython.com/python-for-loop/</id>
      <link href="https://realpython.com/python-for-loop/"/>
      <updated>2025-02-03T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn all about the Python for loop. You&#x27;ll learn how to use this loop to iterate over built-in data types, such as lists, tuples, strings, and dictionaries. You&#x27;ll also explore some Pythonic looping techniques and much more.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;code&gt;for&lt;/code&gt; loop allows you to iterate over the items in a collection, such as lists, tuples, strings, and dictionaries. The &lt;code&gt;for&lt;/code&gt; loop syntax declares a loop variable that takes each item from the collection in each iteration. This loop is ideal for repeatedly executing a block of code on each item in the collection. You can also tweak &lt;code&gt;for&lt;/code&gt; loops further with features like &lt;code&gt;break&lt;/code&gt;, &lt;code&gt;continue&lt;/code&gt;, and &lt;code&gt;else&lt;/code&gt;.&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;for&lt;/code&gt; loop&lt;/strong&gt; iterates over items in a data collection, allowing you to execute code for each item.&lt;/li&gt;
&lt;li&gt;To &lt;strong&gt;iterate from &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;10&lt;/code&gt;&lt;/strong&gt;, you use the &lt;code&gt;for index in range(11):&lt;/code&gt; construct.&lt;/li&gt;
&lt;li&gt;To &lt;strong&gt;repeat code a number of times&lt;/strong&gt; without processing the data of an iterable, use the &lt;code&gt;for _ in range(times):&lt;/code&gt; construct.&lt;/li&gt;
&lt;li&gt;To do &lt;strong&gt;index-based iteration&lt;/strong&gt;, you can use &lt;code&gt;for index, value in enumerate(iterable):&lt;/code&gt; to access both index and item.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this tutorial, you’ll gain practical knowledge of using &lt;code&gt;for&lt;/code&gt; loops to traverse various collections and learn Pythonic looping techniques. Additionally, you’ll learn how to handle exceptions and how to use asynchronous iterations to make your Python code more robust and efficient.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-for-loop-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-for-loop-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to use for loops 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.6eec2e95bede.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 “The Python for Loop” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

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

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

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #abe0e6;&quot; alt=&quot;Python for Loops: The Pythonic Way&quot; src=&quot;https://files.realpython.com/media/UPDATE-Python-for-Loops-Definite-Iteration_Watermarked.32bfd8825dfe.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/UPDATE-Python-for-Loops-Definite-Iteration_Watermarked.32bfd8825dfe.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/UPDATE-Python-for-Loops-Definite-Iteration_Watermarked.32bfd8825dfe.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/UPDATE-Python-for-Loops-Definite-Iteration_Watermarked.32bfd8825dfe.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/UPDATE-Python-for-Loops-Definite-Iteration_Watermarked.32bfd8825dfe.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.6eec2e95bede.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-for-loop/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;The Python for Loop&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 for loop and the concepts of definite iteration, iterables, and iterators. With this knowledge, you&#x27;ll be able to perform repetitive tasks in Python more efficiently.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-the-python-for-loop&quot;&gt;Getting Started With the Python &lt;code&gt;for&lt;/code&gt; Loop&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-the-python-for-loop&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In programming, loops are control flow statements that allow you to repeat a given set of operations a number of times. In practice, you’ll find two main types of loops:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/For_loop&quot;&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/a&gt; are mostly used to iterate a &lt;em&gt;known&lt;/em&gt; number of times, which is common when you’re processing data collections with a specific number of data items.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/While_loop&quot;&gt;&lt;code&gt;while&lt;/code&gt; loops&lt;/a&gt; are commonly used to iterate an &lt;em&gt;unknown&lt;/em&gt; number of times, which is useful when the number of iterations depends on a given condition.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Python has both of these loops and in this tutorial, you’ll learn about &lt;strong&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/strong&gt;. In Python, you’ll generally use &lt;code&gt;for&lt;/code&gt; loops when you need to iterate over the items in a data collection. This type of loop lets you traverse different data collections and run a specific group of statements &lt;em&gt;on&lt;/em&gt; or &lt;em&gt;with&lt;/em&gt; each item in the input collection.&lt;/p&gt;
&lt;p&gt;In Python, &lt;code&gt;for&lt;/code&gt; loops are &lt;a href=&quot;https://docs.python.org/3/reference/compound_stmts.html&quot;&gt;compound statements&lt;/a&gt; with a &lt;em&gt;header&lt;/em&gt; and a &lt;em&gt;code block&lt;/em&gt; that runs a predefined number of times. The basic syntax of a &lt;code&gt;for&lt;/code&gt; loop is shown below:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python_syntax&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python Syntax&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&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;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;variable&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&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;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this syntax, &lt;code&gt;variable&lt;/code&gt; is the loop variable. In each iteration, this variable takes the value of the current item in &lt;code&gt;iterable&lt;/code&gt;, which represents the data collection you need to iterate over. The loop body can consist of one or more statements that must be indented properly.&lt;/p&gt;
&lt;p&gt;Here’s a more detailed breakdown of this syntax:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;for&lt;/code&gt;&lt;/strong&gt; is the keyword that initiates the loop header.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;variable&lt;/code&gt;&lt;/strong&gt; is a variable that holds the current item in the input iterable.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;in&lt;/code&gt;&lt;/strong&gt; is a keyword that connects the loop variable with the iterable.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;iterable&lt;/code&gt;&lt;/strong&gt; is a data collection that can be iterated over.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;&lt;/strong&gt; consists of one or more statements to execute in each iteration.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here’s a quick example of how you can use a &lt;code&gt;for&lt;/code&gt; loop to iterate over a list:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;colors&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;red&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;green&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;yellow&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;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;colors&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;color&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;red&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;green&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;blue&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;yellow&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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this example, &lt;code&gt;color&lt;/code&gt; is the loop variable, while the &lt;code&gt;colors&lt;/code&gt; list is the target collection. Each time through the loop, &lt;code&gt;color&lt;/code&gt; takes on a successive item from &lt;code&gt;colors&lt;/code&gt;. In this loop, the body consists of a call to &lt;a href=&quot;https://realpython.com/python-print/&quot;&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/a&gt; that displays the value on the screen. This loop runs once for each item in the target iterable. The way the code above is written is the &lt;a href=&quot;https://realpython.com/learning-paths/writing-pythonic-code/&quot;&gt;Pythonic&lt;/a&gt; way to write it.&lt;/p&gt;
&lt;p&gt;However, what’s an &lt;a href=&quot;https://realpython.com/python-iterators-iterables/#getting-to-know-python-iterables&quot;&gt;iterable&lt;/a&gt; anyway? In Python, an &lt;strong&gt;iterable&lt;/strong&gt; is an object—often a data collection—that can be iterated over. Common examples of iterables in Python include &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;lists&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-tuple/&quot;&gt;tuples&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionaries&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-sets/&quot;&gt;sets&lt;/a&gt;, which are all built-in data types. You can also have custom classes that support iteration.&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; Python has both iterables and iterators. Iterables support the &lt;strong&gt;iterable protocol&lt;/strong&gt; consisting of the &lt;code&gt;.__iter__()&lt;/code&gt; &lt;a href=&quot;https://realpython.com/python-magic-methods/&quot;&gt;special method&lt;/a&gt;. Similarly, iterators support the &lt;strong&gt;iterator protocol&lt;/strong&gt; that’s based on the &lt;code&gt;.__iter__()&lt;/code&gt; and &lt;code&gt;.__next__()&lt;/code&gt; special methods.&lt;/p&gt;
&lt;p&gt;Both iterables and iterators can be iterated over. All iterators are iterables, but not all iterables are iterators. Python iterators play a fundamental role in &lt;code&gt;for&lt;/code&gt; loops because they drive the iteration process.&lt;/p&gt;
&lt;p&gt;A deeper discussion on iterables and iterators is beyond the scope of this tutorial. However, to learn more about them, check out the &lt;a href=&quot;https://realpython.com/python-iterators-iterables/&quot;&gt;Iterators and Iterables in Python: Run Efficient Iterations&lt;/a&gt; tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can also have a loop with multiple loop variables:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;points&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;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&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;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&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;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;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;points&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;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;x&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;= }&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; and &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &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;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;x = 1 and y = 4&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;x = 3 and y = 6&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;x = 7 and y = 3&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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this loop, you have two loop variables, &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt;. Note that to use this syntax, you just need to provide a tuple of loop variables. Also, you can have as many loop variables as you need as long as you have the correct number of items to &lt;a href=&quot;https://realpython.com/python-tuple/#packing-and-unpacking-tuples&quot;&gt;unpack&lt;/a&gt; into them. You’ll also find this pattern useful when iterating over &lt;a href=&quot;#collections-dictionaries-and-sets&quot;&gt;dictionary&lt;/a&gt; items or when you need to do &lt;a href=&quot;#looping-over-several-iterables-in-parallel&quot;&gt;parallel iteration&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Sometimes, the input iterable may be empty. In that case, the loop will run its header once but won’t execute its body:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&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;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-for-loop/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-for-loop/ »&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>Build a Quiz Application With Python</title>
      <id>https://realpython.com/python-quiz-application/</id>
      <link href="https://realpython.com/python-quiz-application/"/>
      <updated>2025-02-02T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll build a Python quiz application for the terminal. Your app will ask you multiple-choice questions that you can use to strengthen your own knowledge or challenge your friends to test theirs.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In this tutorial, you’ll build a Python quiz application for the terminal. You’ll start by developing a basic app capable of asking questions, collecting answers, and checking correctness. As you progress, you’ll enhance the app by adding features like user-friendly interfaces, storing questions in external files, handling multiple correct answers, and providing hints and explanations.&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;A quiz application&lt;/strong&gt; is a nice beginner project as it involves basic Python concepts like data structures and control flow.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;&lt;code&gt;input()&lt;/code&gt; function&lt;/strong&gt; helps you to interact with the user in the terminal.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;structure questions and answers&lt;/strong&gt; in data files.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TOML or JSON files&lt;/strong&gt; are suitable for storing data in small games due to their readability and ease of integration with Python.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The word &lt;strong&gt;quiz&lt;/strong&gt; was &lt;a href=&quot;https://www.merriam-webster.com/dictionary/quiz#first-known&quot;&gt;first used&lt;/a&gt; in 1781 to mean &lt;em&gt;eccentric person&lt;/em&gt;. Nowadays, it’s mostly used to describe short tests of trivia or expert knowledge with questions like the following:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When was the first known use of the word &lt;em&gt;quiz&lt;/em&gt;?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;By following along in this step-by-step project, you’ll build an application that can test a person’s expertise on a range of topics. You can use this project to strengthen your own knowledge or to challenge your friends to a fun battle of wits.&lt;/p&gt;
&lt;p&gt;The quiz application is a comprehensive project for anyone comfortable with the basics of Python. Throughout the tutorial, you’ll get all the code you need in separate, bite-size steps. You can also find the full source code of the application by clicking on 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=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-quiz-application-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-quiz-application-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get access to the source code&lt;/a&gt; that you’ll use to build your quiz application.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Whether you’re an eccentric person or not, read on to learn how to create your own quiz.&lt;/p&gt;
&lt;h2 id=&quot;demo-your-python-quiz-application&quot;&gt;Demo: Your Python Quiz Application&lt;a class=&quot;headerlink&quot; href=&quot;#demo-your-python-quiz-application&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this step-by-step project, you’ll build a terminal application that can quiz you and your friends on a range of topics:&lt;/p&gt;
&lt;figure&gt;
  &lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 border&quot;&gt;
    &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/717554866?background=1&quot; frameborder=&quot;0&quot; allow=&quot;fullscreen&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;You first choose a topic for your questions. Then, for each question, you’ll choose an answer from a set of alternatives. Some questions may have multiple correct answers. You can access a hint to help you along the way. After answering a question, you’ll read an explanation that can provide more context for the answer.&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’ll start by creating a basic Python quiz application that’s only capable of asking a question, collecting an answer, and checking whether the answer is correct. From there, you’ll add more and more features in order to make your app more interesting, user-friendly, and fun.&lt;/p&gt;
&lt;p&gt;You’ll build the quiz application iteratively by going through the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a basic application that can ask multiple-choice questions.&lt;/li&gt;
&lt;li&gt;Make the app more user-friendly by improving how it looks and how it handles user errors.&lt;/li&gt;
&lt;li&gt;Refactor the code to use functions.&lt;/li&gt;
&lt;li&gt;Separate question data from source code by storing questions in a dedicated data file.&lt;/li&gt;
&lt;li&gt;Expand the app to handle multiple correct answers, give hints, and provide explanations.&lt;/li&gt;
&lt;li&gt;Add interest by supporting different quiz topics to choose from.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;As you follow along, you’ll gain experience in starting with a small script and expanding it. This is an important skill in and of itself. Your favorite program, app, or game probably started as a small &lt;a href=&quot;https://en.wikipedia.org/wiki/Proof_of_concept&quot;&gt;proof of concept&lt;/a&gt; that later grew into what it is today.&lt;/p&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll build a quiz application using Python’s basic building blocks. While working through the steps, it’s helpful if you’re comfortable with the following concepts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-input-output/&quot;&gt;Reading input&lt;/a&gt; from the user at the terminal&lt;/li&gt;
&lt;li&gt;Organizing data in &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;structures&lt;/a&gt; like &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;lists&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-tuple/&quot;&gt;tuples&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionaries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Using &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;&lt;code&gt;if&lt;/code&gt; statements&lt;/a&gt; to check different conditions&lt;/li&gt;
&lt;li&gt;Repeating actions with &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-while-loop/&quot;&gt;&lt;code&gt;while&lt;/code&gt;&lt;/a&gt; loops&lt;/li&gt;
&lt;li&gt;Encapsulating code with &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you’re not confident in your knowledge of these prerequisites, then that’s okay too! In fact, going through this tutorial will help you practice these concepts. You can always stop and review the resources linked above if you get stuck.&lt;/p&gt;
&lt;h2 id=&quot;step-1-ask-questions&quot;&gt;Step 1: Ask Questions&lt;a class=&quot;headerlink&quot; href=&quot;#step-1-ask-questions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this step, you’ll learn how to create a program that can ask questions and check answers. This will be the foundation of your quiz application, which you’ll improve upon in the rest of the tutorial. At the end of this step, your program will look like this:&lt;/p&gt;
&lt;figure&gt;
  &lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 border&quot;&gt;
    &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/717554848?background=1&quot; frameborder=&quot;0&quot; allow=&quot;fullscreen&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-quiz-application/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-quiz-application/ »&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>Build a Dice-Rolling Application With Python</title>
      <id>https://realpython.com/python-dice-roll/</id>
      <link href="https://realpython.com/python-dice-roll/"/>
      <updated>2025-02-02T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll build a dice-rolling simulator app with a minimal text-based user interface using Python. The app will simulate the rolling of up to six dice. Each individual die will have six sides.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In this tutorial, you’ll learn how to create a Python dice roll simulator. The tutorial guides you through building a text-based user interface (TUI) application that simulates rolling dice using Python’s &lt;code&gt;random&lt;/code&gt; module. You’ll learn to gather and validate user input, use &lt;code&gt;random.randint()&lt;/code&gt; for dice rolling, and display results with ASCII art.&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;To simulate &lt;strong&gt;dice-rolling&lt;/strong&gt; events, you can use &lt;strong&gt;&lt;code&gt;random.randint()&lt;/code&gt;&lt;/strong&gt; .&lt;/li&gt;
&lt;li&gt;To get the &lt;strong&gt;user’s input&lt;/strong&gt;, you use the built-in &lt;strong&gt;&lt;code&gt;input()&lt;/code&gt;&lt;/strong&gt; function.&lt;/li&gt;
&lt;li&gt;To display dice in Python, you generate &lt;strong&gt;ASCII art representations&lt;/strong&gt; of dice faces and use &lt;strong&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;To manipulate &lt;strong&gt;strings&lt;/strong&gt;, you use methods such as &lt;strong&gt;&lt;code&gt;.center()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;.join()&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Building small projects, like a &lt;a href=&quot;https://en.wikipedia.org/wiki/Text-based_user_interface&quot;&gt;text-based user interface (TUI)&lt;/a&gt; dice-rolling application, will help you level up your Python programming skills. You’ll learn how to gather and validate the user’s input, import code from modules and packages, write functions, use &lt;code&gt;for&lt;/code&gt; loops and conditionals, and neatly display output by using strings and the &lt;a href=&quot;https://realpython.com/python-print/&quot;&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/a&gt; function.&lt;/p&gt;
&lt;p&gt;Click the link below to download the entire code for this dice-rolling application and follow along while you build the project yourself:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-dice-roll-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-dice-roll-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to build your Python dice-rolling app.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo&quot;&gt;Demo&lt;a class=&quot;headerlink&quot; href=&quot;#demo&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this step-by-step project, you’ll build an application that runs dice-rolling simulations. The app will be able to roll up to six dice, with each die having six faces. After every roll, the application will generate an ASCII diagram of dice faces and display it on the screen. The following video demonstrates how the app works:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/python-dice-roll-demo.93e6fe0d714a.gif&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/python-dice-roll-demo.93e6fe0d714a.gif&quot; width=&quot;1000&quot; height=&quot;562&quot; srcset=&quot;/cdn-cgi/image/width=250,format=auto/https://files.realpython.com/media/python-dice-roll-demo.93e6fe0d714a.gif 250w, /cdn-cgi/image/width=333,format=auto/https://files.realpython.com/media/python-dice-roll-demo.93e6fe0d714a.gif 333w, /cdn-cgi/image/width=500,format=auto/https://files.realpython.com/media/python-dice-roll-demo.93e6fe0d714a.gif 500w, /cdn-cgi/image/width=1000,format=auto/https://files.realpython.com/media/python-dice-roll-demo.93e6fe0d714a.gif 1000w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Python Dice Roll App Demo Video&quot; data-asset=&quot;4027&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;When you run your dice-rolling simulator app, you get a prompt asking for the number of dice you want to roll. Once you provide a valid integer from 1 to 6, inclusive, then the application simulates the rolling event and displays a diagram of dice faces on the screen.&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Your dice-rolling simulator app will have a minimal yet user-friendly &lt;a href=&quot;https://en.wikipedia.org/wiki/Text-based_user_interface&quot;&gt;text-based user interface (TUI)&lt;/a&gt;, which will allow you to specify the number of six-sided dice that you’d like to roll. You’ll use this TUI to roll the dice at home without having to fly to Las Vegas.&lt;/p&gt;
&lt;p&gt;Here’s a description of how the app will work internally:&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;Tasks to Run&lt;/th&gt;
&lt;th&gt;Tools to Use&lt;/th&gt;
&lt;th&gt;Code to Write&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Prompt the user to choose how many six-sided dice to roll, then read the user’s input&lt;/td&gt;
&lt;td&gt;Python’s built-in &lt;a href=&quot;https://docs.python.org/3/library/functions.html#input&quot;&gt;&lt;code&gt;input()&lt;/code&gt;&lt;/a&gt; function&lt;/td&gt;
&lt;td&gt;A call to &lt;code&gt;input()&lt;/code&gt; with appropriate arguments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Parse and validate the user’s input&lt;/td&gt;
&lt;td&gt;String methods, comparison operators, and &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional statements&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;A user-defined function called &lt;code&gt;parse_input()&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Run the dice-rolling simulation&lt;/td&gt;
&lt;td&gt;Python’s &lt;a href=&quot;https://realpython.com/python-random/&quot;&gt;&lt;code&gt;random&lt;/code&gt;&lt;/a&gt; module, specifically the &lt;a href=&quot;https://docs.python.org/3/library/random.html#random.randint&quot;&gt;&lt;code&gt;randint()&lt;/code&gt;&lt;/a&gt; function&lt;/td&gt;
&lt;td&gt;A user-defined function called &lt;code&gt;roll_dice()&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generate an ASCII diagram with the resulting dice faces&lt;/td&gt;
&lt;td&gt;Loops, &lt;a href=&quot;https://realpython.com/python-append/&quot;&gt;&lt;code&gt;list.append()&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-string-concatenation/#efficiently-concatenating-many-strings-with-join-in-python&quot;&gt;&lt;code&gt;str.join()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;A user-defined function called &lt;code&gt;generate_dice_faces_diagram()&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Display the diagram of dice faces on the screen&lt;/td&gt;
&lt;td&gt;Python’s built-in &lt;a href=&quot;https://realpython.com/python-print/&quot;&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/a&gt; function&lt;/td&gt;
&lt;td&gt;A call to &lt;code&gt;print()&lt;/code&gt; with appropriate arguments&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Keeping these internal workings in mind, you’ll code three custom functions to provide the app’s main features and functionalities. These functions will define your code’s public &lt;a href=&quot;https://realpython.com/python-api/&quot;&gt;API&lt;/a&gt;, which you’ll call to bring the app to life.&lt;/p&gt;
&lt;p&gt;To organize the code of your dice-rolling simulator project, you’ll create a single file called &lt;code&gt;dice.py&lt;/code&gt; in a directory of your choice in your file system. Go ahead and create the file to get started!&lt;/p&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You should be comfortable with the following concepts and skills before you start building this dice-rolling simulation project:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ways to &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;run scripts&lt;/a&gt; in Python&lt;/li&gt;
&lt;li&gt;Python’s &lt;a href=&quot;https://realpython.com/python-import/&quot;&gt;&lt;code&gt;import&lt;/code&gt;&lt;/a&gt; mechanism&lt;/li&gt;
&lt;li&gt;The basics of &lt;a href=&quot;https://realpython.com/python-data-types/&quot;&gt;Python data types&lt;/a&gt;, mainly &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-numbers/#integers&quot;&gt;integer numbers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Basic &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;data structures&lt;/a&gt;, especially &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;lists&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Python &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt; and constants&lt;/li&gt;
&lt;li&gt;Python &lt;a href=&quot;https://realpython.com/python-operators-expressions/#comparison-operators&quot;&gt;comparison operators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Boolean values&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-operators-expressions/#logical-operators&quot;&gt;logical expressions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;Conditional&lt;/a&gt; statements&lt;/li&gt;
&lt;li&gt;Python &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The basics of &lt;a href=&quot;https://realpython.com/python-input-output/&quot;&gt;input, output&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-string-formatting/&quot;&gt;string formatting&lt;/a&gt; in Python&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you don’t have all of the prerequisite knowledge before starting this coding adventure, then that’s okay! You might learn more by going ahead and getting started! You can always stop and review the resources linked here if you get stuck.&lt;/p&gt;
&lt;h2 id=&quot;step-1-code-the-tui-of-your-python-dice-rolling-app&quot;&gt;Step 1: Code the TUI of Your Python Dice-Rolling App&lt;a class=&quot;headerlink&quot; href=&quot;#step-1-code-the-tui-of-your-python-dice-rolling-app&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this step, you’ll write the required code to ask for the user’s input of how many dice they want to roll in the simulation. You’ll also code a Python function that takes the user’s input, validates it, and returns it as an integer number if the validation was successful. Otherwise, the function will ask for the user’s input again.&lt;/p&gt;
&lt;p&gt;To download the code for this step, click the following link and navigate to the &lt;code&gt;source_code_step_1/&lt;/code&gt; folder:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-dice-roll-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-dice-roll-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to build your Python dice-rolling app.&lt;/p&gt;
&lt;/div&gt;
&lt;h3 id=&quot;take-the-users-input-at-the-command-line&quot;&gt;Take the User’s Input at the Command Line&lt;a class=&quot;headerlink&quot; href=&quot;#take-the-users-input-at-the-command-line&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-dice-roll/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-dice-roll/ »&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>Develop Data Visualization Interfaces in Python With Dash</title>
      <id>https://realpython.com/python-dash/</id>
      <link href="https://realpython.com/python-dash/"/>
      <updated>2025-02-02T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to build a dashboard using Python and Dash. Dash is a framework for building data visualization interfaces. It helps data scientists build fully interactive web applications quickly.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Dash is a popular Python framework for creating interactive data visualization interfaces. With Dash, you build web applications using only Python, without needing advanced web development skills. It integrates seamlessly with technologies like Flask, React.js, and Plotly.js to render user interfaces and generate charts.&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;Dash&lt;/strong&gt; is an open-source framework for building data visualization interfaces using Python.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Good use cases for Dash&lt;/strong&gt; include interactive dashboards for data analysis and visualization tasks.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;customize the style&lt;/strong&gt; of a Dash app using CSS, either inline or with external files.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;deploy Dash applications&lt;/strong&gt; on PythonAnywhere, a platform offering free hosting for Python web apps.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://dash.plotly.com/introduction&quot;&gt;Dash&lt;/a&gt; gives data scientists the ability to showcase their results in interactive web applications. You don’t need to be an expert in &lt;a href=&quot;https://realpython.com/learning-paths/become-python-web-developer/&quot;&gt;web development&lt;/a&gt;. In this tutorial, you’ll explore how to create, style, and deploy a Dash application, transforming a basic dashboard into a fully interactive tool.&lt;/p&gt;
&lt;p&gt;You can download the source code, data, and resources for the sample application that you’ll make in this tutorial 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=&quot;1&quot;&gt;Get the Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/dash-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-dash-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to learn about creating data visualization interfaces in Python with Dash in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;what-is-dash&quot;&gt;What Is Dash?&lt;a class=&quot;headerlink&quot; href=&quot;#what-is-dash&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Dash is an open-source framework for building data visualization interfaces. Released in 2017 as a Python library, it’s grown to include implementations for R, Julia, and F#. Dash helps data scientists build analytical web applications without requiring advanced web development knowledge.&lt;/p&gt;
&lt;p&gt;Three technologies constitute the core of Dash:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Flask&lt;/strong&gt; supplies the web server functionality.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React.js&lt;/strong&gt; renders the user interface of the web page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Plotly.js&lt;/strong&gt; generates the charts used in your application.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;But you don’t have to worry about making all these technologies work together. Dash will do that for you. You just need to write Python, R, Julia, or F# and sprinkle in a bit of CSS.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://plotly.com/&quot;&gt;Plotly&lt;/a&gt;, a Canada-based company, built Dash and supports its development. You may know the company from the &lt;a href=&quot;https://plotly.com/graphing-libraries/&quot;&gt;popular graphing libraries&lt;/a&gt; that share its name. The company released Dash as open source under an &lt;a href=&quot;https://tldrlegal.com/license/mit-license&quot;&gt;MIT license&lt;/a&gt;, so you can use Dash at no cost.&lt;/p&gt;
&lt;p&gt;Plotly also offers a commercial companion to Dash called &lt;a href=&quot;https://plotly.com/dash/&quot;&gt;Dash Enterprise&lt;/a&gt;. This paid service provides companies with support services such as hosting, deploying, and handling authentication on Dash applications. But these features live outside of Dash’s open-source ecosystem.&lt;/p&gt;
&lt;p&gt;Dash will help you build dashboards quickly. If you’re used to analyzing data or building data visualizations using Python, then Dash will be a useful addition to your toolbox. Here are a few examples of what you can make with Dash:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://dash.gallery/self-driving/&quot;&gt;A dashboard showing object detection for self-driving cars&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://dash.gallery/dash-uber-rides-demo/&quot;&gt;A visualization of millions of Uber rides&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://dash.gallery/soccer-match-analytics/&quot;&gt;An interactive tool for analyzing soccer match data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is just a tiny sample. If you’d like to see other interesting use cases, then go check out the &lt;a href=&quot;https://dash.gallery/&quot;&gt;Dash App Gallery&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You don’t need advanced knowledge of web development to follow this tutorial, but some familiarity with &lt;a href=&quot;https://realpython.com/html-css-python/&quot;&gt;HTML and CSS&lt;/a&gt; won’t hurt.&lt;/p&gt;
&lt;p&gt;You should know the basics of the following topics, though:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Python graphing libraries such as Plotly, &lt;a href=&quot;https://realpython.com/python-data-visualization-bokeh/&quot;&gt;Bokeh&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-matplotlib-guide/&quot;&gt;Matplotlib&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;HTML and the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Getting_started&quot;&gt;structure of an HTML file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Learn/CSS/First_steps/Getting_started&quot;&gt;CSS and style sheets&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;If you feel comfortable with the requirements and want to learn how to use Dash in your next project, then continue to the following section!&lt;/p&gt;
&lt;h2 id=&quot;get-started-with-dash-in-python&quot;&gt;Get Started With Dash in Python&lt;a class=&quot;headerlink&quot; href=&quot;#get-started-with-dash-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll go through the end-to-end process of building a dashboard using Dash. If you follow along with the examples, then you’ll go from a bare-bones dashboard on your local machine to a styled dashboard deployed on &lt;a href=&quot;https://www.pythonanywhere.com/&quot;&gt;PythonAnywhere&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To build the dashboard, you’ll use a &lt;a href=&quot;https://www.kaggle.com/neuromusic/avocado-prices&quot;&gt;dataset&lt;/a&gt; of sales and prices of avocados in the United States between 2015 and 2018. &lt;a href=&quot;https://justinkiggins.com/about&quot;&gt;Justin Kiggins&lt;/a&gt; compiled this dataset using data from the &lt;a href=&quot;https://www.hassavocadoboard.com/retail/volume-and-price-data&quot;&gt;Hass Avocado Board&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;how-to-set-up-your-local-environment&quot;&gt;How to Set Up Your Local Environment&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-set-up-your-local-environment&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To develop your app, you’ll need a new directory to store your code and data. You’ll also need a clean Python &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;. To create those, execute the commands below, choosing the version that matches your operating system:&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

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




  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-linuxmacos&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body small&quot; id=&quot;macos-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#linux-macos-1&quot; role=&quot;tab&quot; aria-controls=&quot;linux-macos-1&quot; aria-selected=&quot;false&quot;&gt;&lt;span class=&quot;icon baseline text-muted&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.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;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pscon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;mkdir&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;avocado_analytics&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;avocado_analytics&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;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;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;/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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&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;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;mkdir&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;avocado_analytics
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;avocado_analytics
&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;/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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-dash/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-dash/ »&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>Top Python Game Engines</title>
      <id>https://realpython.com/top-python-game-engines/</id>
      <link href="https://realpython.com/top-python-game-engines/"/>
      <updated>2025-02-02T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll explore several Python game engines available to you. For each, you&#x27;ll code simple examples and a more advanced game to learn the game engine&#x27;s strengths and weaknesses.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;You can use several Python game engines for crafting video games using your existing Python skills. Popular Python game engines are Pygame, Arcade, and Ren’Py, each offering unique features. In this tutorial, you’ll learn how to install and use them, and how these engines differ from traditional stand-alone game engines.&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;Pygame, Arcade, adventurelib, and Ren’Py&lt;/strong&gt; are some of the top Python game engines, each with unique features.&lt;/li&gt;
&lt;li&gt;Python game engines are &lt;strong&gt;straightforward to use&lt;/strong&gt; for Python developers but may require more effort for &lt;strong&gt;cross-platform&lt;/strong&gt; support compared to other engines.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pygame Zero&lt;/strong&gt; is designed for beginners, offering simplified game development requiring less manual code than Pygame.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Creating mobile games&lt;/strong&gt; with Python game engines isn’t straightforward and requires additional effort for optimization and compatibility.&lt;/li&gt;
&lt;li&gt;You can use Python to &lt;strong&gt;create 3D games&lt;/strong&gt; using frameworks like &lt;strong&gt;Panda 3D&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Using Python, and a host of great Python game engines, makes crafting great computer games much easier than in the past. In this tutorial, you’ll explore several of these game engines, learning what you need to start crafting your own Python video games!&lt;/p&gt;
&lt;p&gt;To get the most out of this tutorial, you should be well-versed in Python programming, including &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;. An understanding of basic game concepts is helpful, but not necessary.&lt;/p&gt;
&lt;p&gt;Ready to dive in? Click the link below to download the source code for all the games that you’ll be creating:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/top-python-game-engines-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-top-python-game-engines-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to try out Python game engines.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;python-game-engines-overview&quot;&gt;Python Game Engines Overview&lt;a class=&quot;headerlink&quot; href=&quot;#python-game-engines-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Game engines for Python most often take the form of Python libraries, which can be installed in a variety of ways. Most are available on &lt;a href=&quot;https://pypi.org/&quot;&gt;PyPI&lt;/a&gt; and can be installed with &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;. However, a few are available only on GitHub, GitLab, or other code sharing locations, and they may require other installation steps. This article will cover installation methods for all the engines discussed.&lt;/p&gt;
&lt;p&gt;Python is a general purpose programming language, and it’s used for a variety of tasks other than writing computer games. In contrast, there are many different stand-alone game engines that are tailored specifically to writing games. Some of these include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.unrealengine.com/&quot;&gt;The Unreal Engine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://unity.com/&quot;&gt;Unity&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://godotengine.org/&quot;&gt;Godot&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These stand-alone game engines differ from Python game engines in several key aspects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Language support:&lt;/strong&gt; Languages like C++, C#, and JavaScript are popular for games written in stand-alone game engines, as the engines themselves are often written in these languages. Very few stand-alone engines support Python.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Proprietary scripting support:&lt;/strong&gt; In addition, many stand-alone game engines maintain and support their own scripting languages, which may not resemble Python. For example, Unity uses C# natively, while Unreal works best with C++. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Platform support:&lt;/strong&gt; Many modern stand-alone game engines can produce games for a variety of platforms, including mobile and dedicated game systems, with very little effort. In contrast, porting a Python game across various platforms, especially mobile platforms, can be a major undertaking.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Licensing options:&lt;/strong&gt; Games written using a stand-alone game engine may have different licensing options and restrictions, based on the engine used.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So why use Python to write games at all? In a word, Python. Using a stand-alone game engine often requires you to learn a new programming or scripting language. Python game engines leverage your existing knowledge of Python, reducing the learning curve and getting you moving forward quickly.&lt;/p&gt;
&lt;p&gt;There are many game engines available for the Python environment. The engines that you’ll learn about here all share the following criteria:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;They’re relatively popular engines, or they cover aspects of gaming that aren’t usually covered.&lt;/li&gt;
&lt;li&gt;They’re currently maintained.&lt;/li&gt;
&lt;li&gt;They have good documentation available.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For each engine, you’ll learn about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Installation methods&lt;/li&gt;
&lt;li&gt;Basic concepts, as well as assumptions that the engine makes&lt;/li&gt;
&lt;li&gt;Major features and capabilities&lt;/li&gt;
&lt;li&gt;Two game implementations, to allow for comparison&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Where appropriate, you should install these game engines in a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;. Full source code for the games in this tutorial is available for download at the link below and will be referenced throughout the article:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/top-python-game-engines-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-top-python-game-engines-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to try out Python game engines.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;With the source code downloaded, you’re ready to begin.&lt;/p&gt;
&lt;h2 id=&quot;pygame&quot;&gt;Pygame&lt;a class=&quot;headerlink&quot; href=&quot;#pygame&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When people think of Python game engines, the first thought many have is &lt;a href=&quot;https://www.pygame.org&quot;&gt;Pygame&lt;/a&gt;. In fact, there’s already &lt;a href=&quot;https://realpython.com/pygame-a-primer/&quot;&gt;a great primer on Pygame&lt;/a&gt; available at Real Python.&lt;/p&gt;
&lt;p&gt;Written as a replacement for the stalled PySDL library, Pygame wraps and extends the &lt;a href=&quot;https://www.libsdl.org/&quot;&gt;SDL library&lt;/a&gt;, which stands for &lt;strong&gt;Simple DirectMedia Layer&lt;/strong&gt;. SDL provides cross-platform access to your system’s underlying multimedia hardware components, such as sound, video, mouse, keyboard, and joystick. The cross-platform nature of both SDL and Pygame means that you can write games and rich multimedia Python programs for every platform that supports them!&lt;/p&gt;
&lt;h3 id=&quot;pygame-installation&quot;&gt;Pygame Installation&lt;a class=&quot;headerlink&quot; href=&quot;#pygame-installation&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/top-python-game-engines/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/top-python-game-engines/ »&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>2025-02-01T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how to use spaCy. This free and open-source library for natural language processing (NLP) in Python has a lot of built-in capabilities and is becoming increasingly popular for processing and analyzing data in NLP.</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;transformer models&lt;/strong&gt;, such as &lt;strong&gt;BERT&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=&quot;1&quot;&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-toggle=&quot;modal&quot; data-target=&quot;#modal-natural-language-processing-spacy-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&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/&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 virtual environment 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-toggle=&quot;tab&quot; href=&quot;#windows-1&quot; role=&quot;tab&quot; aria-controls=&quot;windows-1&quot; aria-selected=&quot;true&quot;&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Windows&lt;/a&gt;
  &lt;/li&gt;




  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-linuxmacos&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body small&quot; id=&quot;macos-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#linux-macos-1&quot; role=&quot;tab&quot; aria-controls=&quot;linux-macos-1&quot; aria-selected=&quot;false&quot;&gt;&lt;span class=&quot;icon baseline text-muted&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.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;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pscon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;/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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&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;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;spacy
&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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&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;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&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 REPL and verify that the installation has been successful:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&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>Build a Tic-Tac-Toe Game With Python and Tkinter</title>
      <id>https://realpython.com/tic-tac-toe-python/</id>
      <link href="https://realpython.com/tic-tac-toe-python/"/>
      <updated>2025-02-01T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll learn how to create a tic-tac-toe game using Python and the Tkinter GUI framework. Tkinter is cross-platform and is available in the Python standard library. Creating a game in Python is a great and fun way to learn something new and exciting!</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Developing a tic-tac-toe game in Python using Tkinter combines programming logic with graphical user interface design (GUI). This tutorial guides you through creating the game logic and a Tkinter-based GUI to produce a fully functional tic-tac-toe game. You’ll learn how to manage player moves, detect winning combinations, and build an interactive interface with Tkinter widgets.&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&lt;/strong&gt; can be used to implement the &lt;strong&gt;logic&lt;/strong&gt; for a tic-tac-toe game.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tkinter&lt;/strong&gt; provides tools to build a game &lt;strong&gt;GUI&lt;/strong&gt; using labels and buttons.&lt;/li&gt;
&lt;li&gt;You can connect the &lt;strong&gt;game logic&lt;/strong&gt; and &lt;strong&gt;GUI&lt;/strong&gt; to create a fully interactive application.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Playing computer games is a great way to unwind or challenge yourself, and it’s also fun and educational to build your own. In this project, you’ll use the Tkinter GUI framework from Python’s standard library to create a game interface, while applying the model-view-controller pattern and an object-oriented approach to organize your code. For more on these concepts, check out the links in the &lt;a href=&quot;#prerequisites&quot;&gt;prerequisites&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To download the entire source code for this project, click the link in the box below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/tic-tac-toe-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-tic-tac-toe-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get access to the source code&lt;/a&gt; that you’ll use to build your tic-tac-toe game.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo-a-tic-tac-toe-game-in-python&quot;&gt;Demo: A Tic-Tac-Toe Game in Python&lt;a class=&quot;headerlink&quot; href=&quot;#demo-a-tic-tac-toe-game-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this step-by-step project, you’ll build a tic-tac-toe game in Python. You’ll use the &lt;a href=&quot;https://realpython.com/python-gui-tkinter/&quot;&gt;Tkinter&lt;/a&gt; tool kit from the Python &lt;a href=&quot;https://docs.python.org/3/library/index.html&quot;&gt;standard library&lt;/a&gt; to create the game’s GUI. In the following demo video, you’ll get a sense of how your game will work once you’ve completed this tutorial:&lt;/p&gt;
&lt;figure&gt;
  &lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 &quot;&gt;
    &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/717834507?background=1&quot; frameborder=&quot;0&quot; allow=&quot;fullscreen&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;Your tic-tac-toe game will have an interface that reproduces the classic three-by-three game board. The players will take turns making their moves on a shared device. The game display at the top of the window will show the name of the player who gets to go next.&lt;/p&gt;
&lt;p&gt;If a player wins, then the game display will show a winning message with the player’s name or mark (&lt;em&gt;X&lt;/em&gt; or &lt;em&gt;O&lt;/em&gt;). At the same time, the winning combination of cells will be highlighted on the board.&lt;/p&gt;
&lt;p&gt;Finally, the game’s &lt;em&gt;File&lt;/em&gt; menu will have options to reset the game if you want to play again or to exit the game when you’re done playing.&lt;/p&gt;
&lt;p&gt;If this sounds like a fun project to you, then read on to get started!&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Your goal with this project is to create a tic-tac-toe game in Python. For the game interface, you’ll use the Tkinter GUI tool kit, which comes in the standard Python installation as an &lt;a href=&quot;https://peps.python.org/pep-0206/#batteries-included-philosophy&quot;&gt;included battery&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;The tic-tac-toe game is for two players. One player plays &lt;em&gt;X&lt;/em&gt; and the other plays &lt;em&gt;O&lt;/em&gt;. The players take turns placing their marks on a grid of three-by-three cells. If a given player gets three marks in a row horizontally, vertically, or diagonally, then that player wins the game. The game will be tied if no one gets three in a row by the time all the cells are marked.&lt;/p&gt;
&lt;p&gt;With these rules in mind, you’ll need to put together the following game components:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The game’s &lt;strong&gt;board&lt;/strong&gt;, which you’ll build with a class called &lt;code&gt;TicTacToeBoard&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;The game’s &lt;strong&gt;logic&lt;/strong&gt;, which you’ll manage using a class called &lt;code&gt;TicTacToeGame&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The game board will work as a mix between &lt;strong&gt;view&lt;/strong&gt; and &lt;strong&gt;controller&lt;/strong&gt; in a model-view-controller design. To build the board, you’ll use a Tkinter window, which you can create by instantiating the &lt;a href=&quot;https://realpython.com/python-gui-tkinter/#building-your-first-python-gui-application-with-tkinter&quot;&gt;&lt;code&gt;tkinter.Tk&lt;/code&gt;&lt;/a&gt; class. This window will have two main components:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Top display:&lt;/strong&gt; Shows information about the game’s status&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Grid of cells:&lt;/strong&gt; Represents previous moves and available spaces or cells&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You’ll create the game display using a &lt;a href=&quot;https://realpython.com/python-gui-tkinter/#displaying-text-and-images-with-label-widgets&quot;&gt;&lt;code&gt;tkinter.Label&lt;/code&gt;&lt;/a&gt; widget, which allows you to display text and images.&lt;/p&gt;
&lt;p&gt;For the grid of cells, you’ll use a series of &lt;a href=&quot;https://realpython.com/python-gui-tkinter/#displaying-clickable-buttons-with-button-widgets&quot;&gt;&lt;code&gt;tkinter.Button&lt;/code&gt;&lt;/a&gt; widgets arranged in a &lt;a href=&quot;https://realpython.com/python-gui-tkinter/#the-grid-geometry-manager&quot;&gt;grid&lt;/a&gt;. When a player clicks one of these buttons, the game logic will run to process the player’s move and determine whether there’s a winner. In this case, the game logic will work as the &lt;strong&gt;model&lt;/strong&gt;, which will manage the data, logic, and rules of your game.&lt;/p&gt;
&lt;p&gt;Now that you have a general idea of how to build your tic-tac-toe game, you should check out a few knowledge prerequisites that’ll allow you to get the most out of this tutorial.&lt;/p&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To complete this tic-tac-toe game project, you should be comfortable or at least familiar with the concepts and topics covered in the following resources:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/tic-tac-toe-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/tic-tac-toe-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>A Guide to Modern Python String Formatting Tools</title>
      <id>https://realpython.com/python-formatted-output/</id>
      <link href="https://realpython.com/python-formatted-output/"/>
      <updated>2025-02-01T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll explore Python&#x27;s modern string formatting tools. You&#x27;ll learn how to harness the power of Python&#x27;s f-strings and the .format() method for string interpolation and formatting.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In modern Python, you have f-strings and the &lt;code&gt;.format()&lt;/code&gt; method to approach the tasks of interpolating and formatting strings.
These tools help you embed variables and expressions directly into strings, control text alignment, and use custom format specifiers to modify how values appear. You can apply these techniques to create well-structured and readable Python code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;String interpolation&lt;/strong&gt; in Python involves embedding variables and expressions into strings.&lt;/li&gt;
&lt;li&gt;You create an &lt;strong&gt;f-string&lt;/strong&gt; in Python by prepending a string literal with an &lt;strong&gt;&lt;code&gt;f&lt;/code&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;code&gt;F&lt;/code&gt;&lt;/strong&gt; and using &lt;strong&gt;curly braces&lt;/strong&gt; to include variables or expressions.&lt;/li&gt;
&lt;li&gt;You can use variables in Python’s &lt;strong&gt;&lt;code&gt;.format()&lt;/code&gt; method&lt;/strong&gt; by placing them inside curly braces and passing them as &lt;strong&gt;arguments&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Format specifiers&lt;/strong&gt; in Python control how values appear when formatted, using components like &lt;strong&gt;fill, align, sign, width, and type&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You align text in Python string formatting using the &lt;strong&gt;align&lt;/strong&gt; component, which can justify text to the &lt;strong&gt;left, right, or center&lt;/strong&gt; within a specified width.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When working with strings in Python, you can leverage these formatting techniques to create dynamic and readable output. To get the most out of this tutorial, you should know the basics of Python programming and the &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt; data type.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-formatted-output-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-formatted-output-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to use modern string formatting tools 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.6eec2e95bede.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 “A Guide to Modern Python String Formatting Tools” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

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

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

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #fe7e73;&quot; alt=&quot;A Guide to Modern Python String Formatting Tools&quot; src=&quot;https://files.realpython.com/media/UPDATE-A-Guide-to-the-Newer-Python-String-Format-Techniques_Watermarked-2.f985e287c6ef.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/UPDATE-A-Guide-to-the-Newer-Python-String-Format-Techniques_Watermarked-2.f985e287c6ef.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/UPDATE-A-Guide-to-the-Newer-Python-String-Format-Techniques_Watermarked-2.f985e287c6ef.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/UPDATE-A-Guide-to-the-Newer-Python-String-Format-Techniques_Watermarked-2.f985e287c6ef.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/UPDATE-A-Guide-to-the-Newer-Python-String-Format-Techniques_Watermarked-2.f985e287c6ef.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.6eec2e95bede.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-formatted-output/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;A Guide to Modern Python String Formatting Tools&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;You can take this quiz to test your understanding of modern tools for string formatting in Python. These tools include f-strings and the .format() method.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;getting-to-know-string-interpolation-and-formatting-in-python&quot;&gt;Getting to Know String Interpolation and Formatting in Python&lt;a class=&quot;headerlink&quot; href=&quot;#getting-to-know-string-interpolation-and-formatting-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python has developed different string interpolation and formatting tools over the years. If you’re getting started with Python and looking for a quick way to format your strings, then you should use &lt;a href=&quot;https://realpython.com/python-f-strings/&quot;&gt;Python’s f-strings&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; To learn more about string interpolation, check out the &lt;a href=&quot;https://realpython.com/python-string-interpolation/&quot;&gt;String Interpolation in Python: Exploring Available Tools&lt;/a&gt; tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;If you need to work with older versions of Python or legacy code, then it’s a good idea to learn about the other formatting tools, such as the &lt;code&gt;.format()&lt;/code&gt; method.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn how to format your strings using f-strings and the &lt;code&gt;.format()&lt;/code&gt; method. You’ll start with &lt;a href=&quot;/ref/glossary/f-string/&quot; class=&quot;ref-link&quot;&gt;f-strings&lt;/a&gt; to kick things off, which are quite popular in modern Python code.&lt;/p&gt;
&lt;h2 id=&quot;using-f-strings-for-string-interpolation&quot;&gt;Using F-Strings for String Interpolation&lt;a class=&quot;headerlink&quot; href=&quot;#using-f-strings-for-string-interpolation&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python has a string formatting tool called &lt;strong&gt;f-strings&lt;/strong&gt;, which stands for &lt;strong&gt;formatted string literals&lt;/strong&gt;. F-strings are string literals that you can create by prepending an &lt;code&gt;f&lt;/code&gt; or &lt;code&gt;F&lt;/code&gt; to the literal. They allow you to do string interpolation and formatting by inserting variables or expressions directly into the literal.&lt;/p&gt;
&lt;h3 id=&quot;creating-f-string-literals&quot;&gt;Creating F-String Literals&lt;a class=&quot;headerlink&quot; href=&quot;#creating-f-string-literals&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Here you’ll take a look at how you can create an f-string by prepending the string literal with an &lt;code&gt;f&lt;/code&gt; or &lt;code&gt;F&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;go&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;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, Pythonista!&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;Hello, Pythonista!&#x27;&lt;/span&gt;

&lt;span class=&quot;go&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;sa&quot;&gt;F&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, Pythonista!&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;Hello, Pythonista!&#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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Using either &lt;code&gt;f&lt;/code&gt; or &lt;code&gt;F&lt;/code&gt; has the same effect. However, it’s a more common practice to use a lowercase &lt;code&gt;f&lt;/code&gt; to create f-strings.&lt;/p&gt;
&lt;p&gt;Just like with regular string literals, you can use single, double, or triple quotes to define an f-string:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;go&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;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27;Single-line f-string with single quotes&#x27;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;Single-line f-string with single quotes&#x27;&lt;/span&gt;

&lt;span class=&quot;go&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;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Single-line f-string with double quotes&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;Single-line f-string with single quotes&#x27;&lt;/span&gt;
&lt;span class=&quot;go&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;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27;&#x27;&#x27;Multiline triple-quoted f-string&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;with single quotes&#x27;&#x27;&#x27;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;Multiline triple-quoted f-string\nwith single quotes&#x27;&lt;/span&gt;

&lt;span class=&quot;go&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;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&quot;Multiline triple-quoted f-string&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;with double quotes&quot;&quot;&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;Multiline triple-quoted f-string\nwith double quotes&#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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Up to this point, your f-strings look pretty much the same as regular strings. However, if you create f-strings like those in the examples above, you’ll get complaints from your code &lt;a href=&quot;https://realpython.com/python-code-quality/#linters&quot;&gt;linter&lt;/a&gt; if you have one.&lt;/p&gt;
&lt;p&gt;The remarkable feature of f-strings is that you can embed Python &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/python-operators-expressions/&quot;&gt;expressions&lt;/a&gt; directly inside them. To insert the variable or expression, you must use a &lt;strong&gt;replacement field&lt;/strong&gt;, which you create using a pair of curly braces.&lt;/p&gt;
&lt;h3 id=&quot;interpolating-variables-into-f-strings&quot;&gt;Interpolating Variables Into F-Strings&lt;a class=&quot;headerlink&quot; href=&quot;#interpolating-variables-into-f-strings&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The variable that you insert in a replacement field is evaluated and converted to its &lt;a href=&quot;https://realpython.com/python-repr-vs-str/&quot;&gt;string representation&lt;/a&gt;. The result is interpolated into the original string at the replacement field’s location:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;site&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Real Python&quot;&lt;/span&gt;

&lt;span class=&quot;go&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;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Welcome to &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;site&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;go&quot;&gt;&#x27;Welcome to Real Python!&#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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this example, you’ve interpolated the &lt;code&gt;site&lt;/code&gt; variable into your string. Note that Python treats anything outside the curly braces as a regular string.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-formatted-output/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-formatted-output/ »&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 &amp; APIs: A Winning Combo for Reading Public Data</title>
      <id>https://realpython.com/python-api/</id>
      <link href="https://realpython.com/python-api/"/>
      <updated>2025-02-01T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn what APIs are and how to consume them using Python. You&#x27;ll also learn some core concepts for working with APIs, such as status codes, HTTP methods, the requests library, and much more. You&#x27;ll also see a few examples of real-life APIs and how to consume them.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python is an excellent choice for working with Application Programming Interfaces (APIs), allowing you to efficiently consume and interact with them. By using the Requests library, you can easily fetch data from APIs that communicate using HTTP, such as REST, SOAP, or GraphQL APIs. This tutorial covers the essentials of consuming REST APIs with Python, including authentication and handling responses.&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;An &lt;strong&gt;API&lt;/strong&gt; is an interface that allows different systems to communicate, typically through requests and responses.&lt;/li&gt;
&lt;li&gt;Python is a versatile language for &lt;strong&gt;consuming APIs&lt;/strong&gt;, offering libraries like &lt;strong&gt;Requests&lt;/strong&gt; to simplify the process.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;REST and GraphQL&lt;/strong&gt; are two common &lt;strong&gt;types of APIs&lt;/strong&gt;, with REST being more widely used for public APIs.&lt;/li&gt;
&lt;li&gt;To handle &lt;strong&gt;API authentication in Python&lt;/strong&gt;, you can use API keys or more complex methods like &lt;strong&gt;OAuth&lt;/strong&gt; to access protected resources.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Knowing how to consume an API is one of those magical skills that, once mastered, will crack open a whole new world of possibilities, and consuming APIs using Python is a great way to learn such a skill.&lt;/p&gt;
&lt;p&gt;By the end of this tutorial, you’ll be able to use Python to consume most of the APIs that you come across. If you’re a developer, then knowing how to consume APIs with Python will empower you to integrate data from various online sources into your applications&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 this tutorial, you’ll focus on how to &lt;em&gt;consume&lt;/em&gt; APIs using Python, not how to build them. For information on building an API with Python, check out &lt;a href=&quot;https://realpython.com/flask-connexion-rest-api/&quot;&gt;Python REST APIs With Flask, Connexion, and SQLAlchemy&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can download the source code for the examples that you’ll see in this tutorial 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=&quot;1&quot;&gt;Get the Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/consuming-apis-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-consuming-apis-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to learn about consuming APIs with Python in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;getting-to-know-apis&quot;&gt;Getting to Know APIs&lt;a class=&quot;headerlink&quot; href=&quot;#getting-to-know-apis&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;API stands for &lt;strong&gt;application programming interface&lt;/strong&gt;. In essence, an API acts as a communication layer, or interface, that allows different systems to talk to each other without having to understand exactly what the others do.&lt;/p&gt;
&lt;p&gt;APIs can come in many forms or shapes. They can be operating system APIs, used for actions like turning on your camera and audio when joining a Zoom call. Or they can be web APIs, used for web-focused actions, such as liking images on your Instagram or fetching the latest tweets.&lt;/p&gt;
&lt;p&gt;No matter the type, all APIs function mostly the same way. You usually make a &lt;strong&gt;request&lt;/strong&gt; for information or data, and the API returns a &lt;strong&gt;response&lt;/strong&gt; with what you requested. For example, every time you open Twitter or scroll down your Instagram feed, you’re basically making a request to the API behind that app and getting a response in return. This is also known as &lt;strong&gt;calling&lt;/strong&gt; an API.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll focus more on the high-level APIs that communicate across networks, also called &lt;strong&gt;web APIs&lt;/strong&gt;. &lt;/p&gt;
&lt;h3 id=&quot;soap-vs-rest-vs-graphql&quot;&gt;SOAP vs REST vs GraphQL&lt;a class=&quot;headerlink&quot; href=&quot;#soap-vs-rest-vs-graphql&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Even though some of the examples above are geared toward newer platforms or apps, web APIs have been around for quite a long time. In the late 1990s and early 2000s, two different design models became the norm in exposing data publicly:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;SOAP (Simple Object Access Protocol)&lt;/strong&gt; is typically associated with the enterprise world, has a stricter contract-based usage, and is mostly designed around actions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;REST (Representational State Transfer)&lt;/strong&gt; is typically used for public APIs and is ideal for fetching data from the Web. It’s much lighter and closer to the HTTP specification than SOAP.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Nowadays, there’s a new kid in town: &lt;a href=&quot;https://graphql.org/&quot;&gt;GraphQL&lt;/a&gt;. Created by Facebook, GraphQL is a very flexible query language for APIs, where the clients decide exactly what they want to fetch from the server instead of letting the server decide what to send.&lt;/p&gt;
&lt;p&gt;If you want to learn more about the differences between these three design models, then here are a few good resources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.altexsoft.com/blog/engineering/what-is-soap-formats-protocols-message-structure-and-how-soap-is-different-from-rest/&quot;&gt;What is SOAP?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://restfulapi.net/&quot;&gt;What is REST?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://blog.postman.com/soap-vs-rest/&quot;&gt;API 101: SOAP vs. REST&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://graphql.org/learn/&quot;&gt;Introduction to GraphQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.altexsoft.com/blog/soap-vs-rest-vs-graphql-vs-rpc/&quot;&gt;Comparing API Architectural Styles: SOAP vs REST vs GraphQL vs RPC&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Even though GraphQL is on the rise and is being adopted by bigger and bigger companies, including &lt;a href=&quot;https://docs.github.com/en/graphql&quot;&gt;GitHub&lt;/a&gt; and &lt;a href=&quot;https://shopify.dev/docs/admin-api/graphql/reference&quot;&gt;Shopify&lt;/a&gt;, the truth is that the majority of public APIs are still REST APIs. Therefore, for the purpose of this tutorial, you’ll learn only about REST APIs and how to consume them using Python.&lt;/p&gt;
&lt;h3 id=&quot;apis-and-requests-a-match-made-in-heaven&quot;&gt;APIs and &lt;code&gt;requests&lt;/code&gt;: A Match Made in Heaven&lt;a class=&quot;headerlink&quot; href=&quot;#apis-and-requests-a-match-made-in-heaven&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When consuming APIs with Python, there’s only one library you need: &lt;a href=&quot;https://realpython.com/python-requests/&quot;&gt;&lt;code&gt;requests&lt;/code&gt;&lt;/a&gt;. With it, you should be able to do most, if not all, of the actions required to consume any public API.&lt;/p&gt;
&lt;p&gt;You can install &lt;code&gt;requests&lt;/code&gt; by running the following command in your console:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;requests
&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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The examples in this tutorial have been tested with Python 3.13.1 and &lt;code&gt;requests&lt;/code&gt; 2.32.3. However, any supported version of Python and &lt;code&gt;requests&lt;/code&gt; should yield similar results.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-api/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-api/ »&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>Providing Multiple Constructors in Your Python Classes</title>
      <id>https://realpython.com/python-multiple-constructors/</id>
      <link href="https://realpython.com/python-multiple-constructors/"/>
      <updated>2025-02-01T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how to provide multiple constructors in your Python classes. To this end, you&#x27;ll learn different techniques, such as checking argument types, using default argument values, writing class methods, and implementing single-dispatch methods.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python doesn’t support constructor overloading in the same way that Java or C++ do. However, you can simulate multiple constructors by defining default arguments in &lt;code&gt;.__init__()&lt;/code&gt; and use &lt;code&gt;@classmethod&lt;/code&gt; to define alternative constructors. Another option is to employ the &lt;code&gt;@singledispatchmethod&lt;/code&gt; decorator for method overloading based on argument types. These techniques provide flexible ways to construct objects in Python.&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;create multiple constructors&lt;/strong&gt; in Python by using &lt;strong&gt;optional arguments&lt;/strong&gt; and branching logic in the &lt;code&gt;.__init__()&lt;/code&gt; method.&lt;/li&gt;
&lt;li&gt;The built-in &lt;strong&gt;&lt;code&gt;@classmethod&lt;/code&gt;&lt;/strong&gt; decorator allows you to &lt;strong&gt;define alternative constructors&lt;/strong&gt;, using the class itself as the first argument.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;@singledispatchmethod&lt;/code&gt;&lt;/strong&gt; can simulate overloaded constructors based on the &lt;strong&gt;type of the first argument&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Having the tools to provide multiple constructors will help you write flexible classes that can adapt to changing needs.&lt;/p&gt;
&lt;p&gt;You’ll also get a peek under the hood at how Python internally &lt;strong&gt;constructs instances&lt;/strong&gt; of a regular class and how some &lt;strong&gt;standard-library classes&lt;/strong&gt; provide multiple constructors.&lt;/p&gt;
&lt;p&gt;To get the most out of this tutorial, you should have basic knowledge of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; and understand how to define &lt;a href=&quot;https://realpython.com/instance-class-and-static-methods-demystified/&quot;&gt;class methods&lt;/a&gt; with &lt;code&gt;@classmethod&lt;/code&gt;. You should also have experience working with &lt;a href=&quot;https://realpython.com/primer-on-python-decorators/&quot;&gt;decorators&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=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-oop/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-oop&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get access to a free Python OOP Cheat Sheet&lt;/a&gt; that points you to the best tutorials, videos, and books to learn more about Object-Oriented Programming with Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;instantiating-classes-in-python&quot;&gt;Instantiating Classes in Python&lt;a class=&quot;headerlink&quot; href=&quot;#instantiating-classes-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python supports &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; with &lt;strong&gt;classes&lt;/strong&gt; that are straightforward to create and use. Python classes offer powerful features that can help you write better software. Classes are like blueprints for &lt;strong&gt;objects&lt;/strong&gt;, also known as &lt;strong&gt;instances&lt;/strong&gt;. In the same way that you can build several houses from a single blueprint, you can build several instances from a class.&lt;/p&gt;
&lt;p&gt;To define a class in Python, you need to use the &lt;a href=&quot;https://realpython.com/python-keywords/#structure-keywords-def-class-with-as-pass-lambda&quot;&gt;&lt;code&gt;class&lt;/code&gt;&lt;/a&gt; keyword followed by the class name:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;# Define a Person class&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;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&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;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fm&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&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;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
&lt;span class=&quot;gp&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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Python has a rich set of &lt;a href=&quot;https://realpython.com/python-classes/#special-methods-and-protocols&quot;&gt;special methods&lt;/a&gt; that you can use in your classes. Python implicitly calls special methods to automatically execute a wide variety of operations on instances. There are special methods to make your objects iterable, provide a suitable string representation for your objects, initialize instance attributes, and a lot more.&lt;/p&gt;
&lt;p&gt;A pretty common special method is &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__init__&quot;&gt;&lt;code&gt;.__init__()&lt;/code&gt;&lt;/a&gt;. This method provides what’s known as the &lt;strong&gt;instance initializer&lt;/strong&gt; in Python. This method’s job is to initialize &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/#class-and-instance-attributes&quot;&gt;instance attributes&lt;/a&gt; with appropriate values when you instantiate a given class.&lt;/p&gt;
&lt;p&gt;In &lt;code&gt;Person&lt;/code&gt;, the &lt;code&gt;.__init__()&lt;/code&gt; method’s first argument is called &lt;code&gt;self&lt;/code&gt;. This argument holds the current object or instance, which is passed implicitly in the method call. This argument is common to every &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/#instance-methods&quot;&gt;instance method&lt;/a&gt; in Python. The second argument to &lt;code&gt;.__init__()&lt;/code&gt; is called &lt;code&gt;name&lt;/code&gt; and will hold the person’s name as a &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Using &lt;a href=&quot;https://www.python.org/dev/peps/pep-0008/#function-and-method-arguments&quot;&gt;&lt;code&gt;self&lt;/code&gt;&lt;/a&gt; to name the current object is a pretty strong convention in Python but not a requirement. However, using another name will raise some eyebrows among your fellow Python developers.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Once you’ve defined a class, you can start &lt;strong&gt;instantiating&lt;/strong&gt; it. In other words, you can start creating objects of that class. To do this, you’ll use a familiar syntax. Just call the class using a pair of parentheses (&lt;code&gt;()&lt;/code&gt;), which is the same syntax that you use to call any Python &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;function&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&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; role=&quot;button&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.6eec2e95bede.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 style=&quot;position: relative;&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;# Instantiating Person&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;john&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;John Doe&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;john&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;John Doe&#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;&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.6eec2e95bede.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.6eec2e95bede.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In Python, the class name provides what other languages, such as &lt;a href=&quot;https://realpython.com/python-vs-cpp/&quot;&gt;C++&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/java-vs-python/&quot;&gt;Java&lt;/a&gt;, call the &lt;strong&gt;class constructor&lt;/strong&gt;. Calling a class, like you did with &lt;code&gt;Person&lt;/code&gt;, triggers Python’s class &lt;strong&gt;instantiation process&lt;/strong&gt;, which internally runs in two steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Create&lt;/strong&gt; a new instance of the target class.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Initialize&lt;/strong&gt; the instance with suitable instance attribute values.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To continue with the above example, the value that you pass as an argument to &lt;code&gt;Person&lt;/code&gt; is internally passed to &lt;code&gt;.__init__()&lt;/code&gt; and then assigned to the instance attribute &lt;code&gt;.name&lt;/code&gt;. This way, you initialize your person instance, &lt;code&gt;john&lt;/code&gt;, with valid data, which you can confirm by accessing &lt;code&gt;.name&lt;/code&gt;. Success! &lt;code&gt;John Doe&lt;/code&gt; is indeed his name.&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; When you call the class to create a new instance, you need to provide as many arguments as &lt;code&gt;.__init__()&lt;/code&gt; requires so that this method can initialize all the instance attributes that demand an initial value.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now that you understand the object initialization mechanism, you’re ready to learn what Python does before it gets to this point in the instantiation process. It’s time to dig into another special method, called &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__new__&quot;&gt;&lt;code&gt;.__new__()&lt;/code&gt;&lt;/a&gt;. This method takes care of creating new instances in Python.&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 &lt;code&gt;.__new__()&lt;/code&gt; special method is often called a &lt;strong&gt;class constructor&lt;/strong&gt; in Python. However, its job is actually to create new objects from the class blueprint, so you can more accurately call it an &lt;strong&gt;instance creator&lt;/strong&gt; or &lt;strong&gt;object creator&lt;/strong&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;.__new__()&lt;/code&gt; special method takes the underlying class as its first argument and returns a new object. This object is typically an instance of the input class, but in some cases, it can be an instance of a different class.&lt;/p&gt;
&lt;p&gt;If the object that &lt;code&gt;.__new__()&lt;/code&gt; returns is an instance of the current class, then this instance is immediately passed to &lt;code&gt;.__init__()&lt;/code&gt; for initialization purposes. These two steps run when you call the class.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-multiple-constructors/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-multiple-constructors/ »&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 #237: Testing Your Python Code Base: Unit vs. Integration</title>
      <id>https://realpython.com/podcasts/rpp/237/</id>
      <link href="https://realpython.com/podcasts/rpp/237/"/>
      <updated>2025-01-31T12:00:00+00:00</updated>
      <summary>What goes into creating automated tests for your Python code? Should you focus on testing the individual code sections or on how the entire system runs? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What goes into creating automated tests for your Python code? Should you focus on testing the individual code sections or on how the entire system runs? Christopher Trudeau is back on the show this week, bringing 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>Creating a Scalable Flask Web Application From Scratch</title>
      <id>https://realpython.com/courses/create-scalable-flask-web-app/</id>
      <link href="https://realpython.com/courses/create-scalable-flask-web-app/"/>
      <updated>2025-01-28T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll explore the process of creating a boilerplate for a Flask web project. It&#x27;s a great starting point for any scalable Flask web app that you wish to develop in the future, from basic web pages to complex web applications.</summary>
      <content type="html">
        &lt;p&gt;Flask is a powerful and flexible micro web framework for Python, ideal for both small and large web projects. It provides a straightforward way to get a web application up and running, with all the features that you need to get started.&lt;/p&gt;
&lt;p&gt;Over the course of this video course, you&amp;rsquo;ll explore the process of creating a boilerplate for a Flask web project. This boilerplate will serve as a great starting point for any scalable Flask web app that you wish to develop in the future, from basic web pages to complex web applications.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up a &lt;strong&gt;Flask project&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create a &lt;code&gt;&quot;Hello, World!&quot;&lt;/code&gt; &lt;strong&gt;Flask app&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;multiple pages&lt;/strong&gt; with blueprints&lt;/li&gt;
&lt;li&gt;Leverage &lt;strong&gt;Jinja templates&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Store &lt;strong&gt;static files&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #236: Simon Willison: Using LLMs for Python Development</title>
      <id>https://realpython.com/podcasts/rpp/236/</id>
      <link href="https://realpython.com/podcasts/rpp/236/"/>
      <updated>2025-01-24T12:00:00+00:00</updated>
      <summary>What are the current large language model (LLM) tools you can use to develop Python? What prompting techniques and strategies produce better results? This week on the show, we speak with Simon Willison about his LLM research and his exploration of writing Python code with these rapidly evolving tools.</summary>
      <content type="html">
        &lt;p&gt;What are the current large language model (LLM) tools you can use to develop Python? What prompting techniques and strategies produce better results? This week on the show, we speak with Simon Willison about his LLM research and his exploration of writing Python code with these rapidly evolving tools.&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 Python&#x27;s tuple Data Type With Examples</title>
      <id>https://realpython.com/courses/exploring-tuple-data-type-examples/</id>
      <link href="https://realpython.com/courses/exploring-tuple-data-type-examples/"/>
      <updated>2025-01-21T14:00:00+00:00</updated>
      <summary>In Python, a tuple is a built-in data type that allows you to create immutable sequences of values. The values or items in a tuple can be of any type. This makes tuples pretty useful in those situations where you need to store heterogeneous data, like that in a database record, for example.</summary>
      <content type="html">
        &lt;p&gt;In Python, a &lt;strong&gt;&lt;code&gt;tuple&lt;/code&gt;&lt;/strong&gt; is a built-in data type that allows you to create &lt;strong&gt;immutable sequences&lt;/strong&gt; of values. The values or items in a tuple can be of any type. This makes tuples pretty useful in those situations where you need to store heterogeneous data, like that in a database record, for example.&lt;/p&gt;
&lt;p&gt;Through this tutorial, you&amp;rsquo;ll dive deep into Python tuples and get a solid understanding of their key features and use cases. This knowledge will allow you to write more efficient and reliable code by taking advantage of tuples.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Create&lt;/strong&gt; tuples in Python&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Access&lt;/strong&gt; the items in an existing tuple&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unpack&lt;/strong&gt;, &lt;strong&gt;return&lt;/strong&gt;, &lt;strong&gt;copy&lt;/strong&gt;, and &lt;strong&gt;concatenate&lt;/strong&gt; tuples&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reverse&lt;/strong&gt;, &lt;strong&gt;sort&lt;/strong&gt;, and &lt;strong&gt;traverse&lt;/strong&gt; existing tuples&lt;/li&gt;
&lt;li&gt;Explore other &lt;strong&gt;features&lt;/strong&gt; and common &lt;strong&gt;gotchas&lt;/strong&gt; of tuples&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: How to Deal With Missing Data in Polars</title>
      <id>https://realpython.com/quizzes/how-to-deal-with-missing-data-in-polars/</id>
      <link href="https://realpython.com/quizzes/how-to-deal-with-missing-data-in-polars/"/>
      <updated>2025-01-21T12:00:00+00:00</updated>
      <summary>This quiz will test your knowledge of working with null data in Polars. You won&#x27;t find all the answers in the tutorial, so you&#x27;ll need to do some extra investigating. By finding all the answers, you&#x27;re sure to learn some interesting things along the way.</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/polars-missing-data/&quot;&gt;How to Deal With Missing Data in Polars&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through the questions, you&amp;rsquo;ll review your understanding of dealing with &lt;code&gt;null&lt;/code&gt; values in Polars and also expand on what you learned in the tutorial.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll need to do some research outside of the tutorial to answer all the questions. Embrace this challenge and let it take you on a learning journey.&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 #235: Principles for Considering Your Python Tooling</title>
      <id>https://realpython.com/podcasts/rpp/235/</id>
      <link href="https://realpython.com/podcasts/rpp/235/"/>
      <updated>2025-01-17T12:00:00+00:00</updated>
      <summary>What are the principles you should consider when making decisions about which Python tools to use? What anti-patterns get in the way of making the right choices for your team? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What are the principles you should consider when making decisions about which Python tools to use? What anti-patterns get in the way of making the right choices for your team? Christopher Trudeau is back on the show this week, bringing 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>Building Dictionary Comprehensions in Python</title>
      <id>https://realpython.com/courses/building-dictionary-comprehensions/</id>
      <link href="https://realpython.com/courses/building-dictionary-comprehensions/"/>
      <updated>2025-01-14T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to write dictionary comprehensions in Python. You&#x27;ll also explore the most common use cases for dictionary comprehensions and learn about some bad practices that you should avoid when using them in your code.</summary>
      <content type="html">
        &lt;p&gt;Dictionary comprehensions are a concise and quick way to create, transform, and filter dictionaries in Python. They can significantly enhance your code&amp;rsquo;s conciseness and readability compared to using regular &lt;code&gt;for&lt;/code&gt; loops to process your dictionaries.&lt;/p&gt;
&lt;p&gt;Understanding dictionary comprehensions is crucial for you as a Python developer because they&amp;rsquo;re a Pythonic tool for dictionary manipulation and can be a valuable addition to your programming toolkit.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Create&lt;/strong&gt; dictionaries using dictionary comprehensions&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Transform&lt;/strong&gt; existing dictionaries with comprehensions&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Filter&lt;/strong&gt; key-value pairs from dictionaries using conditionals&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Decide&lt;/strong&gt; when to use dictionary comprehensions&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #234: Building New Structures for Learning Python</title>
      <id>https://realpython.com/podcasts/rpp/234/</id>
      <link href="https://realpython.com/podcasts/rpp/234/"/>
      <updated>2025-01-10T12:00:00+00:00</updated>
      <summary>What are the new ways we can teach and share our knowledge about Python? How can we improve the structure of our current offerings and build new educational resources for our audience of Python learners? This week on the show, Real Python core team members Stephen Gruppetta and Martin Breuss join us to discuss enhancements to the site and new ways to learn Python.</summary>
      <content type="html">
        &lt;p&gt;What are the new ways we can teach and share our knowledge about Python? How can we improve the structure of our current offerings and build new educational resources for our audience of Python learners? This week on the show, Real Python core team members Stephen Gruppetta and Martin Breuss join us to discuss enhancements to the site and new ways to learn 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>Ways to Start Interacting With Python</title>
      <id>https://realpython.com/courses/interactive-python/</id>
      <link href="https://realpython.com/courses/interactive-python/"/>
      <updated>2025-01-07T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll explore the various ways of interacting with Python. You&#x27;ll learn about the REPL for quick testing and running scripts, as well as how to work with different IDEs, and Python&#x27;s IDLE.</summary>
      <content type="html">
        &lt;p&gt;There are multiple ways of interacting with Python, and each can be useful for different scenarios. You can quickly explore functionality in Python&amp;rsquo;s interactive mode using the &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;built-in Read-Eval-Print Loop (REPL)&lt;/a&gt;, or you can write larger applications to a script file using an &lt;a href=&quot;https://realpython.com/python-ides-code-editors-guide/&quot;&gt;editor or Integrated Development Environment (IDE)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use Python &lt;strong&gt;interactively&lt;/strong&gt; by typing code directly into the interpreter&lt;/li&gt;
&lt;li&gt;Execute code contained in a &lt;strong&gt;script file&lt;/strong&gt; from the &lt;strong&gt;command line&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Work within a Python &lt;strong&gt;Integrated Development Environment (IDE)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Assess additional options, such as &lt;strong&gt;Thonny&lt;/strong&gt; and Python&amp;rsquo;s &lt;strong&gt;IDLE&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #233: PyCoder&#x27;s Weekly 2024 Top Articles &amp; Missing Gems</title>
      <id>https://realpython.com/podcasts/rpp/233/</id>
      <link href="https://realpython.com/podcasts/rpp/233/"/>
      <updated>2025-01-03T12:00:00+00:00</updated>
      <summary>PyCoder&#x27;s Weekly included over 1,500 links to articles, blog posts, tutorials, and projects in 2024. Christopher Trudeau is back on the show this week to help wrap it all up by sharing some highlights and uncovering a few missing gems from the pile.</summary>
      <content type="html">
        &lt;p&gt;PyCoder&#x27;s Weekly included over 1,500 links to articles, blog posts, tutorials, and projects in 2024. Christopher Trudeau is back on the show this week to help wrap it all up by sharing some highlights and uncovering a few missing gems from the pile.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Building HTTP APIs With Django REST Framework</title>
      <id>https://realpython.com/courses/django-rest-framework/</id>
      <link href="https://realpython.com/courses/django-rest-framework/"/>
      <updated>2024-12-31T14:00:00+00:00</updated>
      <summary>This course will get you ready to build HTTP APIs with Django REST Framework. The Django REST framework (DRF) is a toolkit built on top of the Django web framework that reduces the amount of code you need to write to create REST interfaces.</summary>
      <content type="html">
        &lt;p&gt;REST is a loosely defined protocol for listing, creating, changing, and deleting data on your server over HTTP. The Django REST framework (DRF) is a toolkit built on top of the Django web framework that reduces the amount of code you need to write to create REST HTTP API interfaces.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course you&amp;rsquo;ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;REST protocol&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;DRF &lt;strong&gt;&lt;code&gt;Serializers&lt;/code&gt;&lt;/strong&gt; and how to use them with Django objects&lt;/li&gt;
&lt;li&gt;Using Django &lt;code&gt;views&lt;/code&gt; and DRF &lt;code&gt;ViewSet&lt;/code&gt; classes to create REST &lt;strong&gt;end-points&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Multiple flavors of &lt;strong&gt;renderers&lt;/strong&gt; and how to control their output&lt;/li&gt;
&lt;li&gt;Specifying &lt;strong&gt;permissions&lt;/strong&gt; and limiting who can see what data in your REST API&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #232: Exploring Modern Sentiment Analysis Approaches in Python</title>
      <id>https://realpython.com/podcasts/rpp/232/</id>
      <link href="https://realpython.com/podcasts/rpp/232/"/>
      <updated>2024-12-20T12:00:00+00:00</updated>
      <summary>What are the current approaches for analyzing emotions within a piece of text? Which tools and Python packages should you use for sentiment analysis? This week, Jodie Burchell, developer advocate for data science at JetBrains, returns to the show to discuss modern sentiment analysis in Python.</summary>
      <content type="html">
        &lt;p&gt;What are the current approaches for analyzing emotions within a piece of text? Which tools and Python packages should you use for sentiment analysis? This week, Jodie Burchell, developer advocate for data science at JetBrains, returns to the show to discuss modern sentiment analysis 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>Quiz: How to Remove Items From Lists in Python</title>
      <id>https://realpython.com/quizzes/remove-item-from-list-python/</id>
      <link href="https://realpython.com/quizzes/remove-item-from-list-python/"/>
      <updated>2024-12-18T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of removing items from lists in Python. This is a fundamental skill in Python programming, and mastering it will enable you to manipulate lists effectively.</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/remove-item-from-list-python/&quot;&gt;How to Remove Items From Lists in Python&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit the different approaches to removing items from a list in Python, including &lt;code&gt;.pop()&lt;/code&gt;, &lt;code&gt;.remove()&lt;/code&gt;, the &lt;code&gt;del&lt;/code&gt; statement, and more.&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>Programming Sockets in Python</title>
      <id>https://realpython.com/courses/programming-sockets/</id>
      <link href="https://realpython.com/courses/programming-sockets/"/>
      <updated>2024-12-17T14:00:00+00:00</updated>
      <summary>In this in-depth video course, you&#x27;ll learn how to build a socket server and client with Python. By the end, you&#x27;ll understand how to use the main functions and methods in Python&#x27;s socket module to write your own networked client-server applications.</summary>
      <content type="html">
        &lt;p&gt;Sockets and the socket API are used to send messages across a network. They provide a form of &lt;a href=&quot;https://en.wikipedia.org/wiki/Inter-process_communication&quot;&gt;inter-process communication (IPC)&lt;/a&gt;. The network can be a logical, local network to the computer, or one that&amp;rsquo;s physically connected to an external network with its own connections to other networks. The obvious example is the Internet, which you connect to via your ISP.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll create:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A simple &lt;strong&gt;socket server and client&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;An improved version that handles &lt;strong&gt;multiple connections&lt;/strong&gt; simultaneously&lt;/li&gt;
&lt;li&gt;A server-client application that functions like a full-fledged &lt;strong&gt;socket application&lt;/strong&gt;, complete with its own &lt;strong&gt;custom header and content&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Documenting Python Projects With Sphinx and Read the Docs</title>
      <id>https://realpython.com/courses/python-sphinx/</id>
      <link href="https://realpython.com/courses/python-sphinx/"/>
      <updated>2024-12-10T14:00:00+00:00</updated>
      <summary>In this video series, you&#x27;ll create project documentation from scratch using Sphinx, the de facto standard for Python. You&#x27;ll also hook your code repository up to Read The Docs to automatically build and publish your code documentation.</summary>
      <content type="html">
        &lt;p&gt;&lt;a href=&quot;https://www.sphinx-doc.org/&quot;&gt;Sphinx&lt;/a&gt; is a document generation tool that&amp;rsquo;s become the de facto standard for Python projects. It uses the &lt;a href=&quot;https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html&quot;&gt;reStructuredText&lt;/a&gt; (RST) markup language to define document structure and styling, and it can output in a wide variety of formats, including &lt;a href=&quot;https://realpython.com/html-css-python/&quot;&gt;HTML&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/EPUB&quot;&gt;ePub&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Man_page&quot;&gt;man pages&lt;/a&gt;, and much more. Sphinx is extendable and has plugins for incorporating &lt;a href=&quot;https://docs.python.org/3/library/pydoc.html&quot;&gt;pydoc&lt;/a&gt; comments from your code into your docs and for using &lt;a href=&quot;https://jupyterbook.org/en/stable/content/myst.html&quot;&gt;MyST Markdown&lt;/a&gt; instead of RST.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://readthedocs.org/&quot;&gt;Read the Docs&lt;/a&gt; is a free document hosting site where many Python projects host their documentation. It integrates with &lt;a href=&quot;https://realpython.com/python-git-github-intro/&quot;&gt;GitHub&lt;/a&gt;, &lt;a href=&quot;https://about.gitlab.com/&quot;&gt;GitLab&lt;/a&gt;, and &lt;a href=&quot;https://bitbucket.org/&quot;&gt;Bitbucket&lt;/a&gt; to automatically pull new documentation sources from your repositories and build their Sphinx sources.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Write your documentation with &lt;strong&gt;Sphinx&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Structure and style your document with &lt;strong&gt;RST syntax&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Incorporate your &lt;strong&gt;pydoc&lt;/strong&gt; comments into your documentation&lt;/li&gt;
&lt;li&gt;Host your documentation on &lt;strong&gt;Read the Docs&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With these skills, you&amp;rsquo;ll be able to write clear, reliable documentation that&amp;rsquo;ll help your users get the most out of your project.&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 #231: Good Python Programming Practices When New to the Language</title>
      <id>https://realpython.com/podcasts/rpp/231/</id>
      <link href="https://realpython.com/podcasts/rpp/231/"/>
      <updated>2024-12-06T12:00:00+00:00</updated>
      <summary>What advice would you give to someone moving from another language to Python? What good programming practices are inherent to the language? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What advice would you give to someone moving from another language to Python? What good programming practices are inherent to the language? Christopher Trudeau is back on the show this week, bringing 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>Handling or Preventing Errors in Python: LBYL vs EAFP</title>
      <id>https://realpython.com/courses/handling-preventing-errors-lbyl-eafp/</id>
      <link href="https://realpython.com/courses/handling-preventing-errors-lbyl-eafp/"/>
      <updated>2024-12-03T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn about two popular coding styles in Python: Look Before You Leap (LBYL) and Easier to Ask Forgiveness than Permission (EAFP). You can use these styles to deal with errors and exceptional situations in your code. You&#x27;ll dive into the discussion on LBYL vs EAFP in Python.</summary>
      <content type="html">
        &lt;p&gt;Dealing with errors and exceptional situations is a common requirement in programming. You can either &lt;em&gt;prevent errors&lt;/em&gt; before they happen or &lt;em&gt;handle errors&lt;/em&gt; after they&amp;rsquo;ve happened. In general, you&amp;rsquo;ll have two coding styles matching these strategies: &lt;strong&gt;look before you leap&lt;/strong&gt; (LBYL), and &lt;strong&gt;easier to ask forgiveness than permission&lt;/strong&gt; (EAFP). In this video course, you&amp;rsquo;ll dive into the questions and considerations surrounding LBYL vs EAFP in Python.&lt;/p&gt;
&lt;p&gt;By learning about Python&amp;rsquo;s LBYL and EAFP coding styles, you&amp;rsquo;ll be able to decide which strategy and coding style to use when you&amp;rsquo;re dealing with errors in your code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use the &lt;strong&gt;LBYL&lt;/strong&gt; and &lt;strong&gt;EAFP&lt;/strong&gt; styles in your Python code&lt;/li&gt;
&lt;li&gt;Understand the &lt;strong&gt;pros&lt;/strong&gt; and &lt;strong&gt;cons&lt;/strong&gt; of LBYL vs EAFP&lt;/li&gt;
&lt;li&gt;Decide &lt;strong&gt;when to use&lt;/strong&gt; either LBYL or EAFP&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #230: marimo: Reactive Notebooks and Deployable Web Apps in Python</title>
      <id>https://realpython.com/podcasts/rpp/230/</id>
      <link href="https://realpython.com/podcasts/rpp/230/"/>
      <updated>2024-11-29T12:00:00+00:00</updated>
      <summary>What are common issues with using notebooks for Python development? How do you know the current state, share reproducible results, or create interactive applications? This week on the show, we speak with Akshay Agrawal about the open-source reactive marimo notebook for Python.</summary>
      <content type="html">
        &lt;p&gt;What are common issues with using notebooks for Python development? How do you know the current state, share reproducible results, or create interactive applications? This week on the show, we speak with Akshay Agrawal about the open-source reactive marimo notebook for 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>Managing Dependencies With Python Poetry</title>
      <id>https://realpython.com/courses/managing-dependencies-with-poetry/</id>
      <link href="https://realpython.com/courses/managing-dependencies-with-poetry/"/>
      <updated>2024-11-26T14:00:00+00:00</updated>
      <summary>Learn how Python Poetry can help you start new projects, maintain existing ones, and master dependency management.</summary>
      <content type="html">
        &lt;p&gt;When your Python project relies on external packages, you need to make sure you&amp;rsquo;re using the right version of each package. After an update, a package might not work as it did before. A &lt;strong&gt;dependency manager&lt;/strong&gt; like Python Poetry helps you specify, install, and resolve external packages in your projects. This way, you can be sure that you always work with the correct dependency version on every machine.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a &lt;strong&gt;new project&lt;/strong&gt; using Poetry&lt;/li&gt;
&lt;li&gt;Add Poetry to an &lt;strong&gt;existing project&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Configure your project through &lt;strong&gt;&lt;code&gt;pyproject.toml&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Pin your project&amp;rsquo;s &lt;strong&gt;dependency versions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Install dependencies from a &lt;strong&gt;&lt;code&gt;poetry.lock&lt;/code&gt;&lt;/strong&gt; file&lt;/li&gt;
&lt;li&gt;Run basic Poetry commands using the &lt;strong&gt;Poetry CLI&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #229: The Joy of Tinkering &amp; Python Free-Threading Performance</title>
      <id>https://realpython.com/podcasts/rpp/229/</id>
      <link href="https://realpython.com/podcasts/rpp/229/"/>
      <updated>2024-11-22T12:00:00+00:00</updated>
      <summary>What keeps your spark alive for developing software and learning Python? Do you like to try new frameworks, build toy projects, or collaborate with other developers? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What keeps your spark alive for developing software and learning Python? Do you like to try new frameworks, build toy projects, or collaborate with other developers? Christopher Trudeau is back on the show this week, bringing 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: Expression vs Statement in Python: What&#x27;s the Difference?</title>
      <id>https://realpython.com/quizzes/python-expression-vs-statement/</id>
      <link href="https://realpython.com/quizzes/python-expression-vs-statement/"/>
      <updated>2024-11-21T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python expressions vs statements. Knowing the difference between these two is crucial for writing efficient and readable Python code.</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-expression-vs-statement/&quot;&gt;Expression vs Statement in Python: What&amp;rsquo;s the Difference?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit the key differences between expressions and statements in Python, and how to use them effectively in your code.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Interacting With Python</title>
      <id>https://realpython.com/quizzes/interacting-with-python/</id>
      <link href="https://realpython.com/quizzes/interacting-with-python/"/>
      <updated>2024-11-21T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of the different ways of interacting with Python. By working through this quiz, you&#x27;ll revisit key concepts related to Python interaction in interactive mode using the REPL, through Python script files, and within IDEs and code editors.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of the different ways you can &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit key concepts related to Python interaction in interactive mode using the Read-Eval-Print Loop (REPL), through Python script files, and within Integrated Development Environments (IDEs) and code editors.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll also test your knowledge of some other options that may be useful, such as Jupyter Notebooks.&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: NumPy Practical Examples: Useful Techniques</title>
      <id>https://realpython.com/quizzes/numpy-example/</id>
      <link href="https://realpython.com/quizzes/numpy-example/"/>
      <updated>2024-11-20T12:00:00+00:00</updated>
      <summary>This quiz will test your understanding of working with NumPy arrays. You won&#x27;t find all the answers in the tutorial, so you&#x27;ll need to do some extra investigating. By finding all the answers, you&#x27;re sure to learn some interesting things along the way.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of the techniques covered in the tutorial
&lt;a href=&quot;https://realpython.com/numpy-example/&quot;&gt;NumPy Practical Examples: Useful Techniques&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through the questions, you&amp;rsquo;ll review your understanding of NumPy arrays and also expand on what you learned in the tutorial. &lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll need to do some research outside of the tutorial to answer all the questions. Embrace this challenge and let it take you on a learning journey.&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 #228: Maintaining the Foundations of Python &amp; Cautionary Tales</title>
      <id>https://realpython.com/podcasts/rpp/228/</id>
      <link href="https://realpython.com/podcasts/rpp/228/"/>
      <updated>2024-11-15T12:00:00+00:00</updated>
      <summary>How do you build a sustainable open-source project and community? What lessons can be learned from Python&#x27;s history and the current mess that the WordPress community is going through? This week on the show, we speak with Paul Everitt from JetBrains about navigating open-source funding and the start of the Python Software Foundation.</summary>
      <content type="html">
        &lt;p&gt;How do you build a sustainable open-source project and community? What lessons can be learned from Python&#x27;s history and the current mess that the WordPress community is going through? This week on the show, we speak with Paul Everitt from JetBrains about navigating open-source funding and the start of the Python Software Foundation.&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: Namespaces and Scope in Python</title>
      <id>https://realpython.com/quizzes/python-namespaces-scope/</id>
      <link href="https://realpython.com/quizzes/python-namespaces-scope/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python namespaces and variable scope. These concepts are crucial for organizing the symbolic names assigned to objects in a Python program and ensuring they don&#x27;t interfere with one another.</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-namespaces-scope/&quot;&gt;Python Namespaces and Scope&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll revisit how Python organizes symbolic names and objects in namespaces, when Python creates a new namespace, how namespaces are implemented, and how variable scope determines symbolic name visibility.&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 Dictionary Comprehensions: How and When to Use Them</title>
      <id>https://realpython.com/quizzes/python-dictionary-comprehension/</id>
      <link href="https://realpython.com/quizzes/python-dictionary-comprehension/"/>
      <updated>2024-11-13T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python dictionary comprehensions. Dictionary comprehensions are a concise and quick way to create, transform, and filter dictionaries in Python, and can significantly enhance your code&#x27;s conciseness and readability.</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-dictionary-comprehension/&quot;&gt;Python Dictionary Comprehensions: How and When to Use Them&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Understanding dictionary comprehensions is crucial for you as a Python developer because they provide a Pythonic tool for dictionary manipulation and can be a valuable addition to your programming toolkit.&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: Basic Input and Output in Python</title>
      <id>https://realpython.com/quizzes/python-input-output/</id>
      <link href="https://realpython.com/quizzes/python-input-output/"/>
      <updated>2024-11-13T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python&#x27;s built-in functions for user interaction, namely input() and print(). These functions allow you to capture user input from the keyboard and display output to the console, respectively.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of how to use Python&amp;rsquo;s built-in functions &lt;code&gt;input()&lt;/code&gt; and &lt;code&gt;print()&lt;/code&gt; for &lt;a href=&quot;https://realpython.com/python-input-output/&quot;&gt;basic input and output&lt;/a&gt; operations.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll also revisit how to use &lt;code&gt;readline&lt;/code&gt; to improve the user experience when collecting input, and how to format output using the &lt;code&gt;sep&lt;/code&gt; and &lt;code&gt;end&lt;/code&gt; keyword arguments of &lt;code&gt;print()&lt;/code&gt;.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Variables in Python: Usage and Best Practices</title>
      <id>https://realpython.com/quizzes/python-variables/</id>
      <link href="https://realpython.com/quizzes/python-variables/"/>
      <updated>2024-11-05T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of variables in Python. Variables are symbolic names that refer to objects or values stored in your computer&#x27;s memory, and they&#x27;re essential building blocks for any Python program.</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-variables/&quot;&gt;Variables in Python: Usage and Best Practices&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to create and assign values to variables, change a variable&amp;rsquo;s data type dynamically, use variables to create expressions, counters, accumulators, and Boolean flags, follow best practices for naming variables, and create, access, and use variables in their scopes.&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 .__repr__() vs .__str__() in Python</title>
      <id>https://realpython.com/quizzes/python-repr-vs-str/</id>
      <link href="https://realpython.com/quizzes/python-repr-vs-str/"/>
      <updated>2024-10-29T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python&#x27;s dunder repr and dunder str special methods. These methods allow you to control how a program displays an object, making your classes more readable and easier to debug and maintain.</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-repr-vs-str/&quot;&gt;Python&amp;rsquo;s &lt;code&gt;.__repr__()&lt;/code&gt; and &lt;code&gt;.__str__()&lt;/code&gt;&lt;/a&gt; special methods. These methods allow you to control how a program displays an object, making your classes more readable and easier to debug and maintain.&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>
