<?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>2024-09-06T12:00:00+00:00</updated>
  <id>https://realpython.com/</id>
  <author>
    <name>Real Python</name>
  </author>

  
    <entry>
      <title>The Real Python Podcast – Episode #219: Astrophysics and Astronomy With Python &amp; PyCon Africa 2024</title>
      <id>https://realpython.com/podcasts/rpp/219/</id>
      <link href="https://realpython.com/podcasts/rpp/219/"/>
      <updated>2024-09-06T12:00:00+00:00</updated>
      <summary>Are you interested in practicing your Python skills while learning how to solve astrophysics and astronomy problems? 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;Are you interested in practicing your Python skills while learning how to solve astrophysics and astronomy problems? 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>Lists vs Tuples in Python</title>
      <id>https://realpython.com/python-lists-tuples/</id>
      <link href="https://realpython.com/python-lists-tuples/"/>
      <updated>2024-09-04T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn the key characteristics of lists and tuples in Python, as well as how to define and manipulate them. When you&#x27;re finished, you&#x27;ll have a good feel for when and how to use these data types in a Python program.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In Python, &lt;strong&gt;lists&lt;/strong&gt; and &lt;strong&gt;tuples&lt;/strong&gt; are versatile and useful &lt;a href=&quot;https://realpython.com/python-data-types/&quot;&gt;data types&lt;/a&gt; that allow you to store data in a sequence. You’ll find them in virtually every nontrivial Python program. Learning about them is a core skill for you as a Python developer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Get to know &lt;strong&gt;lists&lt;/strong&gt; and &lt;strong&gt;tuples&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Explore the &lt;strong&gt;core characteristics&lt;/strong&gt; of lists and tuples&lt;/li&gt;
&lt;li&gt;Learn how to &lt;strong&gt;define&lt;/strong&gt; and &lt;strong&gt;manipulate&lt;/strong&gt; lists and tuples&lt;/li&gt;
&lt;li&gt;Decide &lt;strong&gt;when to use&lt;/strong&gt; lists or tuples in your code&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should know the basics of Python programming, including how to define variables.&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-lists-tuples-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-lists-tuples-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 work with lists and tuples 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.1440a154cfa8.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 “Lists vs Tuples in Python” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

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

      &lt;a href=&quot;/quizzes/python-lists-tuples/&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;Lists vs Tuples in Python&quot; src=&quot;https://files.realpython.com/media/Lists-and-Tuples-in-Python_Watermarked.a52798070b3e.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Lists-and-Tuples-in-Python_Watermarked.a52798070b3e.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Lists-and-Tuples-in-Python_Watermarked.a52798070b3e.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Lists-and-Tuples-in-Python_Watermarked.a52798070b3e.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Lists-and-Tuples-in-Python_Watermarked.a52798070b3e.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.1440a154cfa8.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-lists-tuples/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Lists vs Tuples in Python&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Challenge yourself with this quiz to evaluate and deepen your understanding of Python lists and tuples. You&#x27;ll explore key concepts, such as how to create, access, and manipulate these data types, while also learning best practices for using them efficiently in your code.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-python-lists-and-tuples&quot;&gt;Getting Started With Python Lists and Tuples&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-python-lists-and-tuples&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Python, a list is a collection of arbitrary objects, somewhat akin to an &lt;a href=&quot;https://en.wikipedia.org/wiki/Array_(data_structure)&quot;&gt;array&lt;/a&gt; in many other programming languages but more flexible. To define a list, you typically enclose a comma-separated sequence of objects in square brackets (&lt;code&gt;[]&lt;/code&gt;), as 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;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.1440a154cfa8.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;n&quot;&gt;colors&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[&#x27;red&#x27;, &#x27;green&#x27;, &#x27;blue&#x27;, &#x27;yellow&#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.1440a154cfa8.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.1440a154cfa8.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 code snippet, you define a list of colors using &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt; objects separated by commas and enclose them in square brackets.&lt;/p&gt;
&lt;p&gt;Similarly, tuples are also collections of arbitrary objects. To define a tuple, you’ll enclose a comma-separated sequence of objects in parentheses (&lt;code&gt;()&lt;/code&gt;), as 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;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.1440a154cfa8.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;person&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;Jane Doe&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;25&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Python Developer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Canada&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;person&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(&#x27;Jane Doe&#x27;, 25, &#x27;Python Developer&#x27;, &#x27;Canada&#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.1440a154cfa8.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.1440a154cfa8.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 define a tuple with data for a given person, including their name, age, job, and base country.&lt;/p&gt;
&lt;p&gt;Up to this point, it may seem that lists and tuples are mostly the same. However, there’s an important difference:&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;Feature&lt;/th&gt;
&lt;th class=&quot;text-center&quot;&gt;List&lt;/th&gt;
&lt;th class=&quot;text-center&quot;&gt;Tuple&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Is an ordered sequence&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can contain arbitrary objects&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can be indexed and sliced&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Can be nested&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Is mutable&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;✅&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Both lists and tuples are &lt;a href=&quot;https://realpython.com/python-sequences/&quot;&gt;sequence&lt;/a&gt; data types, which means they can contain objects arranged in order. You can access those objects using an integer index that represents their position in the sequence.&lt;/p&gt;
&lt;p&gt;Even though both data types can contain arbitrary and heterogeneous objects, you’ll commonly use lists to store homogeneous objects and tuples to store heterogeneous objects.&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 see the terms homogeneous and heterogeneous used to express the following ideas:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Homogeneous&lt;/strong&gt;: Objects of the same data type or the same semantic meaning, like a series of animals, fruits, colors, and so on.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Heterogeneous&lt;/strong&gt;: Objects of different data types or different semantic meanings, like the attributes of a car: model, color, make, year, fuel type, and so on.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;You can perform indexing and slicing operations on both lists and tuples. You can also have nested lists and nested tuples or a combination of them, like a list of tuples.&lt;/p&gt;
&lt;p&gt;The most notable difference between lists and tuples is that lists are mutable, while tuples are immutable. This feature distinguishes them and drives their specific use cases.&lt;/p&gt;
&lt;p&gt;Essentially, a list doesn’t have a fixed length since it’s mutable. Therefore, it’s natural to use homogeneous elements to have some structure in the list. A tuple, on the other hand, has a fixed length so the position of elements can have meaning, supporting heterogeneous data.&lt;/p&gt;
&lt;h3 id=&quot;creating-lists-in-python&quot;&gt;Creating Lists in Python&lt;a class=&quot;headerlink&quot; href=&quot;#creating-lists-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In many situations, you’ll define a &lt;code&gt;list&lt;/code&gt; object using a &lt;a href=&quot;https://docs.python.org/3/reference/lexical_analysis.html#literals&quot;&gt;literal&lt;/a&gt;. A list literal is a comma-separated sequence of objects enclosed in square brackets:&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.1440a154cfa8.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;countries&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;United States&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Canada&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Poland&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Germany&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Austria&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;countries&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[&#x27;United States&#x27;, &#x27;Canada&#x27;, &#x27;Poland&#x27;, &#x27;Germany&#x27;, &#x27;Austria&#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.1440a154cfa8.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.1440a154cfa8.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 create a list of countries represented by string objects. Because lists are ordered sequences, the values retain the insertion order.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-lists-tuples/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-lists-tuples/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Lists vs Tuples in Python</title>
      <id>https://realpython.com/quizzes/python-lists-tuples/</id>
      <link href="https://realpython.com/quizzes/python-lists-tuples/"/>
      <updated>2024-09-04T12:00:00+00:00</updated>
      <summary>Challenge yourself with this quiz to evaluate and deepen your understanding of Python lists and tuples. You&#x27;ll explore key concepts, such as how to create, access, and manipulate these data types, while also learning best practices for using them efficiently in your code.</summary>
      <content type="html">
        &lt;p&gt;Challenge yourself with this quiz to evaluate and deepen your understanding of Python lists and tuples. You&amp;rsquo;ll explore key concepts, such as how to create and manipulate these data types, while also learning best practices for using them efficiently in your code.&lt;/p&gt;
&lt;p&gt;You can take this quiz after reading the &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;Lists vs Tuples in Python&lt;/a&gt; tutorial.&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>Using Pydantic to Simplify Python Data Validation</title>
      <id>https://realpython.com/courses/pydantic-simplify-data-validation/</id>
      <link href="https://realpython.com/courses/pydantic-simplify-data-validation/"/>
      <updated>2024-09-03T14:00:00+00:00</updated>
      <summary>Discover the power of Pydantic, Python&#x27;s most popular data parsing, validation, and serialization library. In this hands-on video course, you&#x27;ll learn how to make your code more robust, trustworthy, and easier to debug with Pydantic.</summary>
      <content type="html">
        &lt;p&gt;Pydantic is a powerful data validation and settings management library for Python, engineered to enhance the robustness and reliability of your codebase. From basic tasks, such as checking whether a variable is an integer, to more complex tasks, like ensuring highly-nested dictionary keys and values have the correct data types, Pydantic can handle just about any data validation scenario with minimal boilerplate 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;Work with &lt;strong&gt;data schemas&lt;/strong&gt; with Pydantic&amp;rsquo;s &lt;code&gt;BaseModel&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Write &lt;strong&gt;custom validators&lt;/strong&gt; for complex use cases&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Validate function arguments&lt;/strong&gt; with Pydantic&amp;rsquo;s &lt;code&gt;@validate_call&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Manage settings and &lt;strong&gt;configure applications&lt;/strong&gt; with &lt;code&gt;pydantic-settings&lt;/code&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>Generate Images With DALL·E and the OpenAI API</title>
      <id>https://realpython.com/generate-images-with-dalle-openai-api/</id>
      <link href="https://realpython.com/generate-images-with-dalle-openai-api/"/>
      <updated>2024-09-02T14:00:00+00:00</updated>
      <summary>Learn to use the OpenAI Python library to create images with DALL·E, a state-of-the-art latent diffusion model. In this tutorial, you&#x27;ll explore creating images and generating image variations. You&#x27;ll also interact with DALL·E using API calls and incorporate this functionality into your Python scripts.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Describe any image, then let a computer create it for you. What sounded futuristic only a few years ago has become reality with advances in &lt;a href=&quot;https://realpython.com/python-ai-neural-network/&quot;&gt;neural networks&lt;/a&gt; and &lt;strong&gt;latent diffusion models&lt;/strong&gt; (LDM). &lt;strong&gt;DALL·E by OpenAI&lt;/strong&gt; has made a splash through the amazing &lt;a href=&quot;https://en.wikipedia.org/wiki/Generative_art&quot;&gt;generative art&lt;/a&gt; and realistic images that people create with it.&lt;/p&gt;
&lt;p&gt;OpenAI allows &lt;a href=&quot;https://openai.com/index/dall-e-3/&quot;&gt;access to DALL·E&lt;/a&gt; through their &lt;strong&gt;API&lt;/strong&gt;, which means that you can incorporate its functionality into your &lt;strong&gt;Python applications&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Get started using the &lt;strong&gt;OpenAI Python library&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Explore API calls related to &lt;strong&gt;image generation&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create images from &lt;strong&gt;text prompts&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;variations&lt;/strong&gt; of your generated image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Convert Base64&lt;/strong&gt; JSON responses to &lt;strong&gt;PNG image&lt;/strong&gt; files&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll need some experience with Python, JSON, and file operations to breeze through this tutorial. You can also study up on these topics while you go along, as you’ll find relevant links throughout the text.&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/generate-images-with-dalle-openai-api-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-generate-images-with-dalle-openai-api-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that you’ll use to generate stunning images with DALL·E and the OpenAI API.&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.1440a154cfa8.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 “Generate Images With DALL·E and the OpenAI API” 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/generate-images-with-dalle-and-openai-api/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #ff7e74;&quot; alt=&quot;Generate Images With DALL·E 2 and the OpenAI API&quot; src=&quot;https://files.realpython.com/media/Generate-Images-with-DALL-E-2-and-OpenAIs-API_Watermarked.05753350e866.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Generate-Images-with-DALL-E-2-and-OpenAIs-API_Watermarked.05753350e866.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Generate-Images-with-DALL-E-2-and-OpenAIs-API_Watermarked.05753350e866.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Generate-Images-with-DALL-E-2-and-OpenAIs-API_Watermarked.05753350e866.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Generate-Images-with-DALL-E-2-and-OpenAIs-API_Watermarked.05753350e866.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.1440a154cfa8.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/generate-images-with-dalle-and-openai-api/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Generate Images With DALL·E and the OpenAI API&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 generating images with DALL·E by OpenAI using Python. You&#x27;ll revisit concepts such as using the OpenAI Python library, making API calls for image generation, creating images from text prompts, and converting Base64 strings to PNG image files.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;complete-the-setup-requirements&quot;&gt;Complete the Setup Requirements&lt;a class=&quot;headerlink&quot; href=&quot;#complete-the-setup-requirements&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you’ve seen what DALL·E can do and you’re eager to make its functionality part of your Python applications, then you’re in the right spot! In this first section, you’ll quickly walk through what you need to do to get started using DALL·E’s image creation capabilities in your own code.&lt;/p&gt;
&lt;h3 id=&quot;install-the-openai-python-library&quot;&gt;Install the OpenAI Python Library&lt;a class=&quot;headerlink&quot; href=&quot;#install-the-openai-python-library&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Confirm that you’re &lt;a href=&quot;https://realpython.com/intro-to-pyenv/#specifying-your-python-version&quot;&gt;running Python version&lt;/a&gt; 3.7.1 or higher, create and activate a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;, and install the &lt;a href=&quot;https://github.com/openai/openai-python&quot;&gt;OpenAI Python library&lt;/a&gt;:&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.1440a154cfa8.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.1440a154cfa8.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.1440a154cfa8.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.1440a154cfa8.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;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;-version&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Python 3.12.5&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;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;openai&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.1440a154cfa8.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.1440a154cfa8.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.1440a154cfa8.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;--version
&lt;span class=&quot;go&quot;&gt;Python 3.12.5&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;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;openai
&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.1440a154cfa8.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.1440a154cfa8.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;The &lt;code&gt;openai&lt;/code&gt; package gives you access to the full &lt;a href=&quot;https://platform.openai.com/docs/api-reference/introduction&quot;&gt;OpenAI API&lt;/a&gt;. In this tutorial, you’ll focus on &lt;a href=&quot;https://platform.openai.com/docs/guides/images/introduction&quot;&gt;image generation&lt;/a&gt;, which lets you interact with DALL·E models to create and edit images from text prompts.&lt;/p&gt;
&lt;h3 id=&quot;get-your-openai-api-key&quot;&gt;Get Your OpenAI API Key&lt;a class=&quot;headerlink&quot; href=&quot;#get-your-openai-api-key&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You need an API key to make successful API calls. Sign up with OpenAI and create a new project API key by clicking on the &lt;em&gt;Dashboard&lt;/em&gt; menu and then &lt;a href=&quot;https://platform.openai.com/api-keys&quot;&gt;&lt;em&gt;API keys&lt;/em&gt;&lt;/a&gt; on the bottom left of the navigation menu:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/dalle-openai-api-key.89c5aeee4642.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/dalle-openai-api-key.89c5aeee4642.png&quot; width=&quot;2880&quot; height=&quot;1800&quot; srcset=&quot;/cdn-cgi/image/width=720,format=auto/https://files.realpython.com/media/dalle-openai-api-key.89c5aeee4642.png 720w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/dalle-openai-api-key.89c5aeee4642.png 960w, /cdn-cgi/image/width=1440,format=auto/https://files.realpython.com/media/dalle-openai-api-key.89c5aeee4642.png 1440w, /cdn-cgi/image/width=2880,format=auto/https://files.realpython.com/media/dalle-openai-api-key.89c5aeee4642.png 2880w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;The OpenAI API key page where you can create and manage API project keys&quot; data-asset=&quot;5911&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;On this page, you can create and manage your API keys, which allow you to access the service that OpenAI offers through their API. You can create and delete secret keys.&lt;/p&gt;
&lt;p&gt;Click on &lt;em&gt;Create new secret key&lt;/em&gt; to create a new API key, and copy the value shown in the pop-up window.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; OpenAI assigns your API usage through unique key values, so make sure to keep your API key private. The company calculates the &lt;a href=&quot;https://openai.com/api/pricing/&quot;&gt;pricing&lt;/a&gt; of requests to generate images on a per-image basis that depends on the model you use and the resolution of the output image.&lt;/p&gt;
&lt;p&gt;Keep in mind that OpenAI’s API services and pricing policies may change. Be sure to check their &lt;a href=&quot;https://openai.com/api/&quot;&gt;website&lt;/a&gt; for up-to-date information about pricing and offers.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Always keep this key secret! Copy the value of this key so you can later use it in your project. You’ll only see the key value once.&lt;/p&gt;
&lt;h3 id=&quot;save-your-api-key-as-an-environment-variable&quot;&gt;Save Your API Key as an Environment Variable&lt;a class=&quot;headerlink&quot; href=&quot;#save-your-api-key-as-an-environment-variable&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A quick way to save your API key and make it available to your Python scripts is to save it as an &lt;strong&gt;environment variable&lt;/strong&gt;. Select your operating system 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-2&quot; data-toggle=&quot;tab&quot; href=&quot;#windows-2&quot; role=&quot;tab&quot; aria-controls=&quot;windows-2&quot; aria-selected=&quot;true&quot;&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.1440a154cfa8.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Windows&lt;/a&gt;
  &lt;/li&gt;




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

&lt;/ul&gt;
&lt;div class=&quot;tab-content mt-2 mb-0 js-platform-widget-content&quot;&gt;
&lt;div aria-labelledby=&quot;windows-tab-2&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-2&quot; role=&quot;tabpanel&quot;&gt;
&lt;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.1440a154cfa8.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;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ENV:OPENAI_API_KEY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;your-key-value-here&amp;gt;&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&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.1440a154cfa8.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.1440a154cfa8.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-2&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-2&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.1440a154cfa8.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;&lt;span class=&quot;nb&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;your-key-value-here&amp;gt;&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&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.1440a154cfa8.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.1440a154cfa8.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/generate-images-with-dalle-openai-api/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/generate-images-with-dalle-openai-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>Quiz: Generate Images With DALL·E and the OpenAI API</title>
      <id>https://realpython.com/quizzes/generate-images-with-dalle-and-openai-api/</id>
      <link href="https://realpython.com/quizzes/generate-images-with-dalle-and-openai-api/"/>
      <updated>2024-09-02T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of generating images with DALL·E by OpenAI using Python. You&#x27;ll revisit concepts such as using the OpenAI Python library, making API calls for image generation, creating images from text prompts, and converting Base64 strings to PNG image files.</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/generate-images-with-dalle-openai-api/&quot;&gt;generating images with DALL·E by OpenAI API using Python&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to use the OpenAI Python library, make API calls related to image generation, create images from text prompts, create variations of an image, and convert Base64 strings to PNG image files.&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 Use Conditional Expressions With NumPy where()</title>
      <id>https://realpython.com/quizzes/numpy-where-conditional-expressions/</id>
      <link href="https://realpython.com/quizzes/numpy-where-conditional-expressions/"/>
      <updated>2024-09-02T12:00:00+00:00</updated>
      <summary>This quiz aims to test your understanding of the np.where() function. You won&#x27;t find all the answers in the tutorial, so you&#x27;ll need to do additional research. It&#x27;s recommended that you make sure you can do all the exercises in the tutorial before tackling this quiz. Enjoy!</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/numpy-where-conditional-expressions/&quot;&gt;How to Use Conditional Expressions With NumPy &lt;code&gt;where()&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through the questions, you&amp;rsquo;ll consolidate the knowledge you gained from the tutorial and take yourself beyond what you learned. &lt;/p&gt;
&lt;p&gt;To answer some of the questions, you&amp;rsquo;ll need to do some research outside of the tutorial itself. Embrace this challenge because exploration can take you on a valuable 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>Web Scraping With Scrapy and MongoDB</title>
      <id>https://realpython.com/web-scraping-with-scrapy-and-mongodb/</id>
      <link href="https://realpython.com/web-scraping-with-scrapy-and-mongodb/"/>
      <updated>2024-08-28T14:00:00+00:00</updated>
      <summary>This tutorial covers how to write a Python web crawler using Scrapy to scrape and parse data, and then store the data in MongoDB.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Scrapy&lt;/strong&gt; is a robust Python web scraping framework that can manage requests asynchronously, follow links, and parse site content. To store scraped data, you can use &lt;strong&gt;MongoDB&lt;/strong&gt;, a scalable NoSQL database, that stores data in a JSON-like format. Combining Scrapy with MongoDB offers a powerful solution for web scraping projects, leveraging Scrapy’s efficiency and MongoDB’s flexible data storage.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up and configure a &lt;strong&gt;Scrapy project&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Build a &lt;strong&gt;functional web scraper&lt;/strong&gt; with Scrapy&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Extract data&lt;/strong&gt; from websites using &lt;strong&gt;selectors&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Store&lt;/strong&gt; scraped data in a &lt;strong&gt;MongoDB&lt;/strong&gt; database&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Test&lt;/strong&gt; and &lt;strong&gt;debug&lt;/strong&gt; your Scrapy web scraper&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you’re new to web scraping and you’re looking for flexible and scalable tooling, then this is the right tutorial for you. You’ll also benefit from learning this tool kit if you’ve scraped sites before, but the complexity of your project has outgrown using &lt;a href=&quot;https://realpython.com/beautiful-soup-web-scraper-python/&quot;&gt;Beautiful Soup&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-requests/&quot;&gt;Requests&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To get the most out of this tutorial, you should have basic Python programming knowledge, understand &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;, comfortably work with &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;third-party packages&lt;/a&gt;, and be familiar with &lt;a href=&quot;https://realpython.com/html-css-python/&quot;&gt;HTML and CSS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By the end, you’ll know how to get, parse, and store static data from the Internet, and you’ll be familiar with several useful tools that allow you to go much deeper.&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/web-scraping-with-scrapy-and-mongodb-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-web-scraping-with-scrapy-and-mongodb-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free code&lt;/a&gt; that shows you how to gather Web data with Scrapy and MongoDB.&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.1440a154cfa8.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 “Web Scraping With Scrapy and MongoDB” 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/web-scraping-with-scrapy-and-mongodb/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #e5c6aa;&quot; alt=&quot;Web Scraping With Scrapy and MongoDB&quot; src=&quot;https://files.realpython.com/media/Web-Scraping-with-Scrapy-and-MongoDB-Part-1_Watermarked.f246d4df4b36.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Web-Scraping-with-Scrapy-and-MongoDB-Part-1_Watermarked.f246d4df4b36.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Web-Scraping-with-Scrapy-and-MongoDB-Part-1_Watermarked.f246d4df4b36.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Web-Scraping-with-Scrapy-and-MongoDB-Part-1_Watermarked.f246d4df4b36.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Web-Scraping-with-Scrapy-and-MongoDB-Part-1_Watermarked.f246d4df4b36.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.1440a154cfa8.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/web-scraping-with-scrapy-and-mongodb/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Web Scraping With Scrapy and MongoDB&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 web scraping with Scrapy and MongoDB. You&#x27;ll revisit how to set up a Scrapy project, build a functional web scraper, extract data from websites, store scraped data in MongoDB, and test and debug your Scrapy web scraper.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;prepare-the-scraper-scaffolding&quot;&gt;Prepare the Scraper Scaffolding&lt;a class=&quot;headerlink&quot; href=&quot;#prepare-the-scraper-scaffolding&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’ll start by setting up the necessary tools and creating a basic project structure that will serve as the backbone for your scraping tasks.&lt;/p&gt;
&lt;p&gt;While working through the tutorial, you’ll build a complete web scraping project, approaching it as an &lt;a href=&quot;https://en.wikipedia.org/wiki/Extract,_transform,_load&quot;&gt;ETL (Extract, Transform, Load)&lt;/a&gt; process:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Extract&lt;/strong&gt; data from the website using a Scrapy spider as your &lt;a href=&quot;https://en.wikipedia.org/wiki/Web_crawler&quot;&gt;web crawler&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Transform&lt;/strong&gt; this data, for example by cleaning or validating it, using an item pipeline.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Load&lt;/strong&gt; the transformed data into a storage system like MongoDB with an item pipeline.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Scrapy provides scaffolding for all of these processes, and you’ll tap into that scaffolding to learn web scraping following the robust structure that Scrapy provides and that numerous enterprise-scale web scraping projects rely on.&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 a Scrapy web scraping project, a &lt;strong&gt;spider&lt;/strong&gt; is a Python class that defines how to crawl a specific website or a group of websites. It contains the logic for making requests, parsing responses, and extracting the desired data.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;First, you’ll install Scrapy and create a new Scrapy project, then explore the auto-generated project structure to ensure that you’re well-equipped to proceed with building a performant web scraper.&lt;/p&gt;
&lt;h3 id=&quot;install-the-scrapy-package&quot;&gt;Install the Scrapy Package&lt;a class=&quot;headerlink&quot; href=&quot;#install-the-scrapy-package&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To get started with Scrapy, you first need to install it using &lt;code&gt;pip&lt;/code&gt;. Create and activate a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt; to keep the installation separate from your global Python installation. Then, you can install Scrapy:&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.1440a154cfa8.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;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;scrapy
&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.1440a154cfa8.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.1440a154cfa8.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;After the installation is complete, you can verify it by running the &lt;code&gt;scrapy&lt;/code&gt; command and viewing the output:&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.1440a154cfa8.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;scrapy
&lt;span class=&quot;go&quot;&gt;Scrapy 2.11.2 - no active project&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;Usage:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  scrapy &amp;lt;command&amp;gt; [options] [args]&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;Available commands:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  bench         Run quick benchmark test&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  fetch         Fetch a URL using the Scrapy downloader&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  genspider     Generate new spider using pre-defined templates&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  runspider     Run a self-contained spider (without creating a project)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  settings      Get settings values&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  shell         Interactive scraping console&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;go&quot;&gt;  startproject  Create new project&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;  version       Print Scrapy version&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  view          Open URL in browser, as seen by Scrapy&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;  [ more ]      More commands available when run from project directory&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;Use &quot;scrapy &amp;lt;command&amp;gt; -h&quot; to see more info about a command&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.1440a154cfa8.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.1440a154cfa8.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 &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/&quot;&gt;command-line (CLI)&lt;/a&gt; program should display the help text of Scrapy. This confirms that you installed the package correctly. You’ll next run the highlighted &lt;code&gt;startproject&lt;/code&gt; command to create a project.&lt;/p&gt;
&lt;h3 id=&quot;create-a-scrapy-project&quot;&gt;Create a Scrapy Project&lt;a class=&quot;headerlink&quot; href=&quot;#create-a-scrapy-project&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Scrapy is built around &lt;strong&gt;projects&lt;/strong&gt;. Generally, you’ll create a new project for each web scraping project that you’re working on. In this tutorial, you’ll work on scraping a website called &lt;a href=&quot;https://books.toscrape.com/&quot;&gt;Books to Scrape&lt;/a&gt;, so you can call your project &lt;em&gt;books&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;As you may have already identified in the help text, the framework provides a command to create a new project:&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.1440a154cfa8.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;scrapy&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;startproject&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;books
&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.1440a154cfa8.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.1440a154cfa8.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/web-scraping-with-scrapy-and-mongodb/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/web-scraping-with-scrapy-and-mongodb/ »&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>Using Astropy for Astronomy With Python</title>
      <id>https://realpython.com/courses/astropy-astronomy/</id>
      <link href="https://realpython.com/courses/astropy-astronomy/"/>
      <updated>2024-08-27T14:00:00+00:00</updated>
      <summary>This course covers two problems from introductory astronomy to help you play with some Python libraries. You&#x27;ll use NumPy, Matplotlib, and pandas to find planet conjunctions, and graph the best viewing times for a star.</summary>
      <content type="html">
        &lt;p&gt;This course covers two problems from introductory astronomy to help you play with some Python libraries. You&amp;rsquo;ll use Astropy, NumPy, Matplotlib, and pandas to find planet conjunctions, and graph the best viewing times for a star.&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;Astronomy concepts of conjunction and optimal viewing&lt;/li&gt;
&lt;li&gt;The Python package Astropy &lt;/li&gt;
&lt;li&gt;Using pandas to process data&lt;/li&gt;
&lt;li&gt;Building graphs with Matplotlib&lt;/li&gt;
&lt;li&gt;Python&amp;rsquo;s warning module&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>How to Install Python on Your System: A Guide</title>
      <id>https://realpython.com/installing-python/</id>
      <link href="https://realpython.com/installing-python/"/>
      <updated>2024-08-26T14:00:00+00:00</updated>
      <summary>The first step to getting started with Python is to install it on your machine. In this tutorial, you&#x27;ll learn how to check which version of Python, if any, you have on your Windows, Mac, or Linux computer and the best way to install the most recent version in any environment.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Installing the latest version of Python on your computer could be a common requirement for you as a Python programmer. Fortunately, you’ll have a multitude of installation options. For example, you can download the &lt;strong&gt;official Python installer&lt;/strong&gt; from &lt;a href=&quot;https://python.org&quot;&gt;Python.org&lt;/a&gt;, use your operating system’s package manager or app store, and more.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll focus on official &lt;a href=&quot;https://realpython.com/cpython-source-code-guide/&quot;&gt;CPython&lt;/a&gt; distributions, which are generally the best option for learning to program with the language. However, you’ll also learn about a few other distributions, like the one available on Homebrew for macOS users.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Check whether a &lt;strong&gt;version&lt;/strong&gt; of Python is installed on your system&lt;/li&gt;
&lt;li&gt;Install or update to the latest Python on &lt;strong&gt;Windows&lt;/strong&gt;, &lt;strong&gt;macOS&lt;/strong&gt;, and &lt;strong&gt;Linux&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Install Python on &lt;strong&gt;mobile devices&lt;/strong&gt; like phones or tablets&lt;/li&gt;
&lt;li&gt;Use Python on your browser with &lt;strong&gt;online interpreters&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This tutorial covers installing the latest Python on the most important platforms or operating systems, such as Windows, macOS, Linux, iOS, and Android. However, it doesn’t cover all the existing Linux distributions, which would be a huge task. Anyway, you’ll find instructions for the most popular distros nowadays.&lt;/p&gt;
&lt;p&gt;To get the most out of this tutorial, you should be comfortable using your operating system’s &lt;a href=&quot;https://realpython.com/terminal-commands/&quot;&gt;terminal&lt;/a&gt; or command line.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-shortened&quot; data-focus=&quot;false&quot;&gt;Click here to get a Python Cheat Sheet&lt;/a&gt; and learn the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.&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.1440a154cfa8.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Python Installation and Setup” 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-installation-and-setup/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #b9abe6;&quot; alt=&quot;Python 3 Installation &amp;amp; Setup Guide&quot; src=&quot;https://files.realpython.com/media/Python-3-Installation--Setup-Guide_Watermarked.62f654dcab67.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Python-3-Installation--Setup-Guide_Watermarked.62f654dcab67.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Python-3-Installation--Setup-Guide_Watermarked.62f654dcab67.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Python-3-Installation--Setup-Guide_Watermarked.62f654dcab67.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Python-3-Installation--Setup-Guide_Watermarked.62f654dcab67.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.1440a154cfa8.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-installation-and-setup/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python Installation and Setup&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 how to install or update Python on your computer. With this knowledge, you&#x27;ll be able to set up Python on various operating systems, including Windows, macOS, and Linux.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;windows-how-to-check-or-get-python&quot;&gt;Windows: How to Check or Get Python&lt;a class=&quot;headerlink&quot; href=&quot;#windows-how-to-check-or-get-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this section, you’ll learn to check whether Python is installed on your Windows operating system (OS) and which version you have. You’ll also explore three installation options that you can use on Windows.&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 installing the latest version of Python in your current operating system (OS) rather than on installing multiple versions of Python. If you want to install several versions of Python in your OS, then check out the &lt;a href=&quot;https://realpython.com/intro-to-pyenv/&quot;&gt;Managing Multiple Python Versions With &lt;code&gt;pyenv&lt;/code&gt;&lt;/a&gt; tutorial. Note that on Windows machines, you’d have to use &lt;a href=&quot;https://github.com/pyenv-win/pyenv-win&quot;&gt;&lt;code&gt;pyenv-win&lt;/code&gt;&lt;/a&gt; instead of &lt;code&gt;pyenv&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;For a more comprehensive guide on setting up a Windows machine for Python programming, check out &lt;a href=&quot;https://realpython.com/python-coding-setup-windows/&quot;&gt;Your Python Coding Environment on Windows: Setup Guide&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;checking-the-python-version-on-windows&quot;&gt;Checking the Python Version on Windows&lt;a class=&quot;headerlink&quot; href=&quot;#checking-the-python-version-on-windows&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To check whether you already have Python on your Windows machine, open a command-line application like &lt;a href=&quot;https://realpython.com/python-coding-setup-windows/#installing-powershell-core&quot;&gt;PowerShell&lt;/a&gt; or the &lt;a href=&quot;https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab&quot;&gt;Windows Terminal&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Follow the steps below to open PowerShell on Windows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Press the &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-windows&quot;&gt;Win&lt;/kbd&gt;&lt;/span&gt; key.&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;PowerShell&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Press &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-enter&quot;&gt;Enter&lt;/kbd&gt;&lt;/span&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Alternatively, you can right-click the &lt;em&gt;Start&lt;/em&gt; button and select &lt;em&gt;Windows PowerShell&lt;/em&gt; or &lt;em&gt;Windows PowerShell (Admin)&lt;/em&gt;. In some versions of Windows, you’ll find &lt;em&gt;Terminal&lt;/em&gt; or &lt;em&gt;Terminal (admin)&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; To learn more about your options for the Windows terminal, check out &lt;a href=&quot;https://realpython.com/courses/using-terminal-windows/&quot;&gt;Using the Terminal on Windows&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;With the command line open, type in the following command and press the &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-enter&quot;&gt;Enter&lt;/kbd&gt;&lt;/span&gt; key:&lt;/p&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.1440a154cfa8.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;p&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;-version&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Python 3.x.z&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.1440a154cfa8.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.1440a154cfa8.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 the &lt;code&gt;--version&lt;/code&gt; switch will show you the installed version. Note that the &lt;code&gt;3.x.z&lt;/code&gt; part is a placeholder here. In your machine, &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;z&lt;/code&gt; will be numbers corresponding to the specific version you have installed.&lt;/p&gt;
&lt;p&gt;Alternatively, you can use the &lt;code&gt;-V&lt;/code&gt; switch:&lt;/p&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.1440a154cfa8.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;-V&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Python 3.x.z&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.1440a154cfa8.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.1440a154cfa8.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 the &lt;code&gt;python -V&lt;/code&gt; or &lt;code&gt;python—-version&lt;/code&gt; command, you can check whether Python is installed on your system and learn what version you have. If Python isn’t installed on your OS, you’ll get an error message.&lt;/p&gt;
&lt;h3 id=&quot;knowing-the-python-installation-options-on-windows&quot;&gt;Knowing the Python Installation Options on Windows&lt;a class=&quot;headerlink&quot; href=&quot;#knowing-the-python-installation-options-on-windows&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/installing-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/installing-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>The Real Python Podcast – Episode #218: Exploring Robotics and Python Through Electronic Projects</title>
      <id>https://realpython.com/podcasts/rpp/218/</id>
      <link href="https://realpython.com/podcasts/rpp/218/"/>
      <updated>2024-08-23T12:00:00+00:00</updated>
      <summary>Are you interested in learning robotics with Python? Can physical electronics-based projects grow a child&#x27;s interest in coding? This week on the show, we speak with author Marwan Alsabbagh about his book &quot;Build Your Own Robot - Using Python, CRICKIT, and Raspberry Pi.&quot;</summary>
      <content type="html">
        &lt;p&gt;Are you interested in learning robotics with Python? Can physical electronics-based projects grow a child&#x27;s interest in coding? This week on the show, we speak with author Marwan Alsabbagh about his book &quot;Build Your Own Robot - Using Python, CRICKIT, and Raspberry Pi.&quot;&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>Primer on Jinja Templating</title>
      <id>https://realpython.com/primer-on-jinja-templating/</id>
      <link href="https://realpython.com/primer-on-jinja-templating/"/>
      <updated>2024-08-21T14:00:00+00:00</updated>
      <summary>With Jinja, you can build rich templates that power the front end of your web applications. But you can use Jinja without a web framework running in the background. Anytime you want to create text files with programmatic content, Jinja can help you out.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Templates are an essential ingredient in full-stack web development.
With &lt;strong&gt;Jinja&lt;/strong&gt;, you can build rich templates that power the front end of your Python web applications.&lt;/p&gt;
&lt;p&gt;But you don’t need to use a web framework to experience the capabilities of Jinja.
When you want to create text files with programmatic content, Jinja can help you out.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install the Jinja &lt;strong&gt;template engine&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create your first Jinja &lt;strong&gt;template&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Render a Jinja template in &lt;strong&gt;Flask&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/strong&gt; and &lt;strong&gt;conditional statements&lt;/strong&gt; with Jinja&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Nest&lt;/strong&gt; Jinja templates&lt;/li&gt;
&lt;li&gt;Modify variables in Jinja with &lt;strong&gt;filters&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;macros&lt;/strong&gt; to add functionality to your front end&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll start by using Jinja on its own to cover the basics of Jinja templating.
Later you’ll build a basic Flask web project with two pages and a navigation bar to leverage the full potential of Jinja.&lt;/p&gt;
&lt;p&gt;Throughout the tutorial, you’ll build an example app that showcases some of Jinja’s wide range of features. To see what it’ll do, skip ahead to &lt;a href=&quot;#mark-the-current-page&quot;&gt;the final section&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can also find the full source code of the web project 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;Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/jinja-primer-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-jinja-primer-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the source code&lt;/a&gt; that you’ll use to explore Jinja’s capabilities.&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.1440a154cfa8.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 “Primer on Jinja Templating” 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/primer-on-jinja-templating/&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: #e6c7ab;&quot; alt=&quot;Jinja Templating Engine&quot; src=&quot;https://files.realpython.com/media/Primer-on-Jinja-Templating_Watermarked.ae90a187545f.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Primer-on-Jinja-Templating_Watermarked.ae90a187545f.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Primer-on-Jinja-Templating_Watermarked.ae90a187545f.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Primer-on-Jinja-Templating_Watermarked.ae90a187545f.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Primer-on-Jinja-Templating_Watermarked.ae90a187545f.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.1440a154cfa8.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/primer-on-jinja-templating/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Primer on Jinja Templating&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 Jinja templating. Jinja is a powerful tool for building rich templates in Python web applications, and it can also be used to create text files with programmatic content.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;p&gt;This tutorial is for you if you want to learn more about the Jinja template language or if you’re getting started with Flask.&lt;/p&gt;
&lt;h2 id=&quot;get-started-with-jinja&quot;&gt;Get Started With Jinja&lt;a class=&quot;headerlink&quot; href=&quot;#get-started-with-jinja&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://jinja.palletsprojects.com/en/3.1.x/&quot;&gt;Jinja&lt;/a&gt; is not only a &lt;a href=&quot;https://en.wikipedia.org/wiki/Jinja,_Uganda&quot;&gt;city in the Eastern Region of Uganda&lt;/a&gt; and a &lt;a href=&quot;https://en.wikipedia.org/wiki/Shinto_shrine&quot;&gt;Japanese temple&lt;/a&gt;, but also a &lt;strong&gt;template engine&lt;/strong&gt;.
You commonly use &lt;a href=&quot;https://en.wikipedia.org/wiki/Template_processor&quot;&gt;template engines&lt;/a&gt; for &lt;strong&gt;web templates&lt;/strong&gt; that receive dynamic content from the &lt;strong&gt;back end&lt;/strong&gt; and render it as a &lt;strong&gt;static page&lt;/strong&gt; in the front end.&lt;/p&gt;
&lt;p&gt;But you can use Jinja without a web framework running in the background.
That’s exactly what you’ll do in this section.
Specifically, you’ll install Jinja and build your first templates.&lt;/p&gt;
&lt;h3 id=&quot;install-jinja&quot;&gt;Install Jinja&lt;a class=&quot;headerlink&quot; href=&quot;#install-jinja&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Before exploring any new package, it’s a good idea to create and activate a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;.
That way, you’re installing any project dependencies in your project’s virtual environment instead of system-wide.&lt;/p&gt;
&lt;p&gt;Select your &lt;strong&gt;operating system&lt;/strong&gt; below and use your platform-specific command to set up a virtual environment:&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.1440a154cfa8.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.1440a154cfa8.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.1440a154cfa8.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.1440a154cfa8.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;/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.1440a154cfa8.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.1440a154cfa8.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.1440a154cfa8.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;
&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.1440a154cfa8.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.1440a154cfa8.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 the above commands, you create and activate a virtual environment named &lt;code&gt;venv&lt;/code&gt; by using Python’s built-in &lt;code&gt;venv&lt;/code&gt; module.
The parentheses (&lt;code&gt;()&lt;/code&gt;) surrounding &lt;code&gt;venv&lt;/code&gt; in front of the prompt indicate that you’ve successfully activated the virtual environment.&lt;/p&gt;
&lt;p&gt;After you’ve created and activated your virtual environment, it’s time to install Jinja with &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&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;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.1440a154cfa8.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;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;Jinja2
&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.1440a154cfa8.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.1440a154cfa8.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;Don’t forget the &lt;code&gt;2&lt;/code&gt; at the end of the package name.
Otherwise, you’ll install an &lt;a href=&quot;https://pypi.org/project/Jinja/&quot;&gt;old version&lt;/a&gt; that isn’t compatible with Python 3.&lt;/p&gt;
&lt;p&gt;It’s worth noting that although the current major version is actually greater than &lt;code&gt;2&lt;/code&gt;, the package that you’ll install is nevertheless called &lt;code&gt;Jinja2&lt;/code&gt;.
You can verify that you’ve installed a modern version of Jinja by running &lt;code&gt;pip list&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;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.1440a154cfa8.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;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;list
&lt;span class=&quot;go&quot;&gt;Package    Version&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;---------- -------&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Jinja2     3.x&lt;/span&gt;
&lt;span class=&quot;go&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.1440a154cfa8.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.1440a154cfa8.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;To make things even more confusing, after installing Jinja with an uppercase &lt;code&gt;J&lt;/code&gt;, you have to import it with a lowercase &lt;code&gt;j&lt;/code&gt; in Python.
Try it out by opening the &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interactive Python interpreter&lt;/a&gt; and running the following commands:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/primer-on-jinja-templating/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/primer-on-jinja-templating/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Primer on Jinja Templating</title>
      <id>https://realpython.com/quizzes/primer-on-jinja-templating/</id>
      <link href="https://realpython.com/quizzes/primer-on-jinja-templating/"/>
      <updated>2024-08-21T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Jinja templating. Jinja is a powerful tool for building rich templates in Python web applications, and it can also be used to create text files with programmatic content.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of Jinja templating.
Jinja is a powerful tool for building rich templates in Python web applications,
and it can also be used to create text files with programmatic content.&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 Astrophysics in Python With pandas and Matplotlib</title>
      <id>https://realpython.com/courses/astrophysics-pandas-matplotlib/</id>
      <link href="https://realpython.com/courses/astrophysics-pandas-matplotlib/"/>
      <updated>2024-08-20T14:00:00+00:00</updated>
      <summary>This course uses three problems often covered in introductory astro-physics courses to play in Python. Along the way you&#x27;ll learn some astronomy and how to use a variety of datascience libraries like NumPy, Matplotlib, pandas, and pint.</summary>
      <content type="html">
        &lt;p&gt;This course uses three problems often covered in introductory astro-physics courses to play in Python. Along the way you&amp;rsquo;ll learn some astronomy, and how to use a variety of datascience libraries like NumPy, Matplotlib, pandas, and pint.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course you&amp;rsquo;ll learn about&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Introductory astrophysics topics&lt;/li&gt;
&lt;li&gt;Working with dataframes in pandas&lt;/li&gt;
&lt;li&gt;Writing code that uses scientific units&lt;/li&gt;
&lt;li&gt;Visualizing information with Matplotlib&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 Classes: The Power of Object-Oriented Programming</title>
      <id>https://realpython.com/python-classes/</id>
      <link href="https://realpython.com/python-classes/"/>
      <updated>2024-08-19T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to create and use full-featured classes in your Python code. Classes provide a great way to solve complex programming problems by approaching them through models that represent real-world objects.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python supports the &lt;strong&gt;object-oriented&lt;/strong&gt; programming paradigm through &lt;strong&gt;classes&lt;/strong&gt;. They provide an elegant way to define reusable pieces of code that encapsulate data and behavior in a single entity. With classes, you can quickly and intuitively model real-world objects and solve complex problems.&lt;/p&gt;
&lt;p&gt;If you’re new to classes, need to refresh your knowledge, or want to dive deeper into them, then this tutorial is for you!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Define Python classes with the &lt;strong&gt;&lt;code&gt;class&lt;/code&gt; keyword&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Add state to your classes with &lt;strong&gt;class&lt;/strong&gt; and &lt;strong&gt;instance attributes&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Provide &lt;strong&gt;behavior&lt;/strong&gt; to your classes with &lt;strong&gt;methods&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;inheritance&lt;/strong&gt; to build hierarchies of classes&lt;/li&gt;
&lt;li&gt;Provide &lt;strong&gt;interfaces&lt;/strong&gt; with &lt;strong&gt;abstract classes&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should know about Python &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-data-types/&quot;&gt;data types&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;. Some experience with &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming (OOP)&lt;/a&gt; is also a plus. Don’t worry if you’re not an OOP expert yet. In this tutorial, you’ll learn the key concepts that you need to get started and more. You’ll also write several practical examples to help reinforce your knowledge of Python classes.&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-classes-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-classes-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download your free sample code&lt;/a&gt; that shows you how to build powerful object blueprints with classes 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.1440a154cfa8.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Python Classes - The Power of Object-Oriented Programming” 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-classes-oop/&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: #aadfe5;&quot; alt=&quot;Python Classes: The Power of Object-Oriented Programming&quot; src=&quot;https://files.realpython.com/media/Class-Concepts-Object-Oriented-Programming-in-Python_Watermarked.6cf327c51434.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Class-Concepts-Object-Oriented-Programming-in-Python_Watermarked.6cf327c51434.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Class-Concepts-Object-Oriented-Programming-in-Python_Watermarked.6cf327c51434.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Class-Concepts-Object-Oriented-Programming-in-Python_Watermarked.6cf327c51434.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Class-Concepts-Object-Oriented-Programming-in-Python_Watermarked.6cf327c51434.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.1440a154cfa8.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-classes-oop/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python Classes - The Power of Object-Oriented Programming&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 classes. With this knowledge, you&#x27;ll be able to define reusable pieces of code that encapsulate data and behavior in a single entity, model real-world objects, and solve complex problems.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-python-classes&quot;&gt;Getting Started With Python Classes&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-python-classes&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Programming_paradigm&quot;&gt;multiparadigm&lt;/a&gt; programming language that supports &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming (OOP)&lt;/a&gt; through classes that you can define with the &lt;code&gt;class&lt;/code&gt; keyword. You can think of a class as a piece of code that specifies the &lt;strong&gt;data&lt;/strong&gt; and &lt;strong&gt;behavior&lt;/strong&gt; that represent and model a particular type of object.&lt;/p&gt;
&lt;p&gt;What is a class in Python? A common analogy is that a class is like the blueprint for a house. You can use the blueprint to create several houses and even a complete neighborhood. Each concrete house is an &lt;strong&gt;object&lt;/strong&gt; or &lt;strong&gt;instance&lt;/strong&gt; that’s derived from the blueprint.&lt;/p&gt;
&lt;p&gt;Each instance can have its own properties, such as color, owner, and interior design. These properties carry what’s commonly known as the object’s &lt;a href=&quot;https://en.wikipedia.org/wiki/State_(computer_science)&quot;&gt;state&lt;/a&gt;. Instances can also have different behaviors, such as locking the doors and windows, opening the garage door, turning the lights on and off, watering the garden, and more.&lt;/p&gt;
&lt;p&gt;In OOP, you commonly use the term &lt;strong&gt;attributes&lt;/strong&gt; to refer to the properties or data associated with a specific object of a given class. In Python, attributes are &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt; defined inside a class with the purpose of storing all the required data for the class to work.&lt;/p&gt;
&lt;p&gt;Similarly, you’ll use the term &lt;strong&gt;methods&lt;/strong&gt; to refer to the different behaviors that objects will show. Methods are functions that you define within a class. These functions typically operate on or with the attributes of the underlying instance or class. Attributes and methods are collectively referred to as &lt;strong&gt;members&lt;/strong&gt; of a class or object.&lt;/p&gt;
&lt;p&gt;You can write classes to model the real world. These classes will help you better organize your code and solve complex programming problems.&lt;/p&gt;
&lt;p&gt;For example, you can use classes to create objects that emulate people, animals, vehicles, books, buildings, cars, or other objects. You can also model virtual objects, such as a web server, &lt;a href=&quot;https://realpython.com/directory-tree-generator-python/#coding-the-high-level-directorytree-class&quot;&gt;directory tree&lt;/a&gt;, chatbot, file manager, and more.&lt;/p&gt;
&lt;p&gt;Finally, you can use classes to build &lt;strong&gt;class hierarchies&lt;/strong&gt;. This way, you’ll promote code reuse and remove repetition throughout your codebase.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn a lot about classes and all the cool things that you can do with them. To kick things off, you’ll start by defining your first class in Python. Then you’ll dive into other topics related to instances, attributes, and methods.&lt;/p&gt;
&lt;h3 id=&quot;defining-a-class-in-python&quot;&gt;Defining a Class in Python&lt;a class=&quot;headerlink&quot; href=&quot;#defining-a-class-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To define a class, you need to use the &lt;code&gt;class&lt;/code&gt; keyword followed by the class name and a colon, just like you’d do for other &lt;a href=&quot;https://docs.python.org/3/reference/compound_stmts.html&quot;&gt;compound statements&lt;/a&gt; in Python. Then you must define the class body, which will start at the next indentation level:&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;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ClassName&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.1440a154cfa8.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.1440a154cfa8.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 a class’s body, you can define attributes and methods as needed. As you already learned, attributes are variables that hold the class data, while methods are functions that provide behavior and typically act on the class data.&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 Python, the body of a given class works as a &lt;a href=&quot;https://realpython.com/python-namespaces-scope/&quot;&gt;namespace&lt;/a&gt; where attributes and methods live. You can only access those attributes and methods through the class or its objects.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;As an example of how to define attributes and methods, say that you need a &lt;code&gt;Circle&lt;/code&gt; class to model different circles in a drawing application. Initially, your class will have a single attribute to hold the radius. It’ll also have a method to calculate the circle’s area:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python&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;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit;&quot;&gt;circle.py&lt;/code&gt;&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;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;math&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Circle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;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;radius&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;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;radius&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;radius&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;calculate_area&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;math&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pi&lt;/span&gt; &lt;span class=&quot;o&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;radius&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&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.1440a154cfa8.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.1440a154cfa8.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 code snippet, you define &lt;code&gt;Circle&lt;/code&gt; using the &lt;code&gt;class&lt;/code&gt; keyword. Inside the class, you write two methods. The &lt;code&gt;.__init__()&lt;/code&gt; method has a special meaning in Python classes. This method is known as the object &lt;a href=&quot;https://realpython.com/python-class-constructor/#object-initialization-with-__init__&quot;&gt;initializer&lt;/a&gt; because it defines and sets the initial values for the object’s attributes. You’ll learn more about this method in the &lt;a href=&quot;#instance-attributes&quot;&gt;Instance Attributes&lt;/a&gt; section.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-classes/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-classes/ »&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 #217: Packaging Data Analyses &amp; Using pandas GroupBy</title>
      <id>https://realpython.com/podcasts/rpp/217/</id>
      <link href="https://realpython.com/podcasts/rpp/217/"/>
      <updated>2024-08-16T12:00:00+00:00</updated>
      <summary>What are the best practices for organizing data analysis projects in Python? What are the advantages of a more package-centric approach to data science? 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 best practices for organizing data analysis projects in Python? What are the advantages of a more package-centric approach to data science? 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: Web Scraping With Scrapy and MongoDB</title>
      <id>https://realpython.com/quizzes/web-scraping-with-scrapy-and-mongodb/</id>
      <link href="https://realpython.com/quizzes/web-scraping-with-scrapy-and-mongodb/"/>
      <updated>2024-08-16T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of web scraping with Scrapy and MongoDB. You&#x27;ll revisit how to set up a Scrapy project, build a functional web scraper, extract data from websites, store scraped data in MongoDB, and test and debug your Scrapy web scraper.</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/web-scraping-with-scrapy-and-mongodb/&quot;&gt;Web Scraping with Scrapy and MongoDB&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to set up a Scrapy project, build a functional web scraper, extract data from websites using selectors, store scraped data in a MongoDB database, and test and debug your Scrapy web scraper.&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 Walrus Operator: Python&#x27;s Assignment Expressions</title>
      <id>https://realpython.com/python-walrus-operator/</id>
      <link href="https://realpython.com/python-walrus-operator/"/>
      <updated>2024-08-14T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn about assignment expressions and the walrus operator. The biggest change back in Python 3.8 was the inclusion of the := operator, which you can use to assign variables in the middle of expressions. You&#x27;ll see several examples of how to take advantage of this feature.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Each new version of Python adds new features to the language. Back when Python 3.8 was released, the biggest change was the addition of &lt;strong&gt;assignment expressions&lt;/strong&gt;. Specifically, the &lt;code&gt;:=&lt;/code&gt; operator gave you a new syntax for assigning variables in the middle of expressions. This operator is colloquially known as the &lt;strong&gt;walrus operator&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This tutorial is an in-depth introduction to the walrus operator. You’ll learn some of the motivations for the syntax update and explore examples where assignment expressions can be useful.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Identify &lt;strong&gt;the walrus operator&lt;/strong&gt; and understand its meaning&lt;/li&gt;
&lt;li&gt;Understand &lt;strong&gt;use cases&lt;/strong&gt; for the walrus operator&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Avoid repetitive code&lt;/strong&gt; by using the walrus operator&lt;/li&gt;
&lt;li&gt;Convert between code using the walrus operator and code using &lt;strong&gt;other assignment methods&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use appropriate &lt;strong&gt;style&lt;/strong&gt; in your assignment expressions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that all walrus operator examples in this tutorial require &lt;a href=&quot;https://realpython.com/python38-new-features/&quot;&gt;Python 3.8&lt;/a&gt; or later to work.&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-walrus-operator-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-walrus-operator-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 Python’s walrus operator.&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.1440a154cfa8.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 Walrus Operator: Python&#x27;s Assignment Expressions” 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-walrus-operator/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #ff7e74;&quot; alt=&quot;The Walrus Operator: Python&#x27;s Assignment Expressions&quot; src=&quot;https://files.realpython.com/media/The-Walrus-Operator-in-Python-3.8-UPDATE_Watermarked.d7eee1fde3ea.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/The-Walrus-Operator-in-Python-3.8-UPDATE_Watermarked.d7eee1fde3ea.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/The-Walrus-Operator-in-Python-3.8-UPDATE_Watermarked.d7eee1fde3ea.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/The-Walrus-Operator-in-Python-3.8-UPDATE_Watermarked.d7eee1fde3ea.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/The-Walrus-Operator-in-Python-3.8-UPDATE_Watermarked.d7eee1fde3ea.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.1440a154cfa8.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-walrus-operator/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;The Walrus Operator: Python&#x27;s Assignment Expressions&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 the Python Walrus Operator. This operator was introduced in Python 3.8, and understanding it can help you write more concise and efficient code.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;walrus-operator-fundamentals&quot;&gt;Walrus Operator Fundamentals&lt;a class=&quot;headerlink&quot; href=&quot;#walrus-operator-fundamentals&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;First, look at some different terms that programmers use to refer to this new syntax. You’ve already seen a few in this tutorial.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;:=&lt;/code&gt; operator is officially known as the &lt;strong&gt;assignment expression operator&lt;/strong&gt;. During early discussions, it was dubbed the &lt;strong&gt;walrus operator&lt;/strong&gt; because the &lt;code&gt;:=&lt;/code&gt; syntax resembles the eyes and tusks of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Walrus&quot;&gt;walrus&lt;/a&gt; lying on its side. You may also see the &lt;code&gt;:=&lt;/code&gt; operator referred to as the &lt;strong&gt;colon equals operator&lt;/strong&gt;. Yet another term used for assignment expressions is &lt;strong&gt;named expressions&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;hello-walrus&quot;&gt;Hello, Walrus!&lt;a class=&quot;headerlink&quot; href=&quot;#hello-walrus&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To get a first impression of what assignment expressions are all about, start your &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;REPL&lt;/a&gt; and play around with the following code:&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.1440a154cfa8.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;linenos&quot;&gt; 1&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;walrus&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;False&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 2&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;walrus&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;False&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 4&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 5&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;walrus&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 6&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;True&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 7&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;walrus&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 8&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&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.1440a154cfa8.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.1440a154cfa8.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;Line 1 shows a traditional &lt;a href=&quot;https://docs.python.org/3/reference/simple_stmts.html#assignment-statements&quot;&gt;assignment statement&lt;/a&gt; where the value &lt;code&gt;False&lt;/code&gt; is assigned to &lt;code&gt;walrus&lt;/code&gt;. Next, on line 5, you use an assignment expression to assign the value &lt;code&gt;True&lt;/code&gt; to &lt;code&gt;walrus&lt;/code&gt;. After both lines 1 and 5, you can refer to the assigned values by using the &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variable&lt;/a&gt; name &lt;code&gt;walrus&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You might be wondering why you’re using parentheses on line 5, and you’ll learn why the parentheses are needed &lt;a href=&quot;#walrus-operator-syntax&quot;&gt;later on in this tutorial&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; A &lt;strong&gt;statement&lt;/strong&gt; in Python is a unit of code. An &lt;strong&gt;expression&lt;/strong&gt; is a special statement that can be evaluated to some value.&lt;/p&gt;
&lt;p&gt;For example, &lt;code&gt;1 + 2&lt;/code&gt; is an expression that evaluates to the value &lt;code&gt;3&lt;/code&gt;, while &lt;code&gt;number = 1 + 2&lt;/code&gt; is an assignment statement that doesn’t evaluate to a value. Although running the statement &lt;code&gt;number = 1 + 2&lt;/code&gt; doesn’t evaluate to &lt;code&gt;3&lt;/code&gt;, it does &lt;em&gt;assign&lt;/em&gt; the value &lt;code&gt;3&lt;/code&gt; to &lt;code&gt;number&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In Python, you often see &lt;a href=&quot;https://docs.python.org/3/reference/simple_stmts.html&quot;&gt;simple statements&lt;/a&gt; like &lt;a href=&quot;https://realpython.com/python-return-statement/&quot;&gt;&lt;code&gt;return&lt;/code&gt; statements&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-import/&quot;&gt;&lt;code&gt;import&lt;/code&gt; statements&lt;/a&gt;, as well as &lt;a href=&quot;https://docs.python.org/3/reference/compound_stmts.html&quot;&gt;compound statements&lt;/a&gt; like &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;&lt;code&gt;if&lt;/code&gt; statements&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;function definitions&lt;/a&gt;. These are all statements, not expressions.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;There’s a subtle—but important—difference between the two types of assignments with the &lt;code&gt;walrus&lt;/code&gt; variable. An assignment expression returns the value, while a traditional assignment doesn’t. You can see this in action when the REPL doesn’t print any value after &lt;code&gt;walrus = False&lt;/code&gt; on line 1 but prints out &lt;code&gt;True&lt;/code&gt; after the assignment expression on line 5.&lt;/p&gt;
&lt;p&gt;You can see another important aspect about walrus operators in this example. Though it might look new, the &lt;code&gt;:=&lt;/code&gt; operator does &lt;em&gt;not&lt;/em&gt; do anything that isn’t possible without it. It only makes certain constructs more convenient and can sometimes communicate the intent of your code more clearly.&lt;/p&gt;
&lt;p&gt;Now you have a basic idea of what the &lt;code&gt;:=&lt;/code&gt; operator is and what it can do. It’s an operator used in assignment expressions, which can return the value being assigned, unlike traditional assignment statements. To get deeper and really learn about the walrus operator, continue reading to see where you should and shouldn’t use it.&lt;/p&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;a class=&quot;headerlink&quot; href=&quot;#implementation&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Like most new features in Python, assignment expressions were introduced through a &lt;strong&gt;Python Enhancement Proposal&lt;/strong&gt; (PEP). &lt;a href=&quot;https://www.python.org/dev/peps/pep-0572&quot;&gt;PEP 572&lt;/a&gt; describes the motivation for introducing the walrus operator, the details of the syntax, and examples where the &lt;code&gt;:=&lt;/code&gt; operator can be used to improve your code.&lt;/p&gt;
&lt;p&gt;This PEP was &lt;a href=&quot;https://mail.python.org/archives/list/python-ideas@python.org/message/H64ZNZ3T4RRJKMXR6UFNX3FK62IRPVOT/&quot;&gt;originally&lt;/a&gt; written by &lt;a href=&quot;https://twitter.com/Rosuav&quot;&gt;Chris Angelico&lt;/a&gt; in February 2018. Following some heated discussion, PEP 572 was &lt;a href=&quot;https://mail.python.org/archives/list/python-dev@python.org/message/J6EBK6ZEHZXTVWYSUO5N5XCUS45UQSB3/&quot;&gt;accepted&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/gvanrossum&quot;&gt;Guido van Rossum&lt;/a&gt; in July 2018.&lt;/p&gt;
&lt;p&gt;Since then, Guido &lt;a href=&quot;https://mail.python.org/archives/list/python-committers@python.org/message/GQONAGWBBFRHVRUPU7RNBM75MHKGUFJN/&quot;&gt;announced&lt;/a&gt; that he was stepping down from his role as &lt;a href=&quot;https://en.wikipedia.org/wiki/Benevolent_dictator_for_life&quot;&gt;benevolent dictator for life (BDFL)&lt;/a&gt;. Since early 2019, the Python language has been &lt;a href=&quot;https://www.python.org/dev/peps/pep-0013/&quot;&gt;governed&lt;/a&gt; by an elected &lt;a href=&quot;https://realpython.com/python38-new-features/#the-python-steering-council&quot;&gt;steering council&lt;/a&gt; instead.&lt;/p&gt;
&lt;p&gt;The walrus operator was implemented by &lt;a href=&quot;https://realpython.com/interview-emily-morehouse/&quot;&gt;Emily Morehouse&lt;/a&gt;, and made available in the first &lt;a href=&quot;https://www.python.org/downloads/release/python-380a1/&quot;&gt;alpha release&lt;/a&gt; of Python 3.8.&lt;/p&gt;
&lt;h3 id=&quot;motivation&quot;&gt;Motivation&lt;a class=&quot;headerlink&quot; href=&quot;#motivation&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-walrus-operator/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-walrus-operator/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: The Walrus Operator: Python&#x27;s Assignment Expressions</title>
      <id>https://realpython.com/quizzes/python-walrus-operator/</id>
      <link href="https://realpython.com/quizzes/python-walrus-operator/"/>
      <updated>2024-08-14T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of the Python Walrus Operator. This operator was introduced in Python 3.8, and understanding it can help you write more concise and efficient code.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of the &lt;a href=&quot;https://realpython.com/python-walrus-operator/&quot;&gt;Python Walrus Operator&lt;/a&gt;. This operator, used for assignment expressions, was introduced in Python 3.8 and can be used to assign values to variables as part of an expression.&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>Sorting Dictionaries in Python: Keys, Values, and More</title>
      <id>https://realpython.com/courses/sorting-dictionaries-keys-values-more/</id>
      <link href="https://realpython.com/courses/sorting-dictionaries-keys-values-more/"/>
      <updated>2024-08-13T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to sort Python dictionaries. By the end, you&#x27;ll be able to sort by key, value, or even nested attributes. But you won&#x27;t stop there---you&#x27;ll also measure the performance of variations when sorting and compare different key-value data structures.</summary>
      <content type="html">
        &lt;p&gt;You&amp;rsquo;ve got a &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt;, but you&amp;rsquo;d like to sort the key-value pairs. Perhaps you&amp;rsquo;ve tried passing a dictionary to the &lt;code&gt;sorted()&lt;/code&gt; &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;function&lt;/a&gt; but didn&amp;rsquo;t receive the results you expected. In this video course, you&amp;rsquo;ll go over everything you need to know to sort dictionaries in Python.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Review how to use the &lt;strong&gt;&lt;code&gt;sorted()&lt;/code&gt;&lt;/strong&gt; function&lt;/li&gt;
&lt;li&gt;Learn how to get dictionary &lt;strong&gt;views&lt;/strong&gt; to &lt;strong&gt;iterate&lt;/strong&gt; over&lt;/li&gt;
&lt;li&gt;Understand how dictionaries are cast to &lt;strong&gt;lists&lt;/strong&gt; during sorting&lt;/li&gt;
&lt;li&gt;Learn how to specify a &lt;strong&gt;sort key&lt;/strong&gt; to sort a dictionary by value, key, or nested attribute&lt;/li&gt;
&lt;li&gt;Review dictionary &lt;strong&gt;comprehensions&lt;/strong&gt; and the &lt;code&gt;dict()&lt;/code&gt; &lt;strong&gt;constructor&lt;/strong&gt; to rebuild your dictionaries&lt;/li&gt;
&lt;li&gt;Consider alternative &lt;strong&gt;data structures&lt;/strong&gt; for your &lt;strong&gt;key-value data&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>Python News Roundup: August 2024</title>
      <id>https://realpython.com/python-news-august-2024/</id>
      <link href="https://realpython.com/python-news-august-2024/"/>
      <updated>2024-08-12T14:00:00+00:00</updated>
      <summary>In July 2024, Python published the first release candidate of its 3.13 version. The PSF announced some news about new staff members, and PyOhio US 2024 took place in Ohio. Finally, some fundamental Python projects, such as Django, Pillow, pytest, and Pydantic, also released new versions.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In July, there was some exciting news for the Python community as the Python core development team released versions 3.13.0b4 and 3.13.0rc1 of the language. The 3.13.0b4 release marked the end of the beta phase and paved the way for the release candidate phase.&lt;/p&gt;
&lt;p&gt;Note that 3.13.0rc1 is a pre-release, so you shouldn’t use it for production environments. However, it provides a great way to try some new and exciting language features.&lt;/p&gt;
&lt;p&gt;There’s also great some news from the Python Software Foundation, PyOhio 2024, and the Python ecosystem.&lt;/p&gt;
&lt;p&gt;Let’s dive into the most exciting &lt;strong&gt;Python news&lt;/strong&gt; from last month!&lt;/p&gt;
&lt;h2 id=&quot;python-3130b4-and-3130rc1&quot;&gt;Python 3.13.0b4 and 3.13.0rc1&lt;a class=&quot;headerlink&quot; href=&quot;#python-3130b4-and-3130rc1&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python 3.13 has reached its fourth beta release, marking the end of the beta phase. Beta releases serve to test new features and bug fixes. However, it’s important to note that this is a preview release and it isn’t recommended for use in production environments.&lt;/p&gt;
&lt;p&gt;If you’re a library maintainer, you’re encouraged to test your code with this new version so you can prepare it to support the latest features of the language.&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 pre-releases, check out the &lt;a href=&quot;https://realpython.com/python-pre-release/&quot;&gt;How Can You Install a Pre-Release Version of Python?&lt;/a&gt; tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;One of the most significant new features of Python 3.13 is the improved interactive interpreter or &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;REPL&lt;/a&gt;, which now provides several cool features, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Colorized prompts&lt;/li&gt;
&lt;li&gt;Multiline editing with history preservation&lt;/li&gt;
&lt;li&gt;Interactive help browsing with &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-f1&quot;&gt;F1&lt;/kbd&gt;&lt;/span&gt; and a separate command history&lt;/li&gt;
&lt;li&gt;History browsing with &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-f2&quot;&gt;F2&lt;/kbd&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Paste mode for larger blocks of code with &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-f3&quot;&gt;F3&lt;/kbd&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;REPL-specific commands like &lt;code&gt;help&lt;/code&gt;, &lt;code&gt;exit&lt;/code&gt;, and &lt;code&gt;quit&lt;/code&gt; without the call parentheses&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is exciting news! The standard REPL up until Python 3.13 was lacking, and sometimes it was necessary to install a third-party tool like &lt;a href=&quot;https://realpython.com/bpython-alternative-python-repl/&quot;&gt;bpython&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/ipython-interactive-python-shell/&quot;&gt;IPython&lt;/a&gt; to compensate.&lt;/p&gt;
&lt;p&gt;Again, with this release, the beta phase has officially ended, and the first release candidate—3.13.0rc1—is considered the penultimate release preview. In this release candidate phase, only bug fixes are allowed.&lt;/p&gt;
&lt;p&gt;The second candidate, which is the last planned release preview, should be out on September 3, 2024, and the official release of 3.13 should be ready on October 1, 2024. Only more excitement lies ahead! &lt;/p&gt;
&lt;h2 id=&quot;the-python-software-foundation-psf-shares-great-news&quot;&gt;The Python Software Foundation (PSF) Shares Great News&lt;a class=&quot;headerlink&quot; href=&quot;#the-python-software-foundation-psf-shares-great-news&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-august-2024/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-august-2024/ »&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 #216: Learning Through Building the Black Python Devs Community</title>
      <id>https://realpython.com/podcasts/rpp/216/</id>
      <link href="https://realpython.com/podcasts/rpp/216/"/>
      <updated>2024-08-09T12:00:00+00:00</updated>
      <summary>What hurdles must be cleared when starting an international organization? How do you empower others in a community by sharing responsibilities? This week on the show, we speak with Jay Miller about Black Python Devs.</summary>
      <content type="html">
        &lt;p&gt;What hurdles must be cleared when starting an international organization? How do you empower others in a community by sharing responsibilities? This week on the show, we speak with Jay Miller about Black Python Devs.&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>Asynchronous Iterators and Iterables in Python</title>
      <id>https://realpython.com/python-async-iterators/</id>
      <link href="https://realpython.com/python-async-iterators/"/>
      <updated>2024-08-07T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to create and use asynchronous iterators and iterables in Python. You&#x27;ll explore their syntax and structure and discover how they can be leveraged to handle asynchronous operations more efficiently.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;When you write asynchronous code in Python, you’ll likely need to create asynchronous iterators and iterables at some point. Asynchronous iterators are what Python uses to control &lt;code&gt;async for&lt;/code&gt; loops, while asynchronous iterables are objects that you can iterate over using &lt;code&gt;async for&lt;/code&gt; loops.&lt;/p&gt;
&lt;p&gt;Both tools allow you to iterate over awaitable objects without blocking your code. This way, you can perform different tasks asynchronously.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learn what &lt;strong&gt;async iterators&lt;/strong&gt; and &lt;strong&gt;iterables&lt;/strong&gt; are in Python&lt;/li&gt;
&lt;li&gt;Create async &lt;strong&gt;generator expressions&lt;/strong&gt; and &lt;strong&gt;generator iterators&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Code async iterators and iterables with the &lt;strong&gt;&lt;code&gt;.__aiter__()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;.__anext__()&lt;/code&gt;&lt;/strong&gt; methods&lt;/li&gt;
&lt;li&gt;Use async iterators in &lt;strong&gt;async loops&lt;/strong&gt; and &lt;strong&gt;comprehensions&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should know the basics of Python’s &lt;a href=&quot;https://realpython.com/python-iterators-iterables/&quot;&gt;iterators and iterables&lt;/a&gt;. You should also know about Python’s &lt;a href=&quot;https://realpython.com/python-async-features/&quot;&gt;asynchronous features&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/async-io-python/&quot;&gt;tools&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-async-iterators/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-async-iterators&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that you’ll use to learn about asynchronous iterators and iterables 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.1440a154cfa8.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 “Asynchronous Iterators and Iterables in Python” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

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

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

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #b9abe6;&quot; alt=&quot;Asynchronous Iterators and Iterables in Python&quot; src=&quot;https://files.realpython.com/media/Asynchronous-Iterators-and-Iterables-in-Python_Watermarked.c7ed7ce35df8.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Asynchronous-Iterators-and-Iterables-in-Python_Watermarked.c7ed7ce35df8.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Asynchronous-Iterators-and-Iterables-in-Python_Watermarked.c7ed7ce35df8.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Asynchronous-Iterators-and-Iterables-in-Python_Watermarked.c7ed7ce35df8.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Asynchronous-Iterators-and-Iterables-in-Python_Watermarked.c7ed7ce35df8.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.1440a154cfa8.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-async-iterators/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Asynchronous Iterators and Iterables in Python&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Take this quiz to test your understanding of how to create and use Python async iterators and iterables in the context of asynchronous code.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;getting-to-know-async-iterators-and-iterables-in-python&quot;&gt;Getting to Know Async Iterators and Iterables in Python&lt;a class=&quot;headerlink&quot; href=&quot;#getting-to-know-async-iterators-and-iterables-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Iterators and iterables are fundamental components in Python. You’ll use them in almost all your programs where you iterate over data streams using a &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/a&gt;. Iterators power and control the iteration process, while iterables typically hold data that you want to iterate over.&lt;/p&gt;
&lt;p&gt;Python iterators implement the &lt;a href=&quot;https://en.wikipedia.org/wiki/Iterator_pattern&quot;&gt;iterator design pattern&lt;/a&gt;, which allows you to traverse a container and access its elements. To implement this pattern, iterators need the &lt;code&gt;.__iter__()&lt;/code&gt; and &lt;code&gt;.__next__()&lt;/code&gt; &lt;a href=&quot;https://realpython.com/python-magic-methods/&quot;&gt;special methods&lt;/a&gt;. Similarly, iterables are typically data containers that implement the &lt;code&gt;.__iter__()&lt;/code&gt; method.&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 dive deeper into iterators and iterables, 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;Python has extended the concept of iterators and iterables to &lt;strong&gt;asynchronous programming&lt;/strong&gt; with the &lt;code&gt;asyncio&lt;/code&gt; module and the &lt;a href=&quot;https://realpython.com/python-keywords/#asynchronous-programming-keywords-async-await&quot;&gt;&lt;code&gt;async&lt;/code&gt; and &lt;code&gt;await&lt;/code&gt;&lt;/a&gt; keywords. In this scenario, asynchronous iterators drive the &lt;strong&gt;asynchronous iteration process&lt;/strong&gt;, mainly powered by &lt;code&gt;async for&lt;/code&gt; loops and &lt;a href=&quot;#asynchronous-comprehensions-and-generator-expressions&quot;&gt;comprehensions&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; In this tutorial, you won’t dive into the intricacies of Python’s asynchronous programming. So, you should be familiar with the related concepts. If you’re not, then you can check out the following tutorials:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-async-features/&quot;&gt;Getting Started With Async Features in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/async-io-python/&quot;&gt;Async IO in Python: A Complete Walkthrough&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In these tutorials, you’ll gain the required background to prepare for exploring asynchronous iterators and iterables in more depth.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In the following sections, you’ll briefly examine the concepts of asynchronous iterators and iterables in Python.&lt;/p&gt;
&lt;h3 id=&quot;async-iterators&quot;&gt;Async Iterators&lt;a class=&quot;headerlink&quot; href=&quot;#async-iterators&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Python’s documentation defines &lt;strong&gt;asynchronous iterators&lt;/strong&gt;, or &lt;em&gt;async iterators&lt;/em&gt; for short, as the following:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;An object that implements the &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__aiter__&quot;&gt;&lt;code&gt;.__aiter__()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__anext__&quot;&gt;&lt;code&gt;.__anext__()&lt;/code&gt;&lt;/a&gt; [special] methods. &lt;code&gt;.__anext__()&lt;/code&gt; must return an &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-awaitable&quot;&gt;awaitable&lt;/a&gt; object. [An] &lt;a href=&quot;https://docs.python.org/3/reference/compound_stmts.html#async-for&quot;&gt;&lt;code&gt;async for&lt;/code&gt;&lt;/a&gt; [loop] resolves the awaitables returned by an asynchronous iterator’s &lt;code&gt;.__anext__()&lt;/code&gt; method until it raises a &lt;a href=&quot;https://docs.python.org/3/library/exceptions.html#StopAsyncIteration&quot;&gt;&lt;code&gt;StopAsyncIteration&lt;/code&gt;&lt;/a&gt; exception. (&lt;a href=&quot;https://docs.python.org/3/glossary.html#term-asynchronous-iterator&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Similar to regular iterators that must implement &lt;code&gt;.__iter__()&lt;/code&gt; and &lt;code&gt;.__next__()&lt;/code&gt;, async iterators must implement &lt;code&gt;.__aiter__()&lt;/code&gt; and &lt;code&gt;.__anext__()&lt;/code&gt;. In regular iterators, the &lt;code&gt;.__iter__()&lt;/code&gt; method usually returns the iterator itself. This is also true for async iterators.&lt;/p&gt;
&lt;p&gt;To continue with this parallelism, in regular iterators, the &lt;code&gt;.__next__()&lt;/code&gt; method must return the next object for the iteration. In async iterators, the &lt;code&gt;.__anext__()&lt;/code&gt; method must return the next object, which must be awaitable.&lt;/p&gt;
&lt;p&gt;Python defines awaitable objects as described in the quote below:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;An object that can be used in an &lt;a href=&quot;https://docs.python.org/3/reference/expressions.html#await&quot;&gt;&lt;code&gt;await&lt;/code&gt;&lt;/a&gt; expression. [It] can be a &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-coroutine&quot;&gt;coroutine&lt;/a&gt; or an object with an &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__await__&quot;&gt;&lt;code&gt;.__await__()&lt;/code&gt;&lt;/a&gt; method. (&lt;a href=&quot;https://docs.python.org/3/glossary.html#term-awaitable&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In practice, a quick way to make an awaitable object in Python is to call an asynchronous function. You define this type of function with the &lt;a href=&quot;https://docs.python.org/3/reference/compound_stmts.html#async-def&quot;&gt;&lt;code&gt;async def&lt;/code&gt;&lt;/a&gt; keyword construct. This call creates a &lt;strong&gt;coroutine object&lt;/strong&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 can also create awaitable objects by implementing the &lt;code&gt;.__await__()&lt;/code&gt; special method in a custom class. This method must return an &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-iterator&quot;&gt;iterator&lt;/a&gt; that yields control back to the &lt;a href=&quot;https://docs.python.org/3/library/asyncio-eventloop.html&quot;&gt;event loop&lt;/a&gt; until the awaited result is ready. This topic is beyond the scope of this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;When the data stream runs out of data, the method must raise a &lt;code&gt;StopAsyncIteration&lt;/code&gt; exception to end the asynchronous iteration process.&lt;/p&gt;
&lt;p&gt;Here’s an example of an async iterator that allows iterating over a range of numbers asynchronously:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-async-iterators/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-async-iterators/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Asynchronous Iterators and Iterables in Python</title>
      <id>https://realpython.com/quizzes/python-async-iterators/</id>
      <link href="https://realpython.com/quizzes/python-async-iterators/"/>
      <updated>2024-08-07T12:00:00+00:00</updated>
      <summary>Take this quiz to test your understanding of how to create and use Python async iterators and iterables in the context of asynchronous code.</summary>
      <content type="html">
        &lt;p&gt;Test your understanding of how to create and use Python async iterators and iterables in the context of asynchronous code.&lt;/p&gt;
&lt;p&gt;You can take this quiz after reading the &lt;a href=&quot;https://realpython.com/python-async-iterators/&quot;&gt;Asynchronous Iterators and Iterables in Python&lt;/a&gt; tutorial.&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>Interacting With REST APIs and Python</title>
      <id>https://realpython.com/courses/interacting-rest-apis-python/</id>
      <link href="https://realpython.com/courses/interacting-rest-apis-python/"/>
      <updated>2024-08-06T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to use Python to communicate with REST APIs. You&#x27;ll learn about REST architecture and how to use the requests library to get data from a REST API. You&#x27;ll also explore different Python tools you can use to build REST APIs.</summary>
      <content type="html">
        &lt;p&gt;There&amp;rsquo;s an amazing amount of data available on the Web. Many &lt;strong&gt;web services&lt;/strong&gt;, like YouTube and GitHub, make their data accessible to third-party applications through an &lt;strong&gt;application programming interface (API)&lt;/strong&gt;. One of the most popular ways to build APIs is the &lt;strong&gt;REST&lt;/strong&gt; architecture style. Python provides some great tools not only to get data from REST APIs but also to build your own Python REST APIs.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;strong&gt;REST&lt;/strong&gt; architecture is&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;REST APIs&lt;/strong&gt; provide access to web data&lt;/li&gt;
&lt;li&gt;How to consume data from REST APIs using the &lt;strong&gt;&lt;code&gt;requests&lt;/code&gt;&lt;/strong&gt; library&lt;/li&gt;
&lt;li&gt;What steps to take to &lt;strong&gt;build a REST API&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What some popular &lt;strong&gt;Python tools&lt;/strong&gt; are for building REST APIs&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>Functional Programming in Python: When and How to Use It</title>
      <id>https://realpython.com/python-functional-programming/</id>
      <link href="https://realpython.com/python-functional-programming/"/>
      <updated>2024-08-05T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn about functional programming in Python. You&#x27;ll see what functional programming is, how it&#x27;s supported in Python, and how you can use it in your Python code.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Functional programming&lt;/strong&gt; is a programming paradigm in which the primary method of computation is the evaluation of functions. But how does Python support functional programming?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What the &lt;strong&gt;functional programming&lt;/strong&gt; paradigm entails&lt;/li&gt;
&lt;li&gt;What it means to say that &lt;strong&gt;functions&lt;/strong&gt; are &lt;strong&gt;first-class citizens&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;How to define &lt;strong&gt;anonymous functions&lt;/strong&gt; with the &lt;strong&gt;&lt;code&gt;lambda&lt;/code&gt;&lt;/strong&gt; keyword&lt;/li&gt;
&lt;li&gt;How to implement functional code using &lt;strong&gt;&lt;code&gt;map()&lt;/code&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;filter()&lt;/code&gt;&lt;/strong&gt;, and &lt;strong&gt;&lt;code&gt;reduce()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Functional programming typically plays a minor role in Python code, but it’s still good to be familiar with it. You’ll probably encounter it from time to time when reading code written by others. And you may even find situations where it’s advantageous to use Python’s functional programming capabilities in your own code.&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-functional-programming-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-functional-programming-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 when and how to use  functional programming 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.1440a154cfa8.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 “Functional Programming in Python: When and How to Use It” 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-functional-programming/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #abe5b2;&quot; alt=&quot;Functional Programming in Python: When and How to Use It&quot; src=&quot;https://files.realpython.com/media/TUT19---Functional-Programming_Watermarked.7c5a8382c298.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/TUT19---Functional-Programming_Watermarked.7c5a8382c298.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/TUT19---Functional-Programming_Watermarked.7c5a8382c298.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/TUT19---Functional-Programming_Watermarked.7c5a8382c298.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/TUT19---Functional-Programming_Watermarked.7c5a8382c298.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.1440a154cfa8.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-functional-programming/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Functional Programming in Python: When and How to Use It&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 functional programming in Python. You&#x27;ll revisit concepts such as functions being first-class citizens in Python, the use of the lambda keyword, and the implementation of functional code using map(), filter(), and reduce().&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;what-is-functional-programming&quot;&gt;What Is Functional Programming?&lt;a class=&quot;headerlink&quot; href=&quot;#what-is-functional-programming&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A &lt;strong&gt;pure function&lt;/strong&gt; is a function whose output value follows solely from its input values without any observable &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/#side-effects&quot;&gt;side effects&lt;/a&gt;. In &lt;strong&gt;functional programming&lt;/strong&gt;, a program consists primarily of the evaluation of pure functions. Computation proceeds by nested or &lt;a href=&quot;https://en.wikipedia.org/wiki/Function_composition_(computer_science)&quot;&gt;composed function calls&lt;/a&gt; without changes to state or mutable data.&lt;/p&gt;
&lt;p&gt;The functional paradigm is popular because it offers several advantages over other programming paradigms. Functional code is:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;High level:&lt;/strong&gt; You describe the result you want rather than explicitly specifying the steps required to get there. Single statements tend to be concise but pack a lot of punch.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Transparent:&lt;/strong&gt; The behavior of a pure function can be described by its inputs and outputs, without intermediary values. This eliminates the possibility of side effects and facilitates &lt;a href=&quot;https://realpython.com/python-debugging-pdb/&quot;&gt;debugging&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Parallelizable:&lt;/strong&gt; Routines that don’t cause side effects can more easily &lt;a href=&quot;https://realpython.com/learning-paths/python-concurrency-parallel-programming/&quot;&gt;run in parallel&lt;/a&gt; with one another.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Many programming languages support some degree of functional programming. In some languages, virtually all code follows the functional paradigm. &lt;a href=&quot;https://www.haskell.org&quot;&gt;Haskell&lt;/a&gt; is one such example. Python, by contrast, does support functional programming but contains features of other programming models as well.&lt;/p&gt;
&lt;p&gt;While it’s true that an in-depth description of &lt;a href=&quot;https://en.wikipedia.org/wiki/Functional_programming&quot;&gt;functional programming&lt;/a&gt; is somewhat complex, the goal here isn’t to present a rigorous definition but to show you what you can do by way of functional programming in Python.&lt;/p&gt;
&lt;h2 id=&quot;how-well-does-python-support-functional-programming&quot;&gt;How Well Does Python Support Functional Programming?&lt;a class=&quot;headerlink&quot; href=&quot;#how-well-does-python-support-functional-programming&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To support functional programming, it’s beneficial if a &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;function&lt;/a&gt; in a given programming language can do these two things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Take another function as an argument&lt;/li&gt;
&lt;li&gt;Return another function to its caller&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Python plays nicely in both respects. Everything in Python is an &lt;a href=&quot;https://realpython.com/python-variables/#object-references&quot;&gt;object&lt;/a&gt;, and all objects in Python have more or less equal stature. Functions are no exception.&lt;/p&gt;
&lt;p&gt;In Python, functions are &lt;strong&gt;first-class citizens&lt;/strong&gt;. This means that functions have the same characteristics as values like &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/&quot;&gt;numbers&lt;/a&gt;. Anything you would expect to be able to do with a string or number, you can also do with a function.&lt;/p&gt;
&lt;p&gt;For example, you can assign a function to a variable. You can then use that variable the same way you would use the function itself:&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.1440a154cfa8.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;linenos&quot;&gt; 1&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;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 2&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;I am function func()!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 4&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 5&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 6&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;I am function func()!&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 7&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;linenos&quot;&gt; 8&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;another_name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;func&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;linenos&quot;&gt; 9&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;another_name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;I am function func()!&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.1440a154cfa8.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.1440a154cfa8.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 assignment &lt;code&gt;another_name = func&lt;/code&gt; on line 8 creates a new reference to &lt;code&gt;func()&lt;/code&gt; named &lt;code&gt;another_name&lt;/code&gt;. You can then call the function by either of the two names, &lt;code&gt;func&lt;/code&gt; or &lt;code&gt;another_name&lt;/code&gt;, as shown on lines 5 and 9.&lt;/p&gt;
&lt;p&gt;You can display a function to the console with &lt;a href=&quot;https://realpython.com/python-print/&quot;&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/a&gt;, include it as an element in a composite data object like a &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;list&lt;/a&gt;, or even use it as a &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt; key:&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.1440a154cfa8.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;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;I am function func()!&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;hll&quot;&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;cat&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;cat &amp;lt;function func at 0x7f81b4d29bf8&amp;gt; 42&lt;/span&gt;

&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;objects&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;cat&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;objects&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;go&quot;&gt;&amp;lt;function func at 0x7f81b4d29bf8&amp;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;objects&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;go&quot;&gt;I am function func()!&lt;/span&gt;

&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&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;cat&quot;&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;n&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&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.1440a154cfa8.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.1440a154cfa8.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;func()&lt;/code&gt; appears in all the same contexts as the values &lt;code&gt;&quot;cat&quot;&lt;/code&gt; and &lt;code&gt;42&lt;/code&gt;, and the interpreter handles it just fine.&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; What you can or can’t do with an object in Python depends to some extent on context. Some operations work for certain object types but not for others. &lt;/p&gt;
&lt;p&gt;For example, you can add two integer objects or &lt;a href=&quot;https://realpython.com/python-string-concatenation/&quot;&gt;concatenate&lt;/a&gt; two string objects with the plus operator (&lt;code&gt;+&lt;/code&gt;), but the plus operator isn’t defined for function objects.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;For present purposes, what matters is that functions in Python satisfy the two criteria beneficial for functional programming listed above. You can pass a function to another function as an argument:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-functional-programming/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-functional-programming/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Functional Programming in Python: When and How to Use It</title>
      <id>https://realpython.com/quizzes/python-functional-programming/</id>
      <link href="https://realpython.com/quizzes/python-functional-programming/"/>
      <updated>2024-08-05T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of functional programming in Python. You&#x27;ll revisit concepts such as functions being first-class citizens in Python, the use of the lambda keyword, and the implementation of functional code using map(), filter(), and reduce().</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-functional-programming/&quot;&gt;Functional Programming in Python&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit the functional programming paradigm, the concept of functions as first-class citizens in Python, the use of the &lt;code&gt;lambda&lt;/code&gt; keyword, and how to implement functional code using &lt;code&gt;map()&lt;/code&gt;, &lt;code&gt;filter()&lt;/code&gt;, and &lt;code&gt;reduce()&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>The Real Python Podcast – Episode #215: Using GraphQL in Django With Strawberry &amp; Prototype Purgatory</title>
      <id>https://realpython.com/podcasts/rpp/215/</id>
      <link href="https://realpython.com/podcasts/rpp/215/"/>
      <updated>2024-08-02T12:00:00+00:00</updated>
      <summary>How do you integrate GraphQL into your Python web development? How about quickly building graph-based APIs inside Django&#x27;s battery-included framework? 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;How do you integrate GraphQL into your Python web development? How about quickly building graph-based APIs inside Django&#x27;s battery-included framework? 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: Python&#x27;s Built-in Exceptions: A Walkthrough With Examples</title>
      <id>https://realpython.com/quizzes/python-built-in-exceptions/</id>
      <link href="https://realpython.com/quizzes/python-built-in-exceptions/"/>
      <updated>2024-07-31T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python&#x27;s built-in exceptions. With this knowledge, you&#x27;ll be able to effectively identify and handle these exceptions when they appear. Additionally, you&#x27;ll be more familiar with how to raise some of these exceptions in your code.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of the most commonly used &lt;a href=&quot;https://realpython.com/python-built-in-exceptions/&quot;&gt;built-in exceptions in Python&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Exception handling is a core topic in Python. Knowing how to use some of the most common built-in exceptions can help you to debug your code and handle your own exceptions.&lt;/p&gt;
&lt;p&gt;Good luck!&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Simulate a Text File in Python</title>
      <id>https://realpython.com/courses/simulate-text-file/</id>
      <link href="https://realpython.com/courses/simulate-text-file/"/>
      <updated>2024-07-30T14:00:00+00:00</updated>
      <summary>Testing an application that reads files from a disk can be complicated. It may depend on the machine, require special access, or be frustratingly slow. This course shows you how to simulate a text file using Python to simplify testing.</summary>
      <content type="html">
        &lt;p&gt;Testing applications that read files from a disk can be challenging. Issues such as machine dependencies, special access requirements, and slow performance often arise when you need to read text from a file.&lt;/p&gt;
&lt;p&gt;In this &lt;strong&gt;Code Conversation&lt;/strong&gt; with instructor Martin Breuss, you&amp;rsquo;ll discover how to simplify this process by simulating text files with StringIO from the io module in Python’s standard library.&lt;/p&gt;
&lt;p&gt;In this video course, you’ll learn how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;io.StringIO&lt;/code&gt; to simulate a text file on disk&lt;/li&gt;
&lt;li&gt;Perform file operations on a &lt;code&gt;io.StringIO&lt;/code&gt; object&lt;/li&gt;
&lt;li&gt;Decide when to use &lt;code&gt;io.StringIO&lt;/code&gt; and when to avoid it&lt;/li&gt;
&lt;li&gt;Understand possible alternatives&lt;/li&gt;
&lt;li&gt;Mock a file object using &lt;code&gt;unittest.mock&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Understanding how to simulate text file objects and mock file objects can help streamline your testing strategy and development process.&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 #214: Build Captivating Display Tables in Python With Great Tables</title>
      <id>https://realpython.com/podcasts/rpp/214/</id>
      <link href="https://realpython.com/podcasts/rpp/214/"/>
      <updated>2024-07-26T12:00:00+00:00</updated>
      <summary>Do you need help making data tables in Python look interesting and attractive? How can you create beautiful display-ready tables as easily as charts and graphs in Python? This week on the show, we speak with Richard Iannone and Michael Chow from Posit about the Great Tables Python library.</summary>
      <content type="html">
        &lt;p&gt;Do you need help making data tables in Python look interesting and attractive? How can you create beautiful display-ready tables as easily as charts and graphs in Python? This week on the show, we speak with Richard Iannone and Michael Chow from Posit about the Great Tables Python library.&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: Getting Started With Testing in Python</title>
      <id>https://realpython.com/quizzes/testing-python/</id>
      <link href="https://realpython.com/quizzes/testing-python/"/>
      <updated>2024-07-25T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python testing. With this knowledge, you&#x27;ll be able to create basic tests, execute them, and find bugs before your users do.</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-testing/&quot;&gt;testing your Python code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Testing in Python is a huge topic and can come with a lot of complexity, but it doesn&amp;rsquo;t need to be hard. You can get started creating simple tests for your application in a few easy steps and then build on it from there.&lt;/p&gt;
&lt;p&gt;With this quiz, you can check your understanding of the fundamentals of Python testing. Good luck!&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>pandas GroupBy: Grouping Real World Data in Python</title>
      <id>https://realpython.com/courses/pandas-groupby-real-world-data/</id>
      <link href="https://realpython.com/courses/pandas-groupby-real-world-data/"/>
      <updated>2024-07-23T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to work adeptly with the pandas GroupBy while mastering ways to manipulate, transform, and summarize data. You&#x27;ll work with real-world datasets and chain GroupBy methods together to get data into an output that suits your needs.</summary>
      <content type="html">
        &lt;p&gt;Whether you&amp;rsquo;ve just started working with &lt;a href=&quot;https://realpython.com/pandas-python-explore-dataset/&quot;&gt;pandas&lt;/a&gt; and want to master one of its core capabilities, or you&amp;rsquo;re looking to fill in some gaps in your understanding about &lt;code&gt;.groupby()&lt;/code&gt;, this course will help you to break down and visualize a &lt;strong&gt;pandas GroupBy&lt;/strong&gt; operation from start to finish.&lt;/p&gt;
&lt;p&gt;This course is meant to complement the &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html&quot;&gt;official pandas documentation&lt;/a&gt; and the &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/user_guide/cookbook.html#cookbook-grouping&quot;&gt;pandas Cookbook&lt;/a&gt;, where there are self-contained, bite-sized examples. Here, however, you&amp;rsquo;ll focus on three more involved walkthroughs that use real-world datasets.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll cover:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How to use pandas &lt;strong&gt;GroupBy operations&lt;/strong&gt; on &lt;strong&gt;real-world data&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How the &lt;strong&gt;split-apply-combine&lt;/strong&gt; chain of operations works&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;decompose&lt;/strong&gt; the split-apply-combine chain into steps&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;categorize methods&lt;/strong&gt; of a pandas GroupBy object based on their intent and result&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 #213: Constraint Programming &amp; Exploring Python&#x27;s Built-in Functions</title>
      <id>https://realpython.com/podcasts/rpp/213/</id>
      <link href="https://realpython.com/podcasts/rpp/213/"/>
      <updated>2024-07-19T12:00:00+00:00</updated>
      <summary>What are discrete optimization problems? How do you solve them with constraint programming in Python? 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 discrete optimization problems? How do you solve them with constraint programming in Python? 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>Exercises Course: Introduction to Web Scraping With Python</title>
      <id>https://realpython.com/courses/exercises-introduction-web-scraping/</id>
      <link href="https://realpython.com/courses/exercises-introduction-web-scraping/"/>
      <updated>2024-07-16T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll practice the main steps of the web scraping process. You&#x27;ll write a script that uses Python&#x27;s requests library to scrape and parse data from a website. You&#x27;ll also interact with HTML forms using tools like Beautiful Soup and Mechanical Soup to extract specific information.</summary>
      <content type="html">
        &lt;p&gt;&lt;strong&gt;Web scraping&lt;/strong&gt; is the process of collecting and parsing raw data from the Web, and the Python community has come up with some pretty powerful web scraping tools.&lt;/p&gt;
&lt;p&gt;The Internet hosts the greatest source of information on the planet. Many disciplines, such as &lt;a href=&quot;https://realpython.com/learning-paths/data-science-python-core-skills/&quot;&gt;data science&lt;/a&gt;, business intelligence, and investigative reporting, can benefit enormously from collecting and analyzing data from websites. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll practice:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Parsing website data using &lt;strong&gt;string methods&lt;/strong&gt; and &lt;strong&gt;regular expressions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Parsing website data using an &lt;strong&gt;HTML parser&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Interacting with &lt;strong&gt;forms&lt;/strong&gt; and other website components&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 #212: Digging Into Graph Theory in Python With David Amos</title>
      <id>https://realpython.com/podcasts/rpp/212/</id>
      <link href="https://realpython.com/podcasts/rpp/212/"/>
      <updated>2024-07-12T12:00:00+00:00</updated>
      <summary>Have you wondered about graph theory and how to start exploring it in Python? What resources and Python libraries can you use to experiment and learn more? This week on the show, former co-host David Amos returns to talk about what he&#x27;s been up to and share his knowledge about graph theory in Python.</summary>
      <content type="html">
        &lt;p&gt;Have you wondered about graph theory and how to start exploring it in Python? What resources and Python libraries can you use to experiment and learn more? This week on the show, former co-host David Amos returns to talk about what he&#x27;s been up to and share his knowledge about graph theory 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>Customize VS Code Settings</title>
      <id>https://realpython.com/courses/customize-vscode-settings/</id>
      <link href="https://realpython.com/courses/customize-vscode-settings/"/>
      <updated>2024-07-09T14:00:00+00:00</updated>
      <summary>In this course, Philipp helps you customize your Visual Studio Code settings to switch from a basic cluttered look to a clean presentable look. This is not just pleasant on the eyes, but also gives you a nice user interface if you want to share on a zoom call or screen recording.</summary>
      <content type="html">
        &lt;p&gt;Visual Studio Code, is an open-source code editor available on all platforms. It’s also a great platform for Python development. The default settings in VS Code present a somewhat cluttered environment. &lt;/p&gt;
&lt;p&gt;This &lt;strong&gt;Code Conversation&lt;/strong&gt; with instructor Philipp Acsany is about learning how to customize the settings within the interface of VS Code. Having a clean digital workspace is an important part of your work life. Removing distractions and making code more readable can increase productivity and even help you spot bugs.&lt;/p&gt;
&lt;p&gt;In this &lt;strong&gt;Code Conversation&lt;/strong&gt;, you&amp;rsquo;ll learn how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Work With User Settings&lt;/li&gt;
&lt;li&gt;Create a VS Code Profile&lt;/li&gt;
&lt;li&gt;Find and Adjust Specific Settings&lt;/li&gt;
&lt;li&gt;Clean Up the VS Code User Interface&lt;/li&gt;
&lt;li&gt;Export Your Profile to Re-use Across Installations&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 #211: Python Doesn&#x27;t Round Numbers the Way You Might Think</title>
      <id>https://realpython.com/podcasts/rpp/211/</id>
      <link href="https://realpython.com/podcasts/rpp/211/"/>
      <updated>2024-07-05T12:00:00+00:00</updated>
      <summary>Does Python round numbers the same way you learned back in math class? You might be surprised by the default method Python uses and the variety of ways to round numbers in Python. 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;Does Python round numbers the same way you learned back in math class? You might be surprised by the default method Python uses and the variety of ways to round numbers in Python. 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>Defining Python Constants for Code Maintainability</title>
      <id>https://realpython.com/courses/defining-constants-code-maintainability/</id>
      <link href="https://realpython.com/courses/defining-constants-code-maintainability/"/>
      <updated>2024-07-02T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to properly define constants in Python. By coding a bunch of practical example, you&#x27;ll also learn how Python constants can improve your code&#x27;s readability, reusability, and maintainability.</summary>
      <content type="html">
        &lt;p&gt;In programming, the term &lt;strong&gt;constant&lt;/strong&gt; refers to names representing values that don&amp;rsquo;t change during a program&amp;rsquo;s execution. Constants are a fundamental concept in programming, and Python developers use them in many cases. However, Python doesn&amp;rsquo;t have a dedicated syntax for defining constants. In practice, Python constants are just &lt;strong&gt;variables&lt;/strong&gt; that &lt;em&gt;never change&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;To prevent programmers from reassigning a name that&amp;rsquo;s supposed to hold a constant, the Python community has adopted a naming convention: &lt;em&gt;use uppercase letters&lt;/em&gt;. For every Pythonista, it&amp;rsquo;s essential to know what constants are, as well as why and when to use them.&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;Properly &lt;strong&gt;define constants&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Identify some &lt;strong&gt;built-in constants&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;Use constants to improve your code&amp;rsquo;s &lt;strong&gt;readability&lt;/strong&gt;, &lt;strong&gt;reusability&lt;/strong&gt;, and &lt;strong&gt;maintainability&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Apply different approaches to &lt;strong&gt;organize&lt;/strong&gt; and &lt;strong&gt;manage&lt;/strong&gt; constants in a project&lt;/li&gt;
&lt;li&gt;Use several techniques to make constants &lt;strong&gt;strictly constant&lt;/strong&gt; in Python&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 #210: Creating a Guitar Synthesizer &amp; Generating WAV Files With Python</title>
      <id>https://realpython.com/podcasts/rpp/210/</id>
      <link href="https://realpython.com/podcasts/rpp/210/"/>
      <updated>2024-06-28T12:00:00+00:00</updated>
      <summary>What techniques go into synthesizing a guitar sound in Python? What higher-level programming and Python concepts can you practice while building advanced projects? This week on the show, we talk with Real Python author and core team member Bartosz Zaczyński about his recent step-by-step project, Build a Guitar Synthesizer: Play Musical Tablature in Python.</summary>
      <content type="html">
        &lt;p&gt;What techniques go into synthesizing a guitar sound in Python? What higher-level programming and Python concepts can you practice while building advanced projects? This week on the show, we talk with Real Python author and core team member Bartosz Zaczyński about his recent step-by-step project, Build a Guitar Synthesizer: Play Musical Tablature 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>
  

</feed>
