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

  
    <entry>
      <title>Building Enumerations With Python’s enum</title>
      <id>https://realpython.com/courses/python-enum/</id>
      <link href="https://realpython.com/courses/python-enum/"/>
      <updated>2024-01-30T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll discover the art of creating and using enumerations of logically connected constants in Python. To accomplish this, you&#x27;ll explore the Enum class and other associated tools and types from the enum module from the Python standard library.</summary>
      <content type="html">
        &lt;p&gt;Some programming languages, such as Java and C++, have built-in support for a data type called &lt;strong&gt;enumerations&lt;/strong&gt;, commonly referred to as &lt;strong&gt;enums&lt;/strong&gt;. Enums enable you to create sets of logically related constants that you can access through the enumeration itself. Unlike these languages, Python doesn&amp;rsquo;t have a dedicated syntax for enums. However, the Python &lt;a href=&quot;https://docs.python.org/3/library/index.html&quot;&gt;standard library&lt;/a&gt; provides an &lt;code&gt;enum&lt;/code&gt; module that offers support for enumerations through the &lt;code&gt;Enum&lt;/code&gt; class.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re familiar with enums from other languages and wish to use them in Python, or if you simply want to learn how to work with enumerations, then this video course is designed for you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll discover how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create &lt;strong&gt;enumerations&lt;/strong&gt; of constants using Python&amp;rsquo;s &lt;strong&gt;&lt;code&gt;Enum&lt;/code&gt;&lt;/strong&gt; class&lt;/li&gt;
&lt;li&gt;Interact with enumerations and their &lt;strong&gt;members&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Customize enumeration classes by adding &lt;strong&gt;new functionalities&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Apply &lt;strong&gt;practical examples&lt;/strong&gt; to gain a deeper understanding of the benefits of using enumerations&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Additionally, you&amp;rsquo;ll explore other specific enumeration types available in the &lt;code&gt;enum&lt;/code&gt; module, such as &lt;code&gt;IntEnum&lt;/code&gt;, &lt;code&gt;IntFlag&lt;/code&gt;, and &lt;code&gt;Flag&lt;/code&gt;. These specialized enums will expand your repertoire.&lt;/p&gt;
&lt;p&gt;To get the most out of this video course, you should be familiar with &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/inheritance-composition-python/&quot;&gt;inheritance&lt;/a&gt; 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>Python Exceptions: An Introduction</title>
      <id>https://realpython.com/python-exceptions/</id>
      <link href="https://realpython.com/python-exceptions/"/>
      <updated>2024-01-29T14:00:00+00:00</updated>
      <summary>In this beginner tutorial, you&#x27;ll learn what exceptions are good for in Python. You&#x27;ll see how to raise exceptions and how to handle them with try ... except blocks.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;A Python program terminates as soon as it encounters an error. In Python, an error can be a syntax error or an exception. In this tutorial, you’ll see what an exception is and how it differs from a syntax error. After that, you’ll learn about raising exceptions and making assertions. Then, you’ll get to know all the exception-related keywords that you can use in a &lt;code&gt;try&lt;/code&gt; … &lt;code&gt;except&lt;/code&gt; block to fine-tune how you can work with Python exceptions.&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;&lt;strong&gt;Raise an exception&lt;/strong&gt; in Python with &lt;code&gt;raise&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debug and test&lt;/strong&gt; your code with &lt;code&gt;assert&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Handle exceptions&lt;/strong&gt; with &lt;code&gt;try&lt;/code&gt; and &lt;code&gt;except&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fine-tune your exception handling&lt;/strong&gt; with &lt;code&gt;else&lt;/code&gt; and &lt;code&gt;finally&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll get to know these keywords by walking through a practical example of handling a platform-related exception. Finally, you’ll also learn how to create your own custom Python exceptions.&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-exceptions-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-exceptions-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 exceptions work in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
  &lt;p&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt; Test your knowledge with our interactive “Python Exceptions: An Introduction” quiz. Upon completion you will receive a score so you can track your learning progress over time:&lt;/p&gt;
  &lt;p class=&quot;text-center my-2&quot;&gt;&lt;a class=&quot;btn btn-primary&quot; href=&quot;/quizzes/python-exceptions/&quot; target=&quot;_blank&quot;&gt;Take the Quiz »&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;understanding-exceptions-and-syntax-errors&quot;&gt;Understanding Exceptions and Syntax Errors&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-exceptions-and-syntax-errors&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://realpython.com/invalid-syntax-python/&quot;&gt;Syntax errors&lt;/a&gt; occur when the parser detects an incorrect statement. Observe the following example:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pytb&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 Traceback&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;x&quot;&gt;&amp;gt;&amp;gt;&amp;gt; print(0 / 0))&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;stdin&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;w&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;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;pm&quot;&gt;^&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;SyntaxError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;unmatched &#x27;)&#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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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 arrow indicates where the parser ran into the &lt;strong&gt;syntax error&lt;/strong&gt;. Additionally, the error message gives you a hint about what went wrong. In this example, there was one bracket too many. Remove it and run your code again:&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;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;stdin&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;, in &lt;span class=&quot;n&quot;&gt;&amp;lt;module&amp;gt;&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;ZeroDivisionError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;division by zero&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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;This time, you ran into an &lt;strong&gt;exception error&lt;/strong&gt;. This type of error occurs whenever syntactically correct Python code results in an error. The last line of the message indicates what type of exception error you ran into.&lt;/p&gt;
&lt;p&gt;Instead of just writing &lt;em&gt;exception error&lt;/em&gt;, Python details what &lt;em&gt;type&lt;/em&gt; of exception error it encountered. In this case, it was a &lt;code&gt;ZeroDivisionError&lt;/code&gt;. Python comes with &lt;a href=&quot;https://docs.python.org/3/library/exceptions.html&quot;&gt;various built-in exceptions&lt;/a&gt; as well as the possibility to create user-defined exceptions.&lt;/p&gt;
&lt;h2 id=&quot;raising-an-exception-in-python&quot;&gt;Raising an Exception in Python&lt;a class=&quot;headerlink&quot; href=&quot;#raising-an-exception-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are scenarios where you might want to stop your program by raising an exception if a condition occurs. You can do this with the &lt;a href=&quot;https://realpython.com/python-raise-exception/&quot;&gt;&lt;code&gt;raise&lt;/code&gt;&lt;/a&gt; keyword:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/raise.3931e8819e08.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/raise.3931e8819e08.png&quot; width=&quot;1394&quot; height=&quot;311&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/raise.3931e8819e08.png&amp;amp;w=348&amp;amp;sig=fe4872f24f9121ecf0f4dbdba805c754f0fd42cf 348w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/raise.3931e8819e08.png&amp;amp;w=464&amp;amp;sig=dc5fd94d9614729105d5285574d5b4755ee1454a 464w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/raise.3931e8819e08.png&amp;amp;w=697&amp;amp;sig=8f2b5e3f414c44ff5f7464e4793598843ba71ad1 697w, https://files.realpython.com/media/raise.3931e8819e08.png 1394w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Illustration of  raise statement usage&quot; data-asset=&quot;394&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;You can even complement the statement with a custom message. Assume that you’re writing a tiny toy program that expects only numbers up to &lt;code&gt;5&lt;/code&gt;. You can raise an error when an unwanted condition occurs:&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;low.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;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;raise&lt;/span&gt; &lt;span class=&quot;ne&quot;&gt;Exception&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;The number should not exceed 5. (&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;=}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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 raised an &lt;code&gt;Exception&lt;/code&gt; object and passed it an informative custom message. You built the message using an &lt;a href=&quot;https://realpython.com/python-f-strings/&quot;&gt;f-string&lt;/a&gt; and a &lt;a href=&quot;https://realpython.com/python-f-strings/#self-documenting-expressions-for-debugging&quot;&gt;self-documenting expression&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When you run &lt;code&gt;low.py&lt;/code&gt;, you’ll get the following output:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pytb&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 Traceback&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;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;./low.py&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;, in &lt;span class=&quot;n&quot;&gt;&amp;lt;module&amp;gt;&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;raise&lt;/span&gt; &lt;span class=&quot;ne&quot;&gt;Exception&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;The number should not exceed 5. (&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;=}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;Exception&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;The number should not exceed 5. (number=10)&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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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 program comes to a halt and displays the exception to your &lt;a href=&quot;https://realpython.com/terminal-commands/&quot;&gt;terminal&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;REPL&lt;/a&gt;, offering you helpful clues about what went wrong. Note that the final call to &lt;a href=&quot;https://realpython.com/python-print/&quot;&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/a&gt; never executed, because Python raised the exception before it got to that line of code.&lt;/p&gt;
&lt;p&gt;With the &lt;code&gt;raise&lt;/code&gt; keyword, you can raise any exception object in Python and stop your program when an unwanted condition occurs.&lt;/p&gt;
&lt;h2 id=&quot;debugging-during-development-with-assert&quot;&gt;Debugging During Development With &lt;code&gt;assert&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#debugging-during-development-with-assert&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before moving on to the most common way of working with exceptions in Python using &lt;a href=&quot;https://realpython.com/python-exceptions/#handling-exceptions-with-the-try-and-except-block&quot;&gt;the &lt;code&gt;try&lt;/code&gt; … &lt;code&gt;except&lt;/code&gt; block&lt;/a&gt;, you’ll take a quick look at an exception that’s a bit different than the others.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-exceptions/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-exceptions/ »&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 #189: Building a Python Debugger &amp; Preparing for NumPy 2.0</title>
      <id>https://realpython.com/podcasts/rpp/189/</id>
      <link href="https://realpython.com/podcasts/rpp/189/"/>
      <updated>2024-01-26T12:34:00+00:00</updated>
      <summary>How does a debugger work? What can you learn about Python by building one from scratch? 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 does a debugger work? What can you learn about Python by building one from scratch? 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>What Are Python Raw Strings?</title>
      <id>https://realpython.com/python-raw-strings/</id>
      <link href="https://realpython.com/python-raw-strings/"/>
      <updated>2024-01-24T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn the nuances of using raw string literals in your Python source code. Raw strings offer convenient syntax for including backslash characters in string literals without the complexity of escape sequences.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you’ve ever come across a standard &lt;a href=&quot;https://en.wikipedia.org/wiki/String_literal&quot;&gt;string literal&lt;/a&gt; prefixed with either the lowercase letter &lt;code&gt;r&lt;/code&gt; or the uppercase letter &lt;code&gt;R&lt;/code&gt;, then you’ve encountered a Python &lt;strong&gt;raw string&lt;/strong&gt;:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;This is a raw string&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;This is a raw string&#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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;Although a raw string looks and behaves mostly the same as a normal string literal, there’s an important difference in how Python interprets some of its characters, which you’ll explore in this tutorial.&lt;/p&gt;
&lt;p&gt;Notice that there’s nothing special about the resulting string object. Whether you declare your &lt;a href=&quot;https://en.wikipedia.org/wiki/Literal_(computer_programming)&quot;&gt;literal value&lt;/a&gt; using a prefix or not, you’ll always end up with a regular Python &lt;code&gt;str&lt;/code&gt; object.&lt;/p&gt;
&lt;p&gt;Other prefixes available at your fingertips, which you can use and sometimes even &lt;a href=&quot;https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-python-grammar-stringprefix&quot;&gt;mix together&lt;/a&gt; in your Python string literals, include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;b&lt;/code&gt;: Bytes literal&lt;/li&gt;
&lt;li&gt;&lt;code&gt;f&lt;/code&gt;: Formatted string literal&lt;/li&gt;
&lt;li&gt;&lt;code&gt;u&lt;/code&gt;: Legacy Unicode string literal (&lt;a href=&quot;https://peps.python.org/pep-0414/&quot;&gt;PEP 414&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Out of those, you might be most familiar with &lt;a href=&quot;https://realpython.com/python-f-strings/&quot;&gt;f-strings&lt;/a&gt;, which let you evaluate expressions inside string literals. Raw strings aren’t as popular as f-strings, but they do have their own uses that can improve your code’s readability.&lt;/p&gt;
&lt;p&gt;Creating a &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string of characters&lt;/a&gt; is often one of the first skills that you learn when studying a new programming language. The Python Basics &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;book&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;learning path&lt;/a&gt; cover this topic right at the beginning. With Python, you can define string literals in your source code by delimiting the text with either single quotes (&lt;code&gt;&#x27;&lt;/code&gt;) or double quotes (&lt;code&gt;&quot;&lt;/code&gt;):&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;david&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;She said &quot;I love you&quot; to me.&#x27;&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;alice&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Oh, that&#x27;s wonderful to hear!&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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;Having such a choice can help you avoid a syntax error when your text includes one of those delimiting characters (&lt;code&gt;&#x27;&lt;/code&gt; or &lt;code&gt;&quot;&lt;/code&gt;). For example, if you need to represent an apostrophe in a string, then you can enclose your text in double quotes. Alternatively, you can use multiline strings to mix both types of delimiters in the text.&lt;/p&gt;
&lt;p&gt;You may use triple quotes (&lt;code&gt;&#x27;&#x27;&#x27;&lt;/code&gt; or &lt;code&gt;&quot;&quot;&quot;&lt;/code&gt;) to declare a &lt;strong&gt;multiline string literal&lt;/strong&gt; that can accommodate a longer piece of text, such as an excerpt from the &lt;a href=&quot;https://realpython.com/zen-of-python/&quot;&gt;Zen of Python&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;poem&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&quot;&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Beautiful is better than ugly.&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Explicit is better than implicit.&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Simple is better than complex.&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Complex is better than complicated.&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;Multiline string literals can optionally act as &lt;a href=&quot;https://realpython.com/documenting-python-code/&quot;&gt;docstrings&lt;/a&gt;, a useful form of code documentation in Python. Docstrings can include bare-bones test cases known as &lt;a href=&quot;https://realpython.com/python-doctest/&quot;&gt;doctests&lt;/a&gt;, as well.&lt;/p&gt;
&lt;p&gt;Regardless of the delimiter type of your choice, you can always prepend a prefix to your string literal. Just make sure there’s no space between the prefix letters and the opening quote.&lt;/p&gt;
&lt;p&gt;When you use the letter &lt;code&gt;r&lt;/code&gt; as the prefix, you’ll turn the corresponding string literal into a raw string counterpart. &lt;strong&gt;So, what are Python raw strings exactly?&lt;/strong&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;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/escape-character-sequences-cheatsheet/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-escape-character-sequences-cheatsheet&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download a cheatsheet&lt;/a&gt; that shows you the most useful Python escape character sequences.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
  &lt;p&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt; Test your knowledge with our interactive “Python Raw Strings” quiz. Upon completion you will receive a score so you can track your learning progress over time:&lt;/p&gt;
  &lt;p class=&quot;text-center my-2&quot;&gt;&lt;a class=&quot;btn btn-primary&quot; href=&quot;/quizzes/python-raw-strings/&quot; target=&quot;_blank&quot;&gt;Take the Quiz »&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;in-short-python-raw-strings-ignore-escape-character-sequences&quot;&gt;In Short: Python Raw Strings Ignore Escape Character Sequences&lt;a class=&quot;headerlink&quot; href=&quot;#in-short-python-raw-strings-ignore-escape-character-sequences&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In some cases, defining a string through the raw string literal will produce precisely the same result as using the standard string literal in Python:&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;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;I love you&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;I love you&quot;&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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;Here, both literals represent string objects that share a common value: the text &lt;em&gt;I love you&lt;/em&gt;. Even though the first literal comes with a prefix, it has no effect on the outcome, so both strings compare as equal.&lt;/p&gt;
&lt;p&gt;To observe the real difference between raw and standard string literals in Python, consider a different example depicting a date formatted as a string:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;10\25\1991&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;10&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\25\1&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;991&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;False&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;This time, the comparison turns out to be false even though the two string literals look visually similar. Unlike before, the resulting string objects no longer contain the same sequence of characters. The raw string’s prefix (&lt;code&gt;r&lt;/code&gt;) changes the meaning of special character sequences that begin with a &lt;a href=&quot;https://en.wikipedia.org/wiki/Backslash&quot;&gt;backslash (&lt;code&gt;\&lt;/code&gt;)&lt;/a&gt; inside the literal.&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 understand how Python interprets the above string, head over to the &lt;a href=&quot;#what-are-the-common-escape-character-sequences&quot;&gt;final section&lt;/a&gt; of this tutorial, where you’ll cover the most common types of escape sequences in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-raw-strings/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-raw-strings/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Basics: Lists and Tuples</title>
      <id>https://realpython.com/courses/python-basics-lists-tuples/</id>
      <link href="https://realpython.com/courses/python-basics-lists-tuples/"/>
      <updated>2024-01-23T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn about Python lists and tuples, including how to define and manipulate them in your code. By the end of the course, you&#x27;ll be ready to effectively use lists and tuples in your programming projects.</summary>
      <content type="html">
        &lt;p&gt;&lt;strong&gt;Python lists&lt;/strong&gt; are similar to real-life lists. You can use them to store and organize a collection of objects, which can be of any data type. Instead of just storing one item, a list can hold multiple items while allowing manipulation and retrieval of those items. Because lists are &lt;strong&gt;mutable&lt;/strong&gt;, you can think of them as being written in pencil. In other words, you can make changes.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Tuples&lt;/strong&gt;, on the other hand, are written in ink. They&amp;rsquo;re similar to lists in that they can hold multiple items, but unlike lists, tuples are &lt;strong&gt;immutable&lt;/strong&gt;, meaning you can&amp;rsquo;t modify them after you&amp;rsquo;ve created them.&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 lists and tuples are and how they&amp;rsquo;re structured&lt;/li&gt;
&lt;li&gt;How lists and tuples differ from other data structures&lt;/li&gt;
&lt;li&gt;How to define and manipulate lists and tuples in your Python code&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By the end of this course, you&amp;rsquo;ll have a solid understanding of Python lists and tuples, and you&amp;rsquo;ll be able to use them effectively in your own programming projects.&lt;/p&gt;
&lt;p&gt;This video course is part of the Python Basics series, which accompanies &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. You can also check out the other &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics courses&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Note that you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt; throughout this course.&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>When to Use a List Comprehension in Python</title>
      <id>https://realpython.com/list-comprehension-python/</id>
      <link href="https://realpython.com/list-comprehension-python/"/>
      <updated>2024-01-22T14:00:00+00:00</updated>
      <summary>Python list comprehensions help you to create lists while performing sophisticated filtering, mapping, and conditional logic on their members. In this tutorial, you&#x27;ll learn when to use a list comprehension in Python and how to create them effectively.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;One of Python’s most distinctive features is the &lt;strong&gt;list comprehension&lt;/strong&gt;, which you can use to create powerful functionality within a single line of code. However, many developers struggle to fully leverage the more advanced features of list comprehensions in Python. Some programmers even use them too much, which can lead to code that’s less efficient and harder to read.&lt;/p&gt;
&lt;p&gt;By the end of this tutorial, you’ll understand the full power of Python list comprehensions and know how to use their features comfortably. You’ll also gain an understanding of the trade-offs that come with using them so that you can determine when other approaches are preferable.&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;Rewrite loops and &lt;code&gt;map()&lt;/code&gt; calls as &lt;strong&gt;list comprehensions&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Choose&lt;/strong&gt; between comprehensions, loops, and &lt;code&gt;map()&lt;/code&gt; calls&lt;/li&gt;
&lt;li&gt;Supercharge your comprehensions with &lt;strong&gt;conditional logic&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use comprehensions to &lt;strong&gt;replace &lt;code&gt;filter()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Profile&lt;/strong&gt; your code to resolve performance questions&lt;/li&gt;
&lt;/ul&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/list-comprehension-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-list-comprehension-python-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 and when to use list comprehensions in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;transforming-lists-in-python&quot;&gt;Transforming Lists in Python&lt;a class=&quot;headerlink&quot; href=&quot;#transforming-lists-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are a few different ways to create and add items to a &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;lists&lt;/a&gt; in Python. In this section, you’ll explore &lt;code&gt;for&lt;/code&gt; loops and the &lt;code&gt;map()&lt;/code&gt; function to perform these tasks. Then, you’ll move on to learn about how to use list comprehensions and when list comprehensions can benefit your Python program.&lt;/p&gt;
&lt;h3 id=&quot;use-for-loops&quot;&gt;Use &lt;code&gt;for&lt;/code&gt; Loops&lt;a class=&quot;headerlink&quot; href=&quot;#use-for-loops&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The most common type of loop is the &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/a&gt;. You can use a &lt;code&gt;for&lt;/code&gt; loop to create a list of elements in three steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Instantiate an empty list.&lt;/li&gt;
&lt;li&gt;Loop over an iterable or &lt;a href=&quot;https://realpython.com/python-range/&quot;&gt;range&lt;/a&gt; of elements.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-append/&quot;&gt;Append&lt;/a&gt; each element to the end of the list.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you want to create a list containing the first ten perfect squares, then you can complete these steps in three lines of 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;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;squares&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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;squares&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;squares&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]&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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;Here, you instantiate an empty list, &lt;code&gt;squares&lt;/code&gt;. Then, you use a &lt;code&gt;for&lt;/code&gt; loop to iterate over &lt;code&gt;range(10)&lt;/code&gt;. Finally, you multiply each &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;number&lt;/a&gt; by itself and append the result to the end of the list.&lt;/p&gt;
&lt;h3 id=&quot;work-with-map-objects&quot;&gt;Work With &lt;code&gt;map&lt;/code&gt; Objects&lt;a class=&quot;headerlink&quot; href=&quot;#work-with-map-objects&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;For an alternative approach that’s based in &lt;a href=&quot;https://realpython.com/python-functional-programming/&quot;&gt;functional programming&lt;/a&gt;, you can use &lt;a href=&quot;https://realpython.com/python-map-function/&quot;&gt;&lt;code&gt;map()&lt;/code&gt;&lt;/a&gt;. You pass in a function and an iterable, and &lt;code&gt;map()&lt;/code&gt; will create an object. This object contains the result that you’d get from running each iterable element through the supplied function.&lt;/p&gt;
&lt;p&gt;As an example, consider a situation in which you need to calculate the price after tax for a list of transactions:&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;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;prices&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.09&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;23.56&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;57.84&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;4.56&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;6.78&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;TAX_RATE&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;.08&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;get_price_with_tax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;price&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TAX_RATE&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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;final_prices&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_price_with_tax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;prices&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;final_prices&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;map object at 0x7f34da341f90&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;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;final_prices&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[1.1772000000000002, 25.4448, 62.467200000000005, 4.9248, 7.322400000000001]&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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;Here, you have an iterable, &lt;code&gt;prices&lt;/code&gt;, and a function, &lt;code&gt;get_price_with_tax()&lt;/code&gt;. You pass both of these arguments to &lt;code&gt;map()&lt;/code&gt; and store the resulting &lt;code&gt;map&lt;/code&gt; object in &lt;code&gt;final_prices&lt;/code&gt;. Finally, you convert &lt;code&gt;final_prices&lt;/code&gt; into a list using &lt;code&gt;list()&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&quot;leverage-list-comprehensions&quot;&gt;Leverage List Comprehensions&lt;a class=&quot;headerlink&quot; href=&quot;#leverage-list-comprehensions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;List comprehensions are a third way of making or transforming lists. With this elegant approach, you could rewrite the &lt;code&gt;for&lt;/code&gt; loop from the first example in just a single line of 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;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;squares&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&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;squares&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]&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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;Rather than creating an empty list and adding each element to the end, you simply define the list and its contents at the same time by following this format:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;new_list = [expression for member in iterable]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Every list comprehension in Python includes three elements:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/strong&gt; is the member itself, a call to a method, or any other valid expression that returns a value. In the example above, the expression &lt;code&gt;number * number&lt;/code&gt; is the square of the member value.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;member&lt;/code&gt;&lt;/strong&gt; is the object or value in the list or iterable. In the example above, the member value is &lt;code&gt;number&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;iterable&lt;/code&gt;&lt;/strong&gt; is a list, &lt;a href=&quot;https://realpython.com/python-sets/&quot;&gt;set&lt;/a&gt;, sequence, &lt;a href=&quot;https://realpython.com/introduction-to-python-generators/&quot;&gt;generator&lt;/a&gt;, or any other object that can return its elements one at a time. In the example above, the iterable is &lt;code&gt;range(10)&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/list-comprehension-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/list-comprehension-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 #188: Measuring Bias, Toxicity, and Truthfulness in LLMs With Python</title>
      <id>https://realpython.com/podcasts/rpp/188/</id>
      <link href="https://realpython.com/podcasts/rpp/188/"/>
      <updated>2024-01-19T12:00:00+00:00</updated>
      <summary>How can you measure the quality of a large language model? What tools can measure bias, toxicity, and truthfulness levels in a model using Python? This week on the show, Jodie Burchell, developer advocate for data science at JetBrains, returns to discuss techniques and tools for evaluating LLMs With Python.</summary>
      <content type="html">
        &lt;p&gt;How can you measure the quality of a large language model? What tools can measure bias, toxicity, and truthfulness levels in a model using Python? This week on the show, Jodie Burchell, developer advocate for data science at JetBrains, returns to discuss techniques and tools for evaluating LLMs With 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>Using Python for Data Analysis</title>
      <id>https://realpython.com/python-for-data-analysis/</id>
      <link href="https://realpython.com/python-for-data-analysis/"/>
      <updated>2024-01-17T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn the importance of having a structured data analysis workflow, and you&#x27;ll get the opportunity to practice using Python for data analysis while following a common workflow process.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Data analysis&lt;/strong&gt; is a broad term that covers a wide range of techniques that enable you to reveal any insights and relationships that may exist within raw data. As you might expect, Python lends itself readily to data analysis. Once Python has analyzed your data, you can then use your findings to make good business decisions, improve procedures, and even make informed predictions based on what you’ve discovered.&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;Understand the need for a sound &lt;strong&gt;data analysis workflow&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Understand the &lt;strong&gt;different stages&lt;/strong&gt; of a data analysis workflow&lt;/li&gt;
&lt;li&gt;Learn how you can use &lt;strong&gt;Python&lt;/strong&gt; for data analysis&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Before you start, you should familiarize yourself with &lt;a href=&quot;https://realpython.com/jupyter-notebook-introduction/&quot;&gt;Jupyter Notebook&lt;/a&gt;, a popular tool for data analysis. Alternatively, &lt;a href=&quot;https://realpython.com/using-jupyterlab/&quot;&gt;JupyterLab&lt;/a&gt; will give you an enhanced notebook experience. You might also like to learn how a &lt;a href=&quot;https://realpython.com/pandas-dataframe/#introducing-the-pandas-dataframe&quot;&gt;pandas DataFrame&lt;/a&gt; stores its data. Knowing the difference between a &lt;a href=&quot;https://pandas.pydata.org/docs/user_guide/dsintro.html#dataframe&quot;&gt;DataFrame&lt;/a&gt; and a &lt;a href=&quot;https://pandas.pydata.org/docs/user_guide/dsintro.html#series&quot;&gt;pandas Series&lt;/a&gt; will also prove useful.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-for-data-analysis-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-for-data-analysis-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free data files and sample code&lt;/a&gt; for your mission into data analysis with Python.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In this tutorial, you’ll use a file named &lt;code&gt;james_bond_data.csv&lt;/code&gt;. This is a doctored version of the free &lt;a href=&quot;https://www.kaggle.com/datasets/dreb87/jamesbond/data&quot;&gt;James Bond Movie Dataset&lt;/a&gt;. The &lt;code&gt;james_bond_data.csv&lt;/code&gt; file contains a subset of the original data with some of the records altered to make them suitable for this tutorial. You’ll find it in the downloadable materials. Once you have your data file, you’re ready to begin your first mission into data analysis.&lt;/p&gt;
&lt;h2 id=&quot;understanding-the-need-for-a-data-analysis-workflow&quot;&gt;Understanding the Need for a Data Analysis Workflow&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-the-need-for-a-data-analysis-workflow&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Data analysis is a very popular field and can involve performing many different tasks of varying complexity. Which specific analysis steps you perform will depend on which dataset you’re analyzing and what information you hope to glean. To overcome these scope and complexity issues, you need to take a strategic approach when performing your analysis. This is where a &lt;strong&gt;data analysis workflow&lt;/strong&gt; can help you.&lt;/p&gt;
&lt;p&gt;A data analysis workflow is a process that provides a set of steps for your analysis team to follow when analyzing data. The implementation of each of these steps will vary depending on the nature of your analysis, but following an agreed-upon workflow allows everyone involved to know what needs to happen and to see how the project is progressing.&lt;/p&gt;
&lt;p&gt;Using a workflow also helps futureproof your analysis methodology. By following the defined set of steps, your efforts become systematic, which minimizes the possibility that you’ll make mistakes or miss something. Furthermore, when you carefully document your work, you can reapply your procedures against future data as it becomes available. Data analysis workflows therefore also provide repeatability and scalability.&lt;/p&gt;
&lt;p&gt;There’s no single data workflow process that suits every analysis, nor is there universal terminology for the procedures used within it. To provide a structure for the rest of this tutorial, the diagram below illustrates the stages that you’ll commonly find in most workflows:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/ie-data-analysis-workflowv3.bfb835b95c5e.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/ie-data-analysis-workflowv3.bfb835b95c5e.png&quot; width=&quot;1292&quot; height=&quot;569&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ie-data-analysis-workflowv3.bfb835b95c5e.png&amp;amp;w=323&amp;amp;sig=724ecd4801da97582252a82ecbae17c83aab6c33 323w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ie-data-analysis-workflowv3.bfb835b95c5e.png&amp;amp;w=430&amp;amp;sig=72a4545ee2f4c236e9d7a3b1ec3700ce2b6141c5 430w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ie-data-analysis-workflowv3.bfb835b95c5e.png&amp;amp;w=646&amp;amp;sig=9d2c7db9de6d5a4d0c703ea90b63c2ecb840cd87 646w, https://files.realpython.com/media/ie-data-analysis-workflowv3.bfb835b95c5e.png 1292w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;diagram of a data analysis workflow with iterations&quot; data-asset=&quot;5525&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;A Data Analysis Workflow&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;The solid arrows show the standard data analysis workflow that you’ll work through to learn what happens at each stage. The dashed arrows indicate where you may need to carry out some of the individual steps several times depending upon the success of your analysis. Indeed, you may even have to repeat the entire process should your first analysis reveal something interesting that demands further attention.&lt;/p&gt;
&lt;p&gt;Now that you have an understanding of the need for a data analysis workflow, you’ll work through its steps and perform an analysis of movie data. The movies that you’ll analyze all relate to the British secret agent Bond … &lt;em&gt;James Bond.&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&quot;setting-your-objectives&quot;&gt;Setting Your Objectives&lt;a class=&quot;headerlink&quot; href=&quot;#setting-your-objectives&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The very first workflow step in data analysis is to carefully but clearly define your objectives. It’s vitally important for you and your analysis team to be clear on what exactly you’re all trying to achieve. This step doesn’t involve any programming but is every bit as important because, without an understanding of where you want to go, you’re unlikely to ever get there.&lt;/p&gt;
&lt;p&gt;The objectives of your data analysis will vary depending on what you’re analyzing. Your team leader may want to know why a new product hasn’t sold, or perhaps your government wants information about a clinical test of a new medical drug. You may even be asked to make investment recommendations based on the past results of a particular financial instrument. Regardless, you must still be clear on your objectives. These define your scope.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll gain experience in data analysis by having some fun with the James Bond movie dataset mentioned earlier. What are your objectives? &lt;em&gt;Now pay attention, 007&lt;/em&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Is there any relationship between the Rotten Tomatoes ratings and those from IMDb?&lt;/li&gt;
&lt;li&gt;Are there any insights to be gleaned from analyzing the lengths of the movies?&lt;/li&gt;
&lt;li&gt;Is there a relationship between the number of enemies James Bond has killed and the user ratings of the movie in which they were killed?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now that you’ve been briefed on your mission, it’s time to get out into the field and see what intelligence you can uncover.&lt;/p&gt;
&lt;h2 id=&quot;acquiring-your-data&quot;&gt;Acquiring Your Data&lt;a class=&quot;headerlink&quot; href=&quot;#acquiring-your-data&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Once you’ve established your objectives, your next step is to think about what data you’ll need to achieve them. Hopefully, this data will be readily available, but you may have to work hard to get it. You may need to extract it from the data storage systems within an organization or &lt;a href=&quot;https://en.wikipedia.org/wiki/Survey_data_collection&quot;&gt;collect survey data&lt;/a&gt;. Regardless, you’ll somehow need to get the data.&lt;/p&gt;
&lt;p&gt;In this case, you’re in luck. When your bosses briefed you on your objectives, they also gave you the data in the &lt;code&gt;james_bond_data.csv&lt;/code&gt; file. You must now spend some time becoming familiar with what you have in front of you. During the briefing, you made some notes on the content of this file:&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;Heading&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Release&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The release date of the movie&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Movie&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The title of the movie&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Bond&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The actor playing the title role&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Bond_Car_MFG&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The manufacturer of James Bond’s car&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;US_Gross&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The movie’s gross US earnings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;World_Gross&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The movie’s gross worldwide earnings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Budget ($ 000s)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The movie’s budget, in thousands of US dollars&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Film_Length&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The running time of the movie&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Avg_User_IMDB&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The average user rating from IMDb&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Avg_User_Rtn_Tom&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The average user rating from Rotten Tomatoes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Martinis&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The number of martinis that Bond drank in the movie&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;As you can see, you have quite a variety of data. You won’t need all of it to meet your objectives, but you can think more about this later. For now, you’ll concentrate on getting the data out of the file and into Python for cleansing and analysis.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-for-data-analysis/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-for-data-analysis/ »&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>Create a Tic-Tac-Toe Python Game Engine With an AI Player</title>
      <id>https://realpython.com/courses/python-tic-tac-toe-ai/</id>
      <link href="https://realpython.com/courses/python-tic-tac-toe-ai/"/>
      <updated>2024-01-16T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll create a universal game engine in Python for tic-tac-toe with two computer players, one of which will be an AI player using the powerful minimax algorithm. You&#x27;ll give your game library a text-based graphical interface and explore two front ends.</summary>
      <content type="html">
        &lt;p&gt;A classic childhood game is tic-tac-toe, also known as naughts and crosses. It&amp;rsquo;s simple and enjoyable, and coding a version of it with Python is an exciting project for a budding programmer. Now, adding some artificial intelligence (AI) using Python can make an old favorite even more thrilling.&lt;/p&gt;
&lt;p&gt;In this comprehensive tutorial, you&amp;rsquo;ll construct a flexible game engine. This engine will include an unbeatable computer player that employs the minimax algorithm to play tic-tac-toe flawlessly. Throughout the tutorial, you&amp;rsquo;ll explore concepts such as immutable class design, generic plug-in architecture, and modern Python coding practices and patterns.&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;Develop a reusable &lt;strong&gt;Python library&lt;/strong&gt; containing the tic-tac-toe game engine&lt;/li&gt;
&lt;li&gt;Create a Pythonic code style that accurately models the tic-tac-toe &lt;strong&gt;domain&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Implement various artificial players, including one using the powerful &lt;strong&gt;minimax algorithm&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Construct a text-based &lt;strong&gt;console front end&lt;/strong&gt; for the game, enabling human players to participate&lt;/li&gt;
&lt;li&gt;Discover effective strategies for &lt;strong&gt;optimizing performance&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Are you ready to embark on this step-by-step adventure of building an extensible game engine with an unbeatable AI player using the minimax algorithm?&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>Inheritance and Composition: A Python OOP Guide</title>
      <id>https://realpython.com/inheritance-composition-python/</id>
      <link href="https://realpython.com/inheritance-composition-python/"/>
      <updated>2024-01-15T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn about inheritance and composition in Python. You&#x27;ll improve your object-oriented programming (OOP) skills by understanding how to use inheritance and composition and how to leverage them in their design.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In this tutorial, you’ll explore &lt;strong&gt;inheritance&lt;/strong&gt; and &lt;strong&gt;composition&lt;/strong&gt; in Python. &lt;a href=&quot;https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)&quot;&gt;Inheritance&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Object_composition&quot;&gt;composition&lt;/a&gt; are two important concepts in object-oriented programming that model the relationship between two classes. They’re the building blocks of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented design&lt;/a&gt;, and they help programmers to write reusable code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll know how to&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;inheritance&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Model &lt;strong&gt;class hierarchies&lt;/strong&gt; using inheritance&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;multiple inheritance&lt;/strong&gt; in Python and understand its drawbacks&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;composition&lt;/strong&gt; to create complex objects&lt;/li&gt;
&lt;li&gt;Reuse &lt;strong&gt;existing code&lt;/strong&gt; by applying composition&lt;/li&gt;
&lt;li&gt;Change &lt;strong&gt;application behavior&lt;/strong&gt; at runtime through composition&lt;/li&gt;
&lt;/ul&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/inheritance-composition-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-inheritance-composition-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the free sample code&lt;/a&gt; that shows you how to use inheritance and composition in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;what-are-inheritance-and-composition&quot;&gt;What Are Inheritance and Composition?&lt;a class=&quot;headerlink&quot; href=&quot;#what-are-inheritance-and-composition&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Inheritance&lt;/strong&gt; and &lt;strong&gt;composition&lt;/strong&gt; are two major concepts in object-oriented programming that model the relationship between two classes. They drive the design of an application and determine how the application should evolve as new features are added or requirements change.&lt;/p&gt;
&lt;p&gt;Both of them enable code reuse, but they do it in different ways.&lt;/p&gt;
&lt;h3 id=&quot;whats-inheritance&quot;&gt;What’s Inheritance?&lt;a class=&quot;headerlink&quot; href=&quot;#whats-inheritance&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Inheritance&lt;/strong&gt; models what’s called an &lt;strong&gt;is a&lt;/strong&gt; relationship. This means that when you have a &lt;code&gt;Derived&lt;/code&gt; class that inherits from a &lt;code&gt;Base&lt;/code&gt; class, you’ve created a relationship where &lt;code&gt;Derived&lt;/code&gt; &lt;strong&gt;is a&lt;/strong&gt; specialized version of &lt;code&gt;Base&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Inheritance is represented using the &lt;a href=&quot;https://www.uml.org/&quot;&gt;Unified Modeling Language&lt;/a&gt;, or UML, in the following way:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/ic-basic-inheritance.f8dc9ffee4d7.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-33&quot; src=&quot;https://files.realpython.com/media/ic-basic-inheritance.f8dc9ffee4d7.jpg&quot; width=&quot;242&quot; height=&quot;343&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ic-basic-inheritance.f8dc9ffee4d7.jpg&amp;amp;w=60&amp;amp;sig=5b8ced824343b1ab983944639b080f1fb53c0ba4 60w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ic-basic-inheritance.f8dc9ffee4d7.jpg&amp;amp;w=80&amp;amp;sig=5e6602bc30ff4fd7787c539aef8c1dc20da4b070 80w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ic-basic-inheritance.f8dc9ffee4d7.jpg&amp;amp;w=121&amp;amp;sig=e32f6166c127193b0856fcb61f9d2677ff7aa293 121w, https://files.realpython.com/media/ic-basic-inheritance.f8dc9ffee4d7.jpg 242w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Basic inheritance between Base and Derived classes&quot; data-asset=&quot;1494&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;This model represents classes as boxes with the class name on top. It represents the inheritance relationship with an arrow from the derived class pointing to the base class. The word &lt;strong&gt;extends&lt;/strong&gt; is usually added to the arrow.&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 an inheritance relationship:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Classes that inherit from another are called derived classes, subclasses, or subtypes. &lt;/li&gt;
&lt;li&gt;Classes from which other classes are derived are called base classes or super classes. &lt;/li&gt;
&lt;li&gt;A derived class is said to derive, inherit, or extend a base class.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;Say you have the base class &lt;code&gt;Animal&lt;/code&gt;, and you derive from it to create a &lt;code&gt;Horse&lt;/code&gt; class. The inheritance relationship states that &lt;code&gt;Horse&lt;/code&gt; &lt;strong&gt;is an&lt;/strong&gt; &lt;code&gt;Animal&lt;/code&gt;. This means that &lt;code&gt;Horse&lt;/code&gt; inherits the &lt;a href=&quot;https://realpython.com/python-interface/&quot;&gt;interface&lt;/a&gt; and implementation of &lt;code&gt;Animal&lt;/code&gt;, and you can use &lt;code&gt;Horse&lt;/code&gt; objects to replace &lt;code&gt;Animal&lt;/code&gt; objects in the application.&lt;/p&gt;
&lt;p&gt;This is known as the &lt;a href=&quot;https://realpython.com/solid-principles-python/#liskov-substitution-principle-lsp&quot;&gt;Liskov substitution principle&lt;/a&gt;. The principle states that if &lt;code&gt;S&lt;/code&gt; is a subtype of &lt;code&gt;T&lt;/code&gt;, then replacing objects of type &lt;code&gt;T&lt;/code&gt; with objects of type &lt;code&gt;S&lt;/code&gt; doesn’t change the program’s behavior.&lt;/p&gt;
&lt;p&gt;You’ll see in this tutorial why you should always follow the Liskov substitution principle when creating your class hierarchies, and you’ll learn about the problems that you’ll run into if you don’t.&lt;/p&gt;
&lt;h3 id=&quot;whats-composition&quot;&gt;What’s Composition?&lt;a class=&quot;headerlink&quot; href=&quot;#whats-composition&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Composition&lt;/strong&gt; is a concept that models a &lt;strong&gt;has a&lt;/strong&gt; relationship. It enables creating complex types by combining objects of other types. This means that a class &lt;code&gt;Composite&lt;/code&gt; can contain an object of another class &lt;code&gt;Component&lt;/code&gt;. This relationship means that a &lt;code&gt;Composite&lt;/code&gt; &lt;strong&gt;has a&lt;/strong&gt; &lt;code&gt;Component&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;UML represents composition as follows:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/ic-basic-composition.8a15876f7db2.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-33&quot; src=&quot;https://files.realpython.com/media/ic-basic-composition.8a15876f7db2.jpg&quot; width=&quot;249&quot; height=&quot;348&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ic-basic-composition.8a15876f7db2.jpg&amp;amp;w=62&amp;amp;sig=fe9cee54da335ac7d82f147d947f595d9063864f 62w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ic-basic-composition.8a15876f7db2.jpg&amp;amp;w=83&amp;amp;sig=fac3b566e318f0473aeaaaca93cab529951ed52c 83w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ic-basic-composition.8a15876f7db2.jpg&amp;amp;w=124&amp;amp;sig=28fd4da7064494aa88f126b3b073aaab8a500b61 124w, https://files.realpython.com/media/ic-basic-composition.8a15876f7db2.jpg 249w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Basic composition between Composite and Component classes&quot; data-asset=&quot;1493&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;The model represents composition through a line that starts with a diamond at the composite class and points to the component class. The composite side can express the cardinality of the relationship. The &lt;strong&gt;cardinality&lt;/strong&gt; indicates the number or the valid range of &lt;code&gt;Component&lt;/code&gt; instances that the &lt;code&gt;Composite&lt;/code&gt; class will contain.&lt;/p&gt;
&lt;p&gt;In the diagram above, the &lt;code&gt;1&lt;/code&gt; represents that the &lt;code&gt;Composite&lt;/code&gt; class contains one object of type &lt;code&gt;Component&lt;/code&gt;. You can express cardinality in the following ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A number&lt;/strong&gt; indicates the number of &lt;code&gt;Component&lt;/code&gt; instances that &lt;code&gt;Composite&lt;/code&gt; contains.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The * symbol&lt;/strong&gt; indicates that the &lt;code&gt;Composite&lt;/code&gt; class can contain a variable number of &lt;code&gt;Component&lt;/code&gt; instances.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A range 1..4&lt;/strong&gt; indicates that the &lt;code&gt;Composite&lt;/code&gt; class can contain a range of &lt;code&gt;Component&lt;/code&gt; instances. You indicate the range with the minimum and maximum number of instances, or minimum and many instances like in &lt;strong&gt;1..*&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Classes that contain objects of other classes are usually referred to as composites, while classes that are used to create more complex types are referred to as components.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;For example, your &lt;code&gt;Horse&lt;/code&gt; class can be composed by another object of type &lt;code&gt;Tail&lt;/code&gt;. Composition allows you to express that relationship by saying &lt;code&gt;Horse&lt;/code&gt; &lt;strong&gt;has a&lt;/strong&gt; &lt;code&gt;Tail&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/inheritance-composition-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/inheritance-composition-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 #187: Serializing Data With Python &amp; Underscore Naming Conventions</title>
      <id>https://realpython.com/podcasts/rpp/187/</id>
      <link href="https://realpython.com/podcasts/rpp/187/"/>
      <updated>2024-01-12T12:00:00+00:00</updated>
      <summary>Do you need to transfer an extensive data collection for a science project? What&#x27;s the best way to send executable code over the wire for distributed processing? What are the different ways to serialize data 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;Do you need to transfer an extensive data collection for a science project? What&#x27;s the best way to send executable code over the wire for distributed processing? What are the different ways to serialize data 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>Python range(): Represent Numerical Ranges</title>
      <id>https://realpython.com/python-range/</id>
      <link href="https://realpython.com/python-range/"/>
      <updated>2024-01-10T14:00:00+00:00</updated>
      <summary>Master the Python range() function and learn how it works under the hood. You most commonly use ranges in loops. In this tutorial, you&#x27;ll learn how to iterate over ranges but also identify when there are better alternatives.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;A &lt;code&gt;range&lt;/code&gt; is a Python object that represents an interval of integers. Usually, the numbers are consecutive, but you can also specify that you want to space them out. You can create ranges by calling &lt;code&gt;range()&lt;/code&gt; with one, two, or three arguments, as the following examples show:&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;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[0, 1, 2, 3, 4]&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[1, 2, 3, 4, 5, 6]&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&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;go&quot;&gt;[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]&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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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 each example, you use &lt;a href=&quot;https://realpython.com/python-list/#using-the-list-constructor&quot;&gt;&lt;code&gt;list()&lt;/code&gt;&lt;/a&gt; to explicitly list the individual elements of each range. You’ll study these examples in more detail soon.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how you can:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create &lt;code&gt;range&lt;/code&gt; objects that represent ranges of &lt;strong&gt;consecutive integers&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Represent ranges of &lt;strong&gt;spaced-out numbers&lt;/strong&gt; with a fixed step&lt;/li&gt;
&lt;li&gt;Decide when &lt;code&gt;range&lt;/code&gt; is a &lt;strong&gt;good solution&lt;/strong&gt; for your use case&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Avoid &lt;code&gt;range&lt;/code&gt;&lt;/strong&gt; in most loops&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A &lt;code&gt;range&lt;/code&gt; can sometimes be a powerful tool. However, throughout this tutorial, you’ll also explore alternatives that may work better in some situations. You can click the link below to download the code that you’ll see in this tutorial:&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-range-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-range-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 represent numerical ranges in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;construct-numerical-ranges&quot;&gt;Construct Numerical Ranges&lt;a class=&quot;headerlink&quot; href=&quot;#construct-numerical-ranges&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Python, &lt;code&gt;range()&lt;/code&gt; is &lt;strong&gt;built in&lt;/strong&gt;. This means that you can always call &lt;code&gt;range()&lt;/code&gt; without doing any preparations first. Calling &lt;code&gt;range()&lt;/code&gt; constructs a &lt;strong&gt;range object&lt;/strong&gt; that you can put to use. Later, you’ll see practical examples of how to use range objects.&lt;/p&gt;
&lt;p&gt;You can provide &lt;code&gt;range()&lt;/code&gt; with one, two, or three &lt;strong&gt;integer&lt;/strong&gt; arguments. This corresponds to three different use cases:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Ranges counting from zero&lt;/li&gt;
&lt;li&gt;Ranges of consecutive numbers&lt;/li&gt;
&lt;li&gt;Ranges stepping over numbers&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You’ll learn how to use each of these next.&lt;/p&gt;
&lt;h3 id=&quot;count-from-zero&quot;&gt;Count From Zero&lt;a class=&quot;headerlink&quot; href=&quot;#count-from-zero&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When you call &lt;code&gt;range()&lt;/code&gt; with one argument, you create a range that counts from zero and up to, but not including, the number you provided:&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;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;range(0, 5)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;Here, you’ve created a range from zero to five. To see the individual elements in the range, you can use &lt;code&gt;list()&lt;/code&gt; to convert the range to a &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;list&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[0, 1, 2, 3, 4]&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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;Inspecting &lt;code&gt;range(5)&lt;/code&gt; shows that it contains the numbers zero, one, two, three, and four. Five itself is not a part of the range. One nice property of these ranges is that the argument, &lt;code&gt;5&lt;/code&gt; in this case, is the same as the number of elements in the range.&lt;/p&gt;
&lt;h3 id=&quot;count-from-start-to-stop&quot;&gt;Count From Start to Stop&lt;a class=&quot;headerlink&quot; href=&quot;#count-from-start-to-stop&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can call &lt;code&gt;range()&lt;/code&gt; with two arguments. The first value will be the start of the range. As before, the range will count up to, but not include, the second value:&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;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;range(1, 7)&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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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 representation of a range object just shows you the arguments that you provided, so it’s not super helpful in this case. You can use &lt;code&gt;list()&lt;/code&gt; to inspect the individual elements:&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;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[1, 2, 3, 4, 5, 6]&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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;Observe that &lt;code&gt;range(1, 7)&lt;/code&gt; starts at one and includes the consecutive numbers up to six. Seven is the limit of the range and isn’t included. You can calculate the number of elements in a range by subtracting the start value from the end value. In this example, there are &lt;em&gt;7 - 1 = 6&lt;/em&gt; elements.&lt;/p&gt;
&lt;h3 id=&quot;count-from-start-to-stop-while-stepping-over-numbers&quot;&gt;Count From Start to Stop While Stepping Over Numbers&lt;a class=&quot;headerlink&quot; href=&quot;#count-from-start-to-stop-while-stepping-over-numbers&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-range/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-range/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Basics Exercises: Functions and Loops</title>
      <id>https://realpython.com/courses/python-exercises-functions-loops/</id>
      <link href="https://realpython.com/courses/python-exercises-functions-loops/"/>
      <updated>2024-01-09T14:00:00+00:00</updated>
      <summary>In this Python Basics Exercises course, you&#x27;ll practice creating user-defined functions that you can execute multiple times in your code. Additionally, you&#x27;ll gain experience in repeating code using for and while loops.</summary>
      <content type="html">
        &lt;p&gt;As you learned in &lt;a href=&quot;https://realpython.com/courses/python-basics-functions-loops/&quot;&gt;Python Basics: Functions and Loops&lt;/a&gt;, functions serve as the fundamental building blocks in almost every Python program. They&amp;rsquo;re where the real action happens!&lt;/p&gt;
&lt;p&gt;You now know that functions are crucial for breaking down code into smaller, manageable chunks. They enable you to define actions that your program can execute repeatedly throughout your code. Instead of duplicating the same code whenever your program needs to accomplish a particular task, you can simply call the function.&lt;/p&gt;
&lt;p&gt;However, there are instances when you need to repeat certain code multiple times in a row. This is where loops become invaluable.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this Python Basics Exercises video course, you&amp;rsquo;ll practice:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Creating &lt;strong&gt;user-defined functions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Implementing &lt;strong&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Getting &lt;strong&gt;user input&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rounding&lt;/strong&gt; numbers&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This video course is part of the Python Basics series, which accompanies &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. You can also check out the other &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics courses&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Note that you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt; throughout this course.&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>Learn From 2023&#x27;s Most Popular Python Tutorials and Courses</title>
      <id>https://realpython.com/popular-python-tutorials-2023/</id>
      <link href="https://realpython.com/popular-python-tutorials-2023/"/>
      <updated>2024-01-08T14:00:00+00:00</updated>
      <summary>Revisit your favorite Real Python tutorials and video courses from 2023. Explore various topics, from Python basics to web development, machine learning, and effective coding environments. It&#x27;s been a busy year of learning, and there&#x27;s something for everyone to discover and build upon in 2024.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python is always getting better, and 2023 brought a number of exciting developments. As part of the &lt;a href=&quot;https://github.com/faster-cpython&quot;&gt;Faster CPython&lt;/a&gt; project, &lt;a href=&quot;https://realpython.com/python312-new-features/&quot;&gt;Python 3.12&lt;/a&gt; is speedier than previous versions. The new release brings &lt;a href=&quot;https://realpython.com/python312-error-messages/&quot;&gt;improved error messages&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python312-f-strings/&quot;&gt;more powerful f-strings&lt;/a&gt;. You can also enjoy &lt;a href=&quot;https://realpython.com/python312-perf-profiler/&quot;&gt;support for the Linux &lt;code&gt;perf&lt;/code&gt; profiler&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python312-typing/&quot;&gt;static typing improvements&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python312-subinterpreters/&quot;&gt;changes to subinterpreters&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The Python Software Foundation (PSF) focused on enhancing security in 2023, with the help of inaugural &lt;a href=&quot;https://realpython.com/podcasts/rpp/177/&quot;&gt;Security Developer-in-Residence Seth Michael Larson&lt;/a&gt;. As part of this comprehensive effort, PyPI completed its &lt;a href=&quot;https://blog.pypi.org/posts/2023-11-14-1-pypi-completes-first-security-audit/&quot;&gt;first security audit&lt;/a&gt;. Plus, the year brought new major versions of &lt;a href=&quot;https://realpython.com/learning-paths/pandas-data-science/&quot;&gt;pandas&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/tutorials/django/&quot;&gt;Django&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-news-june-2023/#pydantic-2-released&quot;&gt;Pydantic&lt;/a&gt;. Another exciting development was &lt;a href=&quot;https://realpython.com/python-news-september-2023/#modular-releases-mojo-sdk-for-linux&quot;&gt;Mojo&lt;/a&gt;, a superset of Python that’s specifically designed for use in machine-learning contexts.&lt;/p&gt;
&lt;p&gt;Here at Real Python, we’ve published over a hundred written tutorials and video courses this year, plus weekly &lt;a href=&quot;https://realpython.com/podcasts/rpp/&quot;&gt;podcast&lt;/a&gt; episodes. Keep reading to revisit an old favorite or embark on a new learning journey. You can also check out the &lt;a href=&quot;https://realpython.com/podcasts/rpp/185/&quot;&gt;wrap-up podcast episode&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Join Now:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-newsletter&quot; data-focus=&quot;false&quot;&gt;Click here to join the Real Python Newsletter&lt;/a&gt; and you&#x27;ll never miss another Python tutorial, course update, or post.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;practice-your-skills&quot;&gt;Practice Your Skills&lt;a class=&quot;headerlink&quot; href=&quot;#practice-your-skills&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid w-33 float-right ml-3 mt-3 mb-3 rounded&quot; src=&quot;https://files.realpython.com/media/Object-Oriented-Programming-OOP_Watermarked.df1bfba08d93.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Object-Oriented-Programming-OOP_Watermarked.df1bfba08d93.jpg&amp;amp;w=480&amp;amp;sig=f71ffce11415f5a49f809b3d7f12390dbc87a559 480w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Object-Oriented-Programming-OOP_Watermarked.df1bfba08d93.jpg&amp;amp;w=640&amp;amp;sig=a03f9cb95d1b368a8cc3b53c7bdd52722475def5 640w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Object-Oriented-Programming-OOP_Watermarked.df1bfba08d93.jpg&amp;amp;w=960&amp;amp;sig=a7728a6072626f05c24c60e6971762ad75c6ad43 960w, https://files.realpython.com/media/Object-Oriented-Programming-OOP_Watermarked.df1bfba08d93.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Python Basics: Object-Oriented Programming&quot; data-asset=&quot;4819&quot;&gt;&lt;/figure&gt;

&lt;p&gt;Practice makes perfect, especially when it comes to programming. This year, the Real Python team expanded the &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics&lt;/a&gt; learning path with exercises designed to strengthen your Python skills and help you apply your knowledge in real-world scenarios. &lt;/p&gt;
&lt;p&gt;In these courses, you can test your knowledge by completing review exercises and challenges before comparing your work to the instructors’ solutions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/numbers-and-math-exercises/&quot;&gt;Python Basics Exercises: Numbers and Math&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/object-oriented-programming-exercises/&quot;&gt;Python Basics Exercises: Object-Oriented Programming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/python-modules-packages-exercises/&quot;&gt;Python Basics Exercises: Modules and Packages&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By actively engaging with these exercises, you’ll solidify your understanding of Python concepts and build confidence in your programming abilities. Another way to test your knowledge is by taking &lt;a href=&quot;https://realpython.com/quizzes/&quot;&gt;quizzes&lt;/a&gt;, and we added several in 2023. For help along the way, be sure to join Real Python’s &lt;a href=&quot;https://realpython.com/community/&quot;&gt;community chat&lt;/a&gt; and weekly &lt;a href=&quot;https://realpython.com/office-hours/&quot;&gt;office hours&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;customize-your-coding-environment&quot;&gt;Customize Your Coding Environment&lt;a class=&quot;headerlink&quot; href=&quot;#customize-your-coding-environment&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid w-33 float-right ml-3 mt-3 mb-3 rounded&quot; src=&quot;https://files.realpython.com/media/How-to-Choose-a-Programming-Font-for-Python_Watermarked.2d22196d7347.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/How-to-Choose-a-Programming-Font-for-Python_Watermarked.2d22196d7347.jpg&amp;amp;w=480&amp;amp;sig=f8f118caa713e1c99e6a6db462d2fc09f4f9d089 480w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/How-to-Choose-a-Programming-Font-for-Python_Watermarked.2d22196d7347.jpg&amp;amp;w=640&amp;amp;sig=c052a0fb298cef7f9aff004fb6f9b824fe4e2d3f 640w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/How-to-Choose-a-Programming-Font-for-Python_Watermarked.2d22196d7347.jpg&amp;amp;w=960&amp;amp;sig=af70abc7005a73d5f101aae9e1fd7771d11f9e3c 960w, https://files.realpython.com/media/How-to-Choose-a-Programming-Font-for-Python_Watermarked.2d22196d7347.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Choosing the Best Coding Font for Programming&quot; data-asset=&quot;5176&quot;&gt;&lt;/figure&gt;

&lt;p&gt;Your coding environment plays a crucial role in your productivity as a programmer, so it’s definitely worthwhile to explore your options and make yourself at home. That means picking the perfect &lt;a href=&quot;https://realpython.com/python-ides-code-editors-guide/&quot;&gt;editor or IDE&lt;/a&gt; for your use case and then tweaking how it works for you.&lt;/p&gt;
&lt;p&gt;In these tutorials, you’ll learn how to customize your coding environment to suit your needs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/ptpython-shell/&quot;&gt;Boost Your Coding Productivity With Ptpython&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/coding-font/&quot;&gt;Choosing the Best Coding Font for Programming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/using-jupyterlab/&quot;&gt;JupyterLab for an Enhanced Notebook Experience&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By exploring these resources, you’ll discover &lt;a href=&quot;https://realpython.com/tutorials/tools/&quot;&gt;tools&lt;/a&gt; and techniques that can enhance your coding experience, making you more efficient and comfortable as you write Python code.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/popular-python-tutorials-2023/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/popular-python-tutorials-2023/ »&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 #186: Exploring Python in Excel</title>
      <id>https://realpython.com/podcasts/rpp/186/</id>
      <link href="https://realpython.com/podcasts/rpp/186/"/>
      <updated>2024-01-05T12:00:00+00:00</updated>
      <summary>Are you interested in using your Python skills within Excel? Would you like to share a data science project or visualization as a single Office file? This week on the show, we speak with Principal Architect John Lam and Sr. Cloud Developer Advocate Sarah Kaiser from Microsoft about Python in Excel.</summary>
      <content type="html">
        &lt;p&gt;Are you interested in using your Python skills within Excel? Would you like to share a data science project or visualization as a single Office file? This week on the show, we speak with Principal Architect John Lam and Sr. Cloud Developer Advocate Sarah Kaiser from Microsoft about Python in Excel.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s Magic Methods: Leverage Their Power in Your Classes</title>
      <id>https://realpython.com/python-magic-methods/</id>
      <link href="https://realpython.com/python-magic-methods/"/>
      <updated>2024-01-03T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn what magic methods are in Python, how they work, and how to use them in your custom classes to support powerful features in your object-oriented code.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;As a Python developer who wants to harness the power of object-oriented programming, you’ll love to learn how to customize your classes using &lt;strong&gt;special methods&lt;/strong&gt;, also known as &lt;strong&gt;magic methods&lt;/strong&gt; or &lt;strong&gt;dunder methods&lt;/strong&gt;. A special method is a method whose name starts and ends with a double underscore. These methods have special meanings for Python.&lt;/p&gt;
&lt;p&gt;Python automatically calls magic methods as a response to certain operations, such as instantiation, sequence indexing, attribute managing, and much more. Magic methods support core object-oriented features in Python, so learning about them is fundamental for you as a Python programmer.&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 Python’s &lt;strong&gt;special&lt;/strong&gt; or &lt;strong&gt;magic methods&lt;/strong&gt; are&lt;/li&gt;
&lt;li&gt;Understand the &lt;strong&gt;magic&lt;/strong&gt; behind magic methods in Python&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Customize&lt;/strong&gt; different &lt;strong&gt;behaviors&lt;/strong&gt; of your custom classes with special methods&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should be familiar with general Python programming. More importantly, you should know the basics of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt; in Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-magic-methods-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-magic-methods-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 magic methods in your classes.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;getting-to-know-pythons-magic-or-special-methods&quot;&gt;Getting to Know Python’s Magic or Special Methods&lt;a class=&quot;headerlink&quot; href=&quot;#getting-to-know-pythons-magic-or-special-methods&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Python, &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-special-method&quot;&gt;special methods&lt;/a&gt; are also called &lt;strong&gt;magic methods&lt;/strong&gt;, or &lt;strong&gt;dunder methods&lt;/strong&gt;. This latter terminology, &lt;a href=&quot;https://realpython.com/python-double-underscore/#dunder-names-in-python&quot;&gt;dunder&lt;/a&gt;, refers to a particular naming convention that Python uses to name its special &lt;a href=&quot;https://realpython.com/python-classes/#providing-behavior-with-methods&quot;&gt;methods&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-classes/#attaching-data-to-classes-and-instances&quot;&gt;attributes&lt;/a&gt;. The convention is to use double leading and trailing underscores in the name at hand, so it looks like &lt;code&gt;.__method__()&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; In this tutorial, you’ll find the terms &lt;strong&gt;special methods&lt;/strong&gt;, &lt;strong&gt;dunder methods&lt;/strong&gt;, and &lt;strong&gt;magic methods&lt;/strong&gt; used interchangeably.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The double underscores flag these methods as core to some Python features. They help avoid name collisions with your own methods and attributes. Some popular and well-known magic methods include the following:&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;Special Method&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;https://realpython.com/python-class-constructor/#object-initialization-with-__init__&quot;&gt;&lt;code&gt;.__init__()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Provides an initializer in Python classes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;https://realpython.com/python-repr-vs-str/&quot;&gt;&lt;code&gt;.__str__()&lt;/code&gt; and &lt;code&gt;.__repr__()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Provide string representations for objects&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;https://realpython.com/python-callable-instances/&quot;&gt;&lt;code&gt;.__call__()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Makes the instances of a class callable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;https://realpython.com/len-python-function/&quot;&gt;&lt;code&gt;.__len__()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Supports the &lt;a href=&quot;https://realpython.com/len-python-function/&quot;&gt;&lt;code&gt;len()&lt;/code&gt;&lt;/a&gt; function&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;This is just a tiny sample of all the special methods that Python has. All these methods support specific features that are core to Python and its object-oriented infrastructure.&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; For the complete list of magic methods, refer to the &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#specialnames&quot;&gt;special method section&lt;/a&gt; on the data model page of Python’s official documentation.&lt;/p&gt;
&lt;p&gt;The Python documentation organizes the methods into several distinct groups:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#basic-customization&quot;&gt;Basic customization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#customizing-attribute-access&quot;&gt;Customizing attribute access&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#customizing-class-creation&quot;&gt;Customizing class creation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#customizing-instance-and-subclass-checks&quot;&gt;Customizing instance and subclass checks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#emulating-generic-types&quot;&gt;Emulating generic types&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#emulating-callable-objects&quot;&gt;Emulating callable objects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#emulating-container-types&quot;&gt;Emulating container types&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types&quot;&gt;Emulating numeric types&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#with-statement-context-managers&quot;&gt;&lt;code&gt;with&lt;/code&gt; statement context managers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#customizing-positional-arguments-in-class-pattern-matching&quot;&gt;Customizing positional arguments in class pattern matching&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#emulating-buffer-types&quot;&gt;Emulating buffer types&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#special-method-lookup&quot;&gt;Special method lookup&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Take a look at the documentation for more details on how the methods work and how to use them according to your specific needs.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Here’s how the Python documentation defines the term &lt;strong&gt;special methods&lt;/strong&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A method that is called implicitly by Python to execute a certain operation on a type, such as addition. Such methods have names starting and ending with double underscores. (&lt;a href=&quot;https://docs.python.org/3/glossary.html#term-special-method&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There’s an important detail to highlight in this definition. &lt;em&gt;Python implicitly calls special methods to execute certain operations in your code&lt;/em&gt;. For example, when you run the addition &lt;code&gt;5 + 2&lt;/code&gt; in a &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;REPL&lt;/a&gt; session, Python internally runs the following code under the hood:&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;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;fm&quot;&gt;__add__&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;go&quot;&gt;7&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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.55e8f03acfe3.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;code&gt;.__add__()&lt;/code&gt; special method of integer numbers supports the addition that you typically run as &lt;code&gt;5 + 2&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Reading between the lines, you’ll realize that even though you can directly call special methods, they’re not intended for direct use. You shouldn’t call them directly in your code. Instead, you should rely on Python to call them automatically in response to a given operation.&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; Even though special methods are also called &lt;em&gt;magic methods&lt;/em&gt;, some people in the Python community may not like this latter terminology. The only magic around these methods is that Python calls them implicitly under the hood. So, the official documentation refers to them as &lt;strong&gt;special methods&lt;/strong&gt; instead.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Magic methods exist for many purposes. All the available magic methods support built-in features and play specific roles in the language. For example, built-in types such as &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;lists&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionaries&lt;/a&gt; implement most of their core functionality using magic methods. In your custom classes, you can use magic methods to make callable objects, define how objects are compared, tweak how you create objects, and more.&lt;/p&gt;
&lt;p&gt;Note that because magic methods have special meaning for Python itself, you should avoid naming custom methods using leading and trailing double underscores. Your custom method won’t trigger any Python action if its name doesn’t match any official special method names, but it’ll certainly confuse other programmers. New dunder names may also be introduced in future versions of Python.&lt;/p&gt;
&lt;p&gt;Magic methods are core to Python’s &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html&quot;&gt;data model&lt;/a&gt; and are a fundamental part of object-oriented programming in Python. In the following sections, you’ll learn about some of the most commonly used special methods. They’ll help you write better object-oriented code in your day-to-day programming adventure.&lt;/p&gt;
&lt;h2 id=&quot;controlling-the-object-creation-process&quot;&gt;Controlling the Object Creation Process&lt;a class=&quot;headerlink&quot; href=&quot;#controlling-the-object-creation-process&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When creating custom classes in Python, probably the first and most common method that you implement is &lt;code&gt;.__init__()&lt;/code&gt;. This method works as an &lt;strong&gt;initializer&lt;/strong&gt; because it allows you to provide initial values to any &lt;a href=&quot;https://realpython.com/python-classes/#instance-attributes&quot;&gt;instance attributes&lt;/a&gt; that you define in your classes.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-magic-methods/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-magic-methods/ »&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>HTTP Requests With Python&#x27;s urllib.request</title>
      <id>https://realpython.com/courses/python-urllib-request/</id>
      <link href="https://realpython.com/courses/python-urllib-request/"/>
      <updated>2024-01-02T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll explore how to make HTTP requests using Python&#x27;s handy built-in module, urllib.request. You&#x27;ll try out examples and go over common errors, all while learning more about HTTP requests and Python in general.</summary>
      <content type="html">
        &lt;p&gt;If you need to perform HTTP requests using Python, then the widely used &lt;a href=&quot;https://docs.python-requests.org/en/latest/&quot;&gt;Requests&lt;/a&gt; library is often the way to go. However, if you prefer to use only standard-library Python and minimize dependencies, then you can turn to &lt;code&gt;urllib.request&lt;/code&gt; instead.&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;Learn the essentials of making basic &lt;a href=&quot;https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_and_response_messages_through_connections&quot;&gt;HTTP requests&lt;/a&gt; with &lt;code&gt;urllib.request&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Explore the inner workings of an &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages&quot;&gt;HTTP message&lt;/a&gt; and how &lt;code&gt;urllib.request&lt;/code&gt; represents it&lt;/li&gt;
&lt;li&gt;Grasp the concept of handling &lt;strong&gt;character encodings&lt;/strong&gt; in HTTP messages&lt;/li&gt;
&lt;li&gt;Understand common hiccups when using &lt;code&gt;urllib.request&lt;/code&gt; and learn how to resolve them&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you&amp;rsquo;re already familiar with HTTP requests such as &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET&quot;&gt;GET&lt;/a&gt; and &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST&quot;&gt;POST&lt;/a&gt;, then you&amp;rsquo;re well prepared for this video course. Additionally, you should have prior experience using Python to &lt;a href=&quot;https://realpython.com/read-write-files-python/&quot;&gt;read and write files&lt;/a&gt;, ideally using a &lt;a href=&quot;https://realpython.com/python-with-statement/&quot;&gt;context manager&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In the end, you&amp;rsquo;ll discover that making HTTP requests doesn&amp;rsquo;t have to be a frustrating experience, despite its reputation. Many of the challenges people face in this process stem from the inherent complexity of the Internet. The good news is that the &lt;code&gt;urllib.request&lt;/code&gt; module can help demystify much of this complexity.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s Array: Working With Numeric Data Efficiently</title>
      <id>https://realpython.com/python-array/</id>
      <link href="https://realpython.com/python-array/"/>
      <updated>2024-01-01T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll dive deep into working with numeric arrays in Python, an efficient tool for handling binary data. Along the way, you&#x27;ll explore low-level data types exposed by the array module, emulate custom types, and even pass a Python array to C for high-performance processing.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;When you start your programming adventure, one of the most fundamental concepts that you encounter early on is the &lt;strong&gt;array&lt;/strong&gt;. If you’ve recently switched to Python from another programming language, then you might be surprised that arrays are nowhere to be found as a built-in syntactical construct in Python. Instead of arrays, you typically use &lt;strong&gt;lists&lt;/strong&gt;, which are slightly different and more flexible than classic arrays.&lt;/p&gt;
&lt;p&gt;That said, Python ships with the lesser-known &lt;code&gt;array&lt;/code&gt; module in its standard library, providing a specialized sequence type that can help you process &lt;strong&gt;binary data&lt;/strong&gt;. Because it’s not as widely used or well documented as other sequences, there are many misconceptions surrounding the use of the &lt;code&gt;array&lt;/code&gt; module. After reading this tutorial, you’ll have a clear idea of when to use Python’s &lt;code&gt;array&lt;/code&gt; module and the corresponding data type that it provides.&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;Create &lt;strong&gt;homogeneous arrays&lt;/strong&gt; of numbers in Python&lt;/li&gt;
&lt;li&gt;Modify &lt;strong&gt;numeric arrays&lt;/strong&gt; just like any other sequence&lt;/li&gt;
&lt;li&gt;Convert between arrays and other &lt;strong&gt;data types&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Choose the right &lt;strong&gt;type code&lt;/strong&gt; for Python arrays&lt;/li&gt;
&lt;li&gt;Emulate &lt;strong&gt;nonstandard types&lt;/strong&gt; in arrays&lt;/li&gt;
&lt;li&gt;Pass a Python array’s &lt;strong&gt;pointer&lt;/strong&gt; to a C function&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Before you dive in, you may want to brush up on your knowledge of manipulating Python sequences like &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;lists&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-tuple/&quot;&gt;tuples&lt;/a&gt;, defining custom &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-data-classes/&quot;&gt;data classes&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/working-with-files-in-python/&quot;&gt;working with files&lt;/a&gt;. Ideally, you should be familiar with &lt;a href=&quot;https://realpython.com/python-bitwise-operators/&quot;&gt;bitwise operators&lt;/a&gt; and be able to handle binary data in Python.&lt;/p&gt;
&lt;p&gt;You can download the complete source code and other resources mentioned in this tutorial by clicking the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-array-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-array-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free source code&lt;/a&gt; that shows you how to use Python’s &lt;code&gt;array&lt;/code&gt; with your numeric data.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;understanding-arrays-in-programming&quot;&gt;Understanding Arrays in Programming&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-arrays-in-programming&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Some developers treat arrays and Python’s lists as synonymous. Others argue that Python doesn’t have traditional arrays, as seen in languages like &lt;a href=&quot;https://realpython.com/c-for-python-programmers/&quot;&gt;C&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-vs-cpp/&quot;&gt;C++&lt;/a&gt;, or &lt;a href=&quot;https://realpython.com/java-vs-python/&quot;&gt;Java&lt;/a&gt;. In this brief section, you’ll try to answer whether Python has arrays.&lt;/p&gt;
&lt;h3 id=&quot;arrays-in-computer-science&quot;&gt;Arrays in Computer Science&lt;a class=&quot;headerlink&quot; href=&quot;#arrays-in-computer-science&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To understand arrays better, it helps to zoom out a bit and look at them through the lens of theory. This will clarify some baseline terminology, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Abstract data types&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Data structures&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Data types&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Computer science models collections of data as &lt;a href=&quot;https://en.wikipedia.org/wiki/Abstract_data_type&quot;&gt;abstract data types (ADTs)&lt;/a&gt; that support certain operations like insertion or deletion of elements. These operations must satisfy additional constraints that describe the abstract data type’s unique behaviors.&lt;/p&gt;
&lt;p&gt;The word &lt;em&gt;abstract&lt;/em&gt; in this context means these data types leave the implementation details up to you, only defining the expected semantics or the set of available operations that an ADT must support. As a result, you can often represent one abstract data type using a few alternative &lt;a href=&quot;https://en.wikipedia.org/wiki/Data_structure&quot;&gt;data structures&lt;/a&gt;, which are concrete implementations of the same conceptual approach to organizing data.&lt;/p&gt;
&lt;p&gt;Programming languages usually provide a few data structures in the form of built-in &lt;a href=&quot;https://en.wikipedia.org/wiki/Data_type&quot;&gt;data types&lt;/a&gt; as a convenience so that you don’t have to implement them yourself. This means you can focus on solving more abstract problems instead of starting from scratch every time. For example, the Python &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;&lt;code&gt;dict&lt;/code&gt;&lt;/a&gt; data type is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Hash_table&quot;&gt;hash table&lt;/a&gt; data structure that implements the &lt;a href=&quot;https://en.wikipedia.org/wiki/Associative_array&quot;&gt;dictionary&lt;/a&gt; abstract data type.&lt;/p&gt;
&lt;p&gt;To reiterate the meaning of these terms, &lt;strong&gt;abstract data types&lt;/strong&gt; define the desired semantics, &lt;strong&gt;data structures&lt;/strong&gt; implement them, and &lt;strong&gt;data types&lt;/strong&gt; represent data structures in programming languages as built-in syntactic constructs.&lt;/p&gt;
&lt;p&gt;Some of the most common examples of abstract data types include these:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-hash-table/#hash-table-vs-dictionary&quot;&gt;Dictionaries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-maze-solver/#install-the-networkx-library&quot;&gt;Graphs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/List_(abstract_data_type)&quot;&gt;Lists&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/queue-in-python/&quot;&gt;Queues&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-sets/&quot;&gt;Sets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/how-to-implement-python-stack/&quot;&gt;Stacks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Tree_(data_structure)&quot;&gt;Trees&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In some cases, you can build more specific kinds of abstract data types on top of existing ADTs by incorporating additional constraints. For instance, you can &lt;a href=&quot;https://realpython.com/queue-in-python/#building-a-stack-data-type&quot;&gt;build a stack&lt;/a&gt; by modifying the queue or the other way around.&lt;/p&gt;
&lt;p&gt;As you can see, the list of ADTs doesn’t include arrays. That’s because the array is a specific &lt;strong&gt;data structure&lt;/strong&gt; representing the list abstract data type. The list ADT dictates what operations the array must support and which behaviors it should exhibit. If you’ve worked with the Python &lt;code&gt;list&lt;/code&gt;, then you should already have a pretty good idea of what the list in computer science is all about.&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; Don’t confuse the list abstract data type in computer science with the &lt;code&gt;list&lt;/code&gt; data type in Python, which represents the former. Similarly, it’s easy to mistake the theoretical array data structure for a specific &lt;a href=&quot;https://en.wikipedia.org/wiki/Array_(data_type)&quot;&gt;array data type&lt;/a&gt;, which many programming languages provide as a convenient primitive type built into their syntax.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;strong&gt;list abstract data type&lt;/strong&gt; is a linear collection of values forming an ordered sequence of elements. These elements follow a specific arrangement, meaning that each element has a position relative to the others, identified by a numeric index that usually starts at zero. The list has a variable but finite length. It may or may not contain values of different types, as well as duplicates.&lt;/p&gt;
&lt;p&gt;The interface of the list abstract data type resembles Python’s &lt;code&gt;list&lt;/code&gt;, typically including the following operations:&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;List ADT&lt;/th&gt;
&lt;th&gt;Python’s &lt;code&gt;list&lt;/code&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Get an element by an index&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fruits[0]&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Set an element at a given index&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fruits[0] = &quot;banana&quot;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Insert an element at a given index&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fruits.insert(0, &quot;banana&quot;)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delete an element by an index&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fruits.pop(0)&lt;/code&gt;, &lt;code&gt;del fruits[0]&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delete an element by a value&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fruits.remove(&quot;banana&quot;)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delete all elements&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fruits.clear()&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Find the index of a given element&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fruits.index(&quot;banana&quot;)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Append an element at the right end&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fruits.append(&quot;banana&quot;)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Merge with another list&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fruits.extend(veggies)&lt;/code&gt;, &lt;code&gt;fruits + veggies&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sort elements&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fruits.sort()&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Get the number of elements&lt;/td&gt;
&lt;td&gt;&lt;code&gt;len(fruits)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Iterate over the elements&lt;/td&gt;
&lt;td&gt;&lt;code&gt;iter(fruits)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Check if an element is present&lt;/td&gt;
&lt;td&gt;&lt;code&gt;&quot;banana&quot; in fruits&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Now that you understand where the array data structure fits into the bigger picture, it’s time to take a closer look at it.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-array/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-array/ »&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 #185: 2023 Real Python Tutorial &amp; Video Course Wrap-Up</title>
      <id>https://realpython.com/podcasts/rpp/185/</id>
      <link href="https://realpython.com/podcasts/rpp/185/"/>
      <updated>2023-12-29T12:00:00+00:00</updated>
      <summary>Three members of the Real Python team are joining us this week: Kate Finegan, Tappan Moore, and Philipp Acsany. We wanted to share a year-end wrap-up with tutorials, step-by-step projects, code conversations, and video courses that showcase what our team created this year.</summary>
      <content type="html">
        &lt;p&gt;Three members of the Real Python team are joining us this week: Kate Finegan, Tappan Moore, and Philipp Acsany. We wanted to share a year-end wrap-up with tutorials, step-by-step projects, code conversations, and video courses that showcase what our team created this year.&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 #184: PyCoder&#x27;s Weekly 2023 Wrap Up</title>
      <id>https://realpython.com/podcasts/rpp/184/</id>
      <link href="https://realpython.com/podcasts/rpp/184/"/>
      <updated>2023-12-22T12:00:00+00:00</updated>
      <summary>It&#x27;s been a fascinating year for the Python language and community. PyCoder&#x27;s Weekly included over 1,500 links to articles, blog posts, tutorials, and projects in 2023. Christopher Trudeau is back on the show this week to help wrap up everything by sharing some highlights and Python trends from across the year.</summary>
      <content type="html">
        &lt;p&gt;It&#x27;s been a fascinating year for the Python language and community. PyCoder&#x27;s Weekly included over 1,500 links to articles, blog posts, tutorials, and projects in 2023. Christopher Trudeau is back on the show this week to help wrap up everything by sharing some highlights and Python trends from across the year.&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>Add Logging and Notification Messages to Flask Web Projects</title>
      <id>https://realpython.com/flask-logging-messages/</id>
      <link href="https://realpython.com/flask-logging-messages/"/>
      <updated>2023-12-20T14:00:00+00:00</updated>
      <summary>After you implement the main functionality of a web project, it&#x27;s good to understand how your users interact with your app and where they may run into errors. In this tutorial, you&#x27;ll enhance your Flask project by creating error pages and logging messages.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;After implementing the main functionality of a web project, you may find that your app is rough around the edges. Often, this boils down to the user experience (UX) of your project. For example, when you send a form, you don’t receive a success message, although everything worked fine. You want to build an immersive experience, but wrong URLs display unwelcoming error messages. Luckily, you can get valuable information from Flask through logging.&lt;/p&gt;
&lt;p&gt;As an admin of a web project, you may know how to navigate your app without running into errors. But looking at the messages that the server sends you, you may notice that not all users do. That’s when a more verbose logging system can give you insights.&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;Create &lt;strong&gt;error pages&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Improve the user experience with &lt;strong&gt;notification messages&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Gain information with &lt;strong&gt;logging&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Adding features like the ones listed above may keep your current functionality intact and enhance your web project with a better user experience that your visitors will love.&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/flask-logging-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-flask-logging-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free source code&lt;/a&gt; that shows you how to add error pages and logging to your Flask app.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’ll gain the most value from this tutorial if you’ve already created one or more &lt;a href=&quot;https://realpython.com/flask-project/&quot;&gt;Flask web projects&lt;/a&gt; yourself. It’ll also be helpful if you’ve worked with &lt;a href=&quot;https://realpython.com/primer-on-jinja-templating/&quot;&gt;Jinja templating&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/html-css-python/&quot;&gt;HTML and CSS&lt;/a&gt; before.&lt;/p&gt;
&lt;p&gt;Also, you should be comfortable using the &lt;a href=&quot;https://realpython.com/terminal-commands/&quot;&gt;terminal&lt;/a&gt; and have &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;basic knowledge&lt;/a&gt; of Python. Although it helps to know about &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environments&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;, you’ll learn how to set everything up as you work through the tutorial.&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll continue to work on an existing Flask project. The project at hand is a public message board.&lt;/p&gt;
&lt;p&gt;You’ll start with an existing Flask project and then implement logging and notification messages:&lt;/p&gt;
&lt;figure&gt;
  &lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 border&quot;&gt;
    &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/892852624?background=1&quot; frameborder=&quot;0&quot; allow=&quot;fullscreen&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;The demo video above shows the Flask project on the left and the terminal with server logs on the right. When you interact with the web app, you get helpful feedback with notification messages. As an admin, you can also see the info messages in your logs to help you understand how your users interact with your app.&lt;/p&gt;
&lt;p&gt;In the next step, you’ll download the source code of the &lt;a href=&quot;https://realpython.com/flask-database/&quot;&gt;Flask project&lt;/a&gt;. However, you’ll notice that the codebase is quite generic so that you can transfer the instructions of this tutorial into your own Flask project.&lt;/p&gt;
&lt;h2 id=&quot;get-started&quot;&gt;Get Started&lt;a class=&quot;headerlink&quot; href=&quot;#get-started&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this section, you’ll download all the requirements that you need for this tutorial and set up the development environment.
Generally, you can leverage this tutorial to expand any Flask project that you’re currently working on.
However, if you want to follow along closely, then you should perform the steps outlined below.&lt;/p&gt;
&lt;h3 id=&quot;grab-the-prerequisites&quot;&gt;Grab the Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#grab-the-prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To hit the ground running, you’ll build up on an existing &lt;a href=&quot;https://realpython.com/flask-database/&quot;&gt;Flask project with a database&lt;/a&gt;.
That way, you don’t need to create a Flask project from scratch. Instead, you can focus on the main objectives of this tutorial, like adding an error page and displaying helpful messages to your users.&lt;/p&gt;
&lt;p&gt;The code that you need is already in place for you. All you need to do is download the source code by clicking the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/flask-logging-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-flask-logging-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free source code&lt;/a&gt; that shows you how to add error pages and logging to your Flask app.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Alternatively, you can follow the &lt;a href=&quot;https://realpython.com/flask-database/&quot;&gt;Flask project with a database&lt;/a&gt; tutorial. Either way, you should end up with a folder structure that looks like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;rp_flask_board/
├── board/
│   │
│   ├── static/
│   │   └── styles.css
│   │
│   ├── templates/
│   │   │
│   │   ├── pages/
│   │   │   ├── about.html
│   │   │   └── home.html
│   │   │
│   │   ├── posts/
│   │   │   ├── create.html
│   │   │   └── posts.html
│   │   │
│   │   ├── _navigation.html
│   │   └── base.html
│   │
│   ├── __init__.py
│   ├── database.py
│   ├── pages.py
│   ├── posts.py
│   └── schema.sql
│
└── board.sqlite
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once you’ve got the folder structure for your Flask project in place, you can read on to prepare the development environment that you’ll need to work on your web app.&lt;/p&gt;
&lt;h3 id=&quot;prepare-your-development-environment&quot;&gt;Prepare Your Development Environment&lt;a class=&quot;headerlink&quot; href=&quot;#prepare-your-development-environment&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/flask-logging-messages/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/flask-logging-messages/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Basics Exercises: Reading and Writing Files</title>
      <id>https://realpython.com/courses/python-exercises-reading-writing-files/</id>
      <link href="https://realpython.com/courses/python-exercises-reading-writing-files/"/>
      <updated>2023-12-19T14:00:00+00:00</updated>
      <summary>In this video tutorial, you&#x27;ll practice transferring data between your Python programs and external software by reading and writing files. Through exercises, you&#x27;ll master the art of reading and writing information saved in CSV file format, which is extensively used for exchanging tabular data.</summary>
      <content type="html">
        &lt;p&gt;Files play a key role in computing, as they store and transfer data. You likely come across numerous files on a daily basis. In &lt;a href=&quot;https://realpython.com/courses/python-reading-and-writing-files/&quot;&gt;Python Basics: Reading and Writing Files&lt;/a&gt;, you dove into the world of file manipulation using Python.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll practice:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Differentiating between &lt;strong&gt;text&lt;/strong&gt; and &lt;strong&gt;binary&lt;/strong&gt; files&lt;/li&gt;
&lt;li&gt;Using &lt;strong&gt;character encodings&lt;/strong&gt; and &lt;strong&gt;line endings&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Manipulating &lt;strong&gt;file objects&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Reading and writing character data with different &lt;strong&gt;file modes&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;open()&lt;/code&gt;, &lt;code&gt;Path.open()&lt;/code&gt;, and the &lt;code&gt;with&lt;/code&gt; statement&lt;/li&gt;
&lt;li&gt;Leveraging the &lt;code&gt;csv&lt;/code&gt; module to manipulate &lt;strong&gt;CSV data&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This video course is part of the Python Basics series, which is complements the book &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. Additionally, you can explore other &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics courses&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Please note that throughout this course, you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt;. If you&amp;rsquo;re new to Python, then you might want to check out &lt;a href=&quot;https://realpython.com/courses/setting-up-python/&quot;&gt;Python Basics: Setting Up Python&lt;/a&gt; before diving into this course.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Basics Exercises: Strings and String Methods</title>
      <id>https://realpython.com/courses/python-exercises-string-methods/</id>
      <link href="https://realpython.com/courses/python-exercises-string-methods/"/>
      <updated>2023-12-12T14:00:00+00:00</updated>
      <summary>In this Python Basics Exercises course, you&#x27;ll review how to work with the string data type. You&#x27;ll practice manipulating strings with methods and formatting them for printing.</summary>
      <content type="html">
        &lt;p&gt;In &lt;a href=&quot;https://realpython.com/courses/python-basics-strings-string-methods/&quot;&gt;Python Basics: Strings and String Methods&lt;/a&gt;,
you used &lt;strong&gt;strings&lt;/strong&gt; for text data in Python. You also learned how to manipulate strings with &lt;strong&gt;string methods&lt;/strong&gt;.
For example, you changed strings from lowercase to uppercase, 
removed whitespace from the beginning or end of a string, and replaced
parts of a string with different text.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll practice:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Manipulating strings with &lt;strong&gt;string methods&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Working with &lt;strong&gt;user input&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Dealing with strings of &lt;strong&gt;numbers&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Formatting&lt;/strong&gt; strings for printing&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This video course is part of the Python Basics series, which accompanies &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Note that you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt; throughout this course. If you&amp;rsquo;re just getting started, then you might want to check out &lt;a href=&quot;https://realpython.com/courses/setting-up-python/&quot;&gt;Python Basics: Setting Up Python&lt;/a&gt; before diving into this course.&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 #183: Exploring Code Reviews in Python and Automating the Process</title>
      <id>https://realpython.com/podcasts/rpp/183/</id>
      <link href="https://realpython.com/podcasts/rpp/183/"/>
      <updated>2023-12-08T12:00:00+00:00</updated>
      <summary>What goes into a code review in Python? Is there a difference in how a large organization practices code review compared to a smaller one? What do you do if you&#x27;re a solo developer? This week on the show, Brendan Maginnis and Nick Thapen from Sourcery return to talk about code review and automated code assistance.</summary>
      <content type="html">
        &lt;p&gt;What goes into a code review in Python? Is there a difference in how a large organization practices code review compared to a smaller one? What do you do if you&#x27;re a solo developer? This week on the show, Brendan Maginnis and Nick Thapen from Sourcery return to talk about code review and automated code assistance.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>How to Get the Current Time in Python</title>
      <id>https://realpython.com/courses/python-get-current-time/</id>
      <link href="https://realpython.com/courses/python-get-current-time/"/>
      <updated>2023-12-05T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll be getting the current time in Python. You&#x27;ll get your hands on a datetime object that represents the current time. You&#x27;ll see how to format it according to international standards, and you&#x27;ll even check out how computers represent time.</summary>
      <content type="html">
        &lt;p&gt;Getting the &lt;strong&gt;current time&lt;/strong&gt; in Python is a nice starting point for many time-related operations. One very important use case is creating &lt;a href=&quot;https://en.wikipedia.org/wiki/Timestamp&quot;&gt;timestamps&lt;/a&gt;. In this tutorial, you&amp;rsquo;ll learn how to &lt;strong&gt;get&lt;/strong&gt;, &lt;strong&gt;display&lt;/strong&gt;, and &lt;strong&gt;format&lt;/strong&gt; the current time with the &lt;a href=&quot;https://docs.python.org/3/library/datetime.html&quot;&gt;&lt;code&gt;datetime&lt;/code&gt;&lt;/a&gt; module.&lt;/p&gt;
&lt;p&gt;To effectively use the current time in your Python applications, you&amp;rsquo;ll add a few tools to your belt. For instance, you&amp;rsquo;ll learn how to &lt;strong&gt;read attributes&lt;/strong&gt; of the current time, like the year, minutes, or seconds. To make the time more easily readable, you&amp;rsquo;ll explore options for &lt;strong&gt;printing&lt;/strong&gt; it. You&amp;rsquo;ll also get to know different &lt;strong&gt;formats&lt;/strong&gt; of time and understand how to deal with &lt;strong&gt;time zones&lt;/strong&gt;.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #182: Building a Python JSON Parser &amp; Discussing Ideas for PEPs</title>
      <id>https://realpython.com/podcasts/rpp/182/</id>
      <link href="https://realpython.com/podcasts/rpp/182/"/>
      <updated>2023-12-01T12:00:00+00:00</updated>
      <summary>Have you thought of a way to improve the Python language? How do you share your idea with core developers and start a discussion in the Python community? 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;Have you thought of a way to improve the Python language? How do you share your idea with core developers and start a discussion in the Python community? 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>Advent of Code: Solving Puzzles With Python</title>
      <id>https://realpython.com/courses/python-advent-of-code/</id>
      <link href="https://realpython.com/courses/python-advent-of-code/"/>
      <updated>2023-11-28T14:00:00+00:00</updated>
      <summary>Advent of Code is an online advent calendar that shares new programming puzzles each day from December 1 to the 25. In this Code Conversation, you&#x27;ll learn why solving programming puzzles can be beneficial and how you can get started with Advent of Code using Python.</summary>
      <content type="html">
        &lt;p&gt;Advent of Code is an online Advent calendar where you&amp;rsquo;ll find new programming puzzles offered each day from December 1 to 25. While you can solve the puzzles at any time, the excitement when new puzzles unlock is really something special. You can participate in Advent of Code in any programming language&amp;mdash;including Python!&lt;/p&gt;
&lt;p&gt;With the help of this Code Conversation, you&amp;rsquo;ll be ready to start solving puzzles and earning your first gold stars.&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 an &lt;strong&gt;online Advent calendar&lt;/strong&gt; is&lt;/li&gt;
&lt;li&gt;How solving puzzles can &lt;strong&gt;advance your programming skills&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How you can &lt;strong&gt;participate&lt;/strong&gt; in Advent of Code&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Advent of Code puzzles are designed to be approachable by anyone with an interest in problem-solving. You don&amp;rsquo;t need a heavy computer science background to participate. Instead, Advent of Code is a great arena for learning new skills and testing out new features of 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>Python Basics Exercises: Modules and Packages</title>
      <id>https://realpython.com/courses/python-modules-packages-exercises/</id>
      <link href="https://realpython.com/courses/python-modules-packages-exercises/"/>
      <updated>2023-11-21T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll practice separating your code into modules, using the import statement to access another module&#x27;s namespace, and creating Python packages.</summary>
      <content type="html">
        &lt;p&gt;In &lt;a href=&quot;https://realpython.com/courses/python-basics-modules-packages/&quot;&gt;Python Basics: Modules and Packages&lt;/a&gt;, you learned how to build an application by putting related code into separate files called &lt;strong&gt;modules&lt;/strong&gt;. You also used the &lt;strong&gt;&lt;code&gt;import&lt;/code&gt; statement&lt;/strong&gt; to use modules in another file.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll practice:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Creating&lt;/strong&gt; your own modules&lt;/li&gt;
&lt;li&gt;Using modules in another file through the &lt;strong&gt;&lt;code&gt;import&lt;/code&gt; statement&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Organizing several modules into a &lt;strong&gt;package&lt;/strong&gt; with &lt;code&gt;__init__.py&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Along the way, you&amp;rsquo;ll also get some insight into how to tackle coding challenges in general, which can be a great way to level up as a developer.&lt;/p&gt;
&lt;p&gt;This video course is part of the Python Basics series, which accompanies &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. You can also check out the other &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics courses&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Note that you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt; throughout this course. If you&amp;rsquo;re just getting started, then you might want to check out &lt;a href=&quot;https://realpython.com/courses/setting-up-python/&quot;&gt;Python Basics: Setting Up Python&lt;/a&gt; before diving into this course.&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 #181: Computational Thinking &amp; Learning Python During an AI Revolution</title>
      <id>https://realpython.com/podcasts/rpp/181/</id>
      <link href="https://realpython.com/podcasts/rpp/181/"/>
      <updated>2023-11-17T12:00:00+00:00</updated>
      <summary>Has the current growth of artificial intelligence (AI) systems made you wonder what the future holds for Python developers? What are the hidden benefits of learning to program in Python and practicing computational thinking? This week on the show, we speak with author Lawrence Gray about his upcoming book &quot;Mastering Python: A Problem Solving Approach.&quot;</summary>
      <content type="html">
        &lt;p&gt;Has the current growth of artificial intelligence (AI) systems made you wonder what the future holds for Python developers? What are the hidden benefits of learning to program in Python and practicing computational thinking? This week on the show, we speak with author Lawrence Gray about his upcoming book &quot;Mastering Python: A Problem Solving Approach.&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>The Real Python Podcast – Episode #180: Studying Python Software Architecture &amp; Creating Lambda Expressions</title>
      <id>https://realpython.com/podcasts/rpp/180/</id>
      <link href="https://realpython.com/podcasts/rpp/180/"/>
      <updated>2023-11-10T12:00:00+00:00</updated>
      <summary>Have you moved through the fundamentals of Python, and are you now considering building a more extensive project or complete application? Where can you study the architecture of existing Python projects and learn best practices? 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;Have you moved through the fundamentals of Python, and are you now considering building a more extensive project or complete application? Where can you study the architecture of existing Python projects and learn best practices? 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>
  

</feed>
