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

  
    <entry>
      <title>The Real Python Podcast – Episode #111: Questions for New Dependencies &amp; Comparing Python Game Libraries</title>
      <id>https://realpython.com/podcasts/rpp/111/</id>
      <link href="https://realpython.com/podcasts/rpp/111/"/>
      <updated>2022-05-27T12:00:00+00:00</updated>
      <summary>What are the differences between the various Python game frameworks? Would it help to see a couple of game examples across several libraries to understand the distinctions? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What are the differences between the various Python game frameworks? Would it help to see a couple of game examples across several libraries to understand the distinctions? This week on the show, Christopher Trudeau is here, 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>Level Up Your Skills With the Real Python Slack Community</title>
      <id>https://realpython.com/community-slack-guide/</id>
      <link href="https://realpython.com/community-slack-guide/"/>
      <updated>2022-05-25T14:00:00+00:00</updated>
      <summary>In this guide, you&#x27;ll learn how to get the most out of your Real Python membership using the community Slack. You&#x27;ll learn some lesser-known features of Slack and see how to communicate your technical problems more effectively.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The Real Python &lt;a href=&quot;https://realpython.com/community/&quot;&gt;Community Slack&lt;/a&gt; is an English-medium Python community with members located worldwide. It’s a welcoming group in which you’re free to discuss any questions you may have, celebrate your progress, or hang out with the community at the virtual watercooler.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;This guide is for you if you want to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Get the most out of the Real Python &lt;strong&gt;Slack community&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Navigate some of &lt;strong&gt;Slack’s most valuable features&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Get your &lt;strong&gt;questions answered&lt;/strong&gt; by other Real Python members&lt;/li&gt;
&lt;li&gt;Learn the &lt;strong&gt;dos and don’ts&lt;/strong&gt; to keep things on an even keel&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Any recommendations or questions that you may have are welcome. You can share them with the administrators in Slack or in the comments below. On Slack, you can tell if someone is an administrator by the Real Python symbol next to their name.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-mastery-course/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-mastery-course&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you’ll need to take your Python skills to the next level.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;enjoy-yourself-be-curious-ask-questions-and-respect-others&quot;&gt;Enjoy Yourself, Be Curious, Ask Questions, and Respect Others&lt;a class=&quot;headerlink&quot; href=&quot;#enjoy-yourself-be-curious-ask-questions-and-respect-others&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The people in the Real Python Slack community are friendly people who love to answer questions and hang out. It’s a fantastic resource for beginners and more advanced Pythonistas looking to expand their knowledge and build friendships.&lt;/p&gt;
&lt;p&gt;There are no stupid questions—no such thing exists! Interestingly, beginners’ questions tend to lead to the most exciting and deep discussions about Python and programming. So please, ask away!&lt;/p&gt;
&lt;p&gt;The Real Python Slack community isn’t an adversarial forum—everyone is here to learn, and people love to help. So listen and &lt;a href=&quot;https://www.youtube.com/watch?v=rph_1DODXDU&quot;&gt;be excellent to each other&lt;/a&gt;. You’ll make some friends!&lt;/p&gt;
&lt;p&gt;Of course, there are challenges to online communication that aren’t present when people meet face to face. If you have any issues about anything at all, then please feel free to get in touch with one of the administrators:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/team/bzaczynski/&quot;&gt;Bartosz Zaczyński&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/team/gahjelle/&quot;&gt;Geir Arne Hjelle&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/team/icurrie/&quot;&gt;Ian Currie&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/team/lpozoramos/&quot;&gt;Leodanis Pozo Ramos&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/team/mbreuss/&quot;&gt;Martin Breuss&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/team/pacsany/&quot;&gt;Philipp Acsany&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;They’ll be happy to help you in any way they can.&lt;/p&gt;
&lt;p&gt;If you’re wondering how to navigate, benefit from, and contribute to the community, then you can read on for some helpful tips and guidelines. In the rest of this guide, you’ll get to grips with some of the dos and don’ts to keep things flowing.&lt;/p&gt;
&lt;h2 id=&quot;find-the-best-channel-to-ask-your-question&quot;&gt;Find the Best Channel to Ask Your Question&lt;a class=&quot;headerlink&quot; href=&quot;#find-the-best-channel-to-ask-your-question&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are several Slack &lt;strong&gt;channels&lt;/strong&gt; in which you can ask questions. Most channels focus on a particular topic or specialty. When you join Slack, you’ll automatically get added to a few general channels. You’re also free—and encouraged—to join any additional channels that exist within the community Slack.&lt;/p&gt;
&lt;p&gt;You can find the list of available channels by clicking the &lt;strong&gt;+&lt;/strong&gt; icon next to the Channels menu. Select the channel that you wish to join, and click the &lt;em&gt;Join&lt;/em&gt; button. For instance, you may want to join the &lt;strong&gt;#webdev&lt;/strong&gt;, &lt;strong&gt;#data-science&lt;/strong&gt;, and &lt;strong&gt;#careers&lt;/strong&gt; channels if those subjects interest you:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/Screenshot_from_2022-05-16_12-30-09.1bca6c974f72.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/Screenshot_from_2022-05-16_12-30-09.1bca6c974f72.png&quot; width=&quot;719&quot; height=&quot;387&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Screenshot_from_2022-05-16_12-30-09.1bca6c974f72.png&amp;amp;w=179&amp;amp;sig=4ad026b8425ccd215a46a376ed25d2609c8ef6d7 179w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Screenshot_from_2022-05-16_12-30-09.1bca6c974f72.png&amp;amp;w=359&amp;amp;sig=196b2c135bec0223763899553d3b852f2e4a9fa3 359w, https://files.realpython.com/media/Screenshot_from_2022-05-16_12-30-09.1bca6c974f72.png 719w&quot; sizes=&quot;75vw&quot; alt=&quot;Slack add channels button&quot; data-asset=&quot;4365&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;This may look slightly different depending on the platform where you&#x27;re using Slack.&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Once you’ve joined a few channels, you can ask your question in the channel that’s most closely related to your problem. If your question doesn’t fit into a particular category, then &lt;strong&gt;#coding-questions&lt;/strong&gt; is the channel for you.&lt;/p&gt;
&lt;h2 id=&quot;spend-some-time-composing-your-questions&quot;&gt;Spend Some Time Composing Your Questions&lt;a class=&quot;headerlink&quot; href=&quot;#spend-some-time-composing-your-questions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When you run into a problem and are in a rush, it can be tempting to jump on Slack, paste all your code, and write &lt;em&gt;IT’S NOT WORKING&lt;/em&gt;. Unfortunately, this is a surefire way to get people to ignore your question. Knowing &lt;a href=&quot;https://stackoverflow.com/help/how-to-ask&quot;&gt;how to ask questions&lt;/a&gt; is hard!&lt;/p&gt;
&lt;p&gt;These days, everyone is busy and in a rush. Imagine you’ve interrupted a working colleague and asked them to help you with a problem. You don’t bring your laptop, set it in front of them, and state that it’s not working. You &lt;em&gt;present&lt;/em&gt; the issue to them in a way that might elicit a helpful response:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#summarize-your-problem&quot;&gt;Summarize the problem&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#give-context-to-your-question&quot;&gt;Give some context to the question&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#provide-a-minimal-reproducible-example&quot;&gt;Provide a minimal reproducible example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#try-to-solve-the-problem-yourself&quot;&gt;Mention what you’ve tried so far&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#pay-attention-to-spelling-grammar-and-formatting&quot;&gt;Check your spelling, grammar, and formatting&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The more complicated your question is to wrap your head around, the more likely that someone won’t know the answer off the top of their head and may dismiss the question as something they don’t know. Code is hard to read—it takes time and effort, no matter your skill level.&lt;/p&gt;
&lt;p&gt;Spend some time collecting your thoughts and presenting the specific problem, along with code, in &lt;strong&gt;one post&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;summarize-your-problem&quot;&gt;Summarize Your Problem&lt;a class=&quot;headerlink&quot; href=&quot;#summarize-your-problem&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/community-slack-guide/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/community-slack-guide/ »&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>Exploring Scopes and Closures in Python</title>
      <id>https://realpython.com/courses/exploring-scopes-and-closures-in-python/</id>
      <link href="https://realpython.com/courses/exploring-scopes-and-closures-in-python/"/>
      <updated>2022-05-24T14:00:00+00:00</updated>
      <summary>In this Code Conversation video course, you&#x27;ll take a deep dive into how scopes and closures work in Python. To do this, you&#x27;ll use a debugger to walk through some sample code, and then you&#x27;ll take a peek under the hood to see how Python holds variables internally.</summary>
      <content type="html">
        &lt;p&gt;Have you been wondering how scopes and closures work in Python? Maybe you&amp;rsquo;ve just heard about &lt;code&gt;object.__closure__&lt;/code&gt;, and you&amp;rsquo;d like to figure out what exactly it does. In this Code Conversation video course, you&amp;rsquo;ll use the debugger &lt;a href=&quot;https://thonny.org/&quot;&gt;Thonny&lt;/a&gt; to walk through some sample code and get a better understanding of scopes and closures in Python.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this Code Conversation video course, you&amp;rsquo;ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Clarify code by refactoring it with &lt;strong&gt;descriptive names&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Learn how functions access &lt;strong&gt;variables&lt;/strong&gt; in &lt;strong&gt;local and nonlocal scopes&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Understand how &lt;strong&gt;inner and outer function calls&lt;/strong&gt; open and close &lt;strong&gt;their own scopes&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll also take a deep dive into the inner workings of Python by inspecting dunder objects to find out how Python handles and stores variables. &lt;/p&gt;
&lt;p&gt;To get the most out of this Code Conversation, you should be familiar with &lt;a href=&quot;https://realpython.com/python-scope-legb-rule/#understanding-scope&quot;&gt;scopes&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt; in Python. You should also be comfortable &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;defining your own functions&lt;/a&gt; and distinguishing between &lt;a href=&quot;https://realpython.com/inner-functions-what-are-they-good-for/&quot;&gt;inner&lt;/a&gt; and outer functions.&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 Publish an Open-Source Python Package to PyPI</title>
      <id>https://realpython.com/pypi-publish-python-package/</id>
      <link href="https://realpython.com/pypi-publish-python-package/"/>
      <updated>2022-05-23T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you’ll learn how to create a Python package for your project and how to publish it to PyPI, the Python Package Repository.  Quickly get up to speed on everything from naming your package to configuring it using setup.cfg.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python is famous for coming with &lt;a href=&quot;https://docs.python.org/tutorial/stdlib.html#batteries-included&quot;&gt;batteries included&lt;/a&gt;, and many sophisticated capabilities are available in the &lt;a href=&quot;https://docs.python.org/3/library/&quot;&gt;standard library&lt;/a&gt;. However, to unlock the full potential of the language, you should also take advantage of the community contributions at &lt;a href=&quot;https://pypi.org/&quot;&gt;PyPI&lt;/a&gt;: the &lt;strong&gt;Python Packaging Index&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;PyPI, typically pronounced &lt;em&gt;pie-pee-eye&lt;/em&gt;, is a repository containing several hundred thousand packages. These range from trivial &lt;a href=&quot;https://pypi.org/search/?q=hello+world&quot;&gt;&lt;code&gt;Hello, World&lt;/code&gt;&lt;/a&gt; implementations to advanced &lt;a href=&quot;https://pypi.org/project/keras/&quot;&gt;deep learning libraries&lt;/a&gt;. In this tutorial, you’ll learn how to &lt;strong&gt;upload your own package to PyPI&lt;/strong&gt;. Publishing your project is easier than it used to be. Yet, there are still a few steps involved.&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;Prepare&lt;/strong&gt; your Python package for publication&lt;/li&gt;
&lt;li&gt;Handle &lt;strong&gt;versioning&lt;/strong&gt; of your package&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Build&lt;/strong&gt; your package and &lt;strong&gt;upload&lt;/strong&gt; it to PyPI&lt;/li&gt;
&lt;li&gt;Understand and use different &lt;strong&gt;build systems&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Throughout this tutorial, you’ll work with an example project: a &lt;code&gt;reader&lt;/code&gt; package that can be used to read Real Python tutorials in your console. You’ll get a quick introduction to the project before going in depth about how to publish this package. Click the link below to access the GitHub repository containing the full source code of &lt;code&gt;reader&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/pypi-publish-python-package-source-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-pypi-publish-python-package-source-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get access to the source code&lt;/a&gt; for the Real Python Feed Reader that you’ll work with in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;get-to-know-python-packaging&quot;&gt;Get to Know Python Packaging&lt;a class=&quot;headerlink&quot; href=&quot;#get-to-know-python-packaging&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Packaging in Python can seem &lt;a href=&quot;https://xkcd.com/1987/&quot;&gt;complicated&lt;/a&gt; and confusing for both newcomers and seasoned veterans. You’ll find conflicting advice across the Internet, and what was once considered good practice may now be frowned upon.&lt;/p&gt;
&lt;p&gt;The main reason for this situation is that Python is a fairly old programming language. Indeed, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Python_(programming_language)#History&quot;&gt;first version&lt;/a&gt; of Python was released in 1991, before the &lt;a href=&quot;https://en.wikipedia.org/wiki/History_of_the_World_Wide_Web&quot;&gt;World Wide Web&lt;/a&gt; became available to the general public. Naturally, a modern, web-based system for distribution of packages wasn’t included or even planned for in the earliest versions of Python.&lt;/p&gt;
&lt;p&gt;Instead, Python’s packaging ecosystem has evolved organically over the decades as user needs became clear and technology offered new possibilities. The first packaging support came in the fall of 2000, with the &lt;a href=&quot;https://wiki.python.org/moin/Distutils&quot;&gt;&lt;code&gt;distutils&lt;/code&gt;&lt;/a&gt; library being included in Python 1.6 and 2.0. The Python Packaging Index (PyPI) &lt;a href=&quot;https://web.archive.org/web/20031217222840/http://www.pypi.org/&quot;&gt;came online&lt;/a&gt; in 2003, originally as a pure index of existing packages, without any hosting capabilities.&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; PyPI is often referred to as the &lt;strong&gt;Python Cheese Shop&lt;/strong&gt; in reference to Monty Python’s famous &lt;a href=&quot;https://montypython.fandom.com/wiki/Cheese_Shop_sketch&quot;&gt;Cheese Shop&lt;/a&gt; sketch. To this day, &lt;a href=&quot;http://cheeseshop.python.org/&quot;&gt;&lt;code&gt;cheeseshop.python.org&lt;/code&gt;&lt;/a&gt; redirects to PyPI.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Over the last decade, many initiatives have improved the packaging landscape, bringing it from the Wild West and into a fairly modern and capable system. This is mainly done through &lt;a href=&quot;https://peps.python.org/&quot;&gt;Python Enhancement Proposals&lt;/a&gt; (PEPs) that are reviewed and implemented by the &lt;a href=&quot;https://www.pypa.io/&quot;&gt;Python Packaging Authority&lt;/a&gt; (PyPA) working group.&lt;/p&gt;
&lt;p&gt;The most important documents that define how Python packaging works are the following PEPs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://peps.python.org/pep-0427/&quot;&gt;PEP 427&lt;/a&gt; describes how &lt;strong&gt;wheels&lt;/strong&gt; should be packaged.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://peps.python.org/pep-0440/&quot;&gt;PEP 440&lt;/a&gt; describes how &lt;strong&gt;version numbers&lt;/strong&gt; should be parsed.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://peps.python.org/pep-0508/&quot;&gt;PEP 508&lt;/a&gt; describes how &lt;strong&gt;dependencies&lt;/strong&gt; should be specified.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://peps.python.org/pep-0517/&quot;&gt;PEP 517&lt;/a&gt; describes how a &lt;strong&gt;build backend&lt;/strong&gt; should work.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://peps.python.org/pep-0518/&quot;&gt;PEP 518&lt;/a&gt; describes how a &lt;strong&gt;build system&lt;/strong&gt; should be specified.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://peps.python.org/pep-0621/&quot;&gt;PEP 621&lt;/a&gt; describes how &lt;strong&gt;project metadata&lt;/strong&gt; should be written.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://peps.python.org/pep-0660/&quot;&gt;PEP 660&lt;/a&gt; describes how &lt;strong&gt;editable installs&lt;/strong&gt; should be performed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You don’t need to study these technical documents. In this tutorial, you’ll learn how all these specifications come together in practice as you go through the process of publishing your own package.&lt;/p&gt;
&lt;p&gt;For a nice overview of the history of Python packaging, check out &lt;a href=&quot;https://twitter.com/takluyver&quot;&gt;Thomas Kluyver’s&lt;/a&gt; presentation at PyCon UK 2019: &lt;a href=&quot;https://pyvideo.org/pycon-uk-2019/what-does-pep-517-mean-for-packaging.html&quot;&gt;Python packaging: How did we get here, and where are we going?&lt;/a&gt; You can also find more presentations at the &lt;a href=&quot;https://www.pypa.io/en/latest/presentations/&quot;&gt;PyPA&lt;/a&gt; website.&lt;/p&gt;
&lt;h2 id=&quot;create-a-small-python-package&quot;&gt;Create a Small Python Package&lt;a class=&quot;headerlink&quot; href=&quot;#create-a-small-python-package&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this section, you’ll get to know a small Python package that you can use as an example that can be published to PyPI. If you already have your own package that you’re looking to publish, then feel free to skim this section and join up again at the &lt;a href=&quot;#prepare-your-package-for-publication&quot;&gt;next section&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The package that you’ll see here is called &lt;code&gt;reader&lt;/code&gt;. It can be used both as a library for downloading Real Python tutorials in your own code and as an application for reading tutorials in your console.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The source code as shown and explained in this section is a simplified—but fully functional—version of the Real Python feed reader. Compared to the version currently published on &lt;a href=&quot;https://pypi.org/project/realpython-reader/&quot;&gt;PyPI&lt;/a&gt;, this version lacks some error handling and extra options.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;First, have a look at the directory structure of &lt;code&gt;reader&lt;/code&gt;. The package lives completely inside a directory that can be named anything. In this case, it’s named &lt;code&gt;realpython-reader/&lt;/code&gt;. The source code is wrapped inside an &lt;code&gt;src/&lt;/code&gt; directory. This isn’t strictly necessary, but it’s usually a &lt;a href=&quot;https://packaging.python.org/en/latest/tutorials/packaging-projects/&quot;&gt;good idea&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The use of an extra &lt;code&gt;src/&lt;/code&gt; directory when structuring packages has been a point of &lt;a href=&quot;https://github.com/pypa/packaging.python.org/issues/320&quot;&gt;discussion&lt;/a&gt; in the Python community for years. In general, a flat directory structure is slightly easier to get started with, but the &lt;code&gt;src/&lt;/code&gt;-structure provides several &lt;a href=&quot;https://hynek.me/articles/testing-packaging/&quot;&gt;advantages&lt;/a&gt; as your project grows.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The inner &lt;code&gt;src/reader/&lt;/code&gt; directory contains all your source code:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;realpython-reader/
│
├── src/
│   └── reader/
│       ├── __init__.py
│       ├── __main__.py
│       ├── config.toml
│       ├── feed.py
│       └── viewer.py
│
├── tests/
│   ├── test_feed.py
│   └── test_viewer.py
│
├── LICENSE
├── MANIFEST.in
├── README.md
└── pyproject.toml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The source code of the package is in an &lt;code&gt;src/&lt;/code&gt; subdirectory together with a configuration file. There are a few tests in a separate &lt;code&gt;tests/&lt;/code&gt; subdirectory. The tests themselves won’t be covered in this tutorial, but you’ll learn how to treat test directories &lt;a href=&quot;#test-your-package&quot;&gt;later&lt;/a&gt;. You can learn more about testing in general in &lt;a href=&quot;https://realpython.com/python-testing/&quot;&gt;Getting Started With Testing in Python&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/pytest-python-testing/&quot;&gt;Effective Python Testing With Pytest&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/pypi-publish-python-package/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/pypi-publish-python-package/ »&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 #110: Advantages of Protobuf for Serialization in Python</title>
      <id>https://realpython.com/podcasts/rpp/110/</id>
      <link href="https://realpython.com/podcasts/rpp/110/"/>
      <updated>2022-05-20T12:00:00+00:00</updated>
      <summary>Would you like a way to send structured serialized data between different platforms and languages? What if the data was self-documenting, could automatically generate Python code, and would validate itself? This week on the show, Liran Haimovitch talks about protocol buffers and communicating with microservices through Remote Procedure Calls (RPC).</summary>
      <content type="html">
        &lt;p&gt;Would you like a way to send structured serialized data between different platforms and languages? What if the data was self-documenting, could automatically generate Python code, and would validate itself? This week on the show, Liran Haimovitch talks about protocol buffers and communicating with microservices through Remote Procedure Calls (RPC).&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Build a URL Shortener With FastAPI and Python</title>
      <id>https://realpython.com/build-a-python-url-shortener-with-fastapi/</id>
      <link href="https://realpython.com/build-a-python-url-shortener-with-fastapi/"/>
      <updated>2022-05-18T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll build an app to create and manage shortened URLs. Your Python URL shortener can receive a full target URL and return a shortened URL. You&#x27;ll also use the automatically created documentation of FastAPI to try out your API endpoints.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In this tutorial, you’ll build a URL shortener with Python and FastAPI.
URLs can be extremely long and not user-friendly.
This is where a URL shortener can come in handy.
A URL shortener reduces the number of characters in a URL, making it easier to read, remember, and share.&lt;/p&gt;
&lt;p&gt;By following this step-by-step project, you’ll build a URL shortener with Python and &lt;strong&gt;FastAPI&lt;/strong&gt;.
At the end of this tutorial, you’ll have a fully functional &lt;strong&gt;API-driven web app&lt;/strong&gt; that creates shortened URLs that forward to target URLs.&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 a &lt;strong&gt;REST API&lt;/strong&gt; with FastAPI&lt;/li&gt;
&lt;li&gt;Run a development web server with &lt;strong&gt;Uvicorn&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Model an &lt;strong&gt;SQLite&lt;/strong&gt; database&lt;/li&gt;
&lt;li&gt;Investigate the auto-generated &lt;strong&gt;API documentation&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Interact with the database with &lt;strong&gt;CRUD actions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Optimize your app by &lt;strong&gt;refactoring&lt;/strong&gt; your code &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This URL shortener project is for intermediate Python programmers who want to try out &lt;a href=&quot;https://fastapi.tiangolo.com&quot;&gt;FastAPI&lt;/a&gt; and learn about API design, CRUD, and interaction with a database.
To follow along, it’ll help if you’re familiar with the basics of handling &lt;a href=&quot;https://realpython.com/urllib-request/&quot;&gt;HTTP requests&lt;/a&gt;.
If you need a refresher on FastAPI, &lt;a href=&quot;https://realpython.com/fastapi-python-web-apis/&quot;&gt;Using FastAPI to Build Python Web APIs&lt;/a&gt; is a great introduction.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/build-a-python-url-shortener-with-fastapi-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-build-a-python-url-shortener-with-fastapi-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get access to the source code&lt;/a&gt; that you’ll use to build your Python URL shortener with FastAPI.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo-your-python-url-shortener&quot;&gt;Demo: Your Python URL Shortener&lt;a class=&quot;headerlink&quot; href=&quot;#demo-your-python-url-shortener&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this step-by-step project, you’ll build an API to create and manage shortened URLs.
The main purpose of this API is to receive a full target URL and return a shortened URL.
To try out your API endpoints, you’ll leverage the documentation that FastAPI automatically creates:&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/709517464?background=1&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;When you post a target URL to the URL shortener app, you get a shortened URL and a secret key back.
The shortened URL contains a random key that forwards to the target URL.
You can use the secret key to see the shortened URL’s statistics or delete the forwarding.&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Your URL shortener Python project will provide &lt;strong&gt;API endpoints&lt;/strong&gt; that are capable of receiving different &lt;strong&gt;HTTP request types&lt;/strong&gt;.
Each endpoint will perform an action that you’ll specify.
Here’s a summary of your URL shortener’s API endpoints:&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;Endpoint&lt;/th&gt;
&lt;th&gt;HTTP Verb&lt;/th&gt;
&lt;th&gt;Request Body&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;GET&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Returns a &lt;code&gt;Hello, World!&lt;/code&gt; string&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/url&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;POST&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Your target URL&lt;/td&gt;
&lt;td&gt;Shows the created &lt;code&gt;url_key&lt;/code&gt; with additional info, including a &lt;code&gt;secret_key&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/{url_key}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;GET&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Forwards to your target URL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/admin/{secret_key}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;GET&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Shows administrative info about your shortened URL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/admin/{secret_key}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DELETE&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Your secret key&lt;/td&gt;
&lt;td&gt;Deletes your shortened URL&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;The code you’ll write in this tutorial focuses on getting the app working first.
However, having a working app doesn’t always mean that the code behind it is perfect.
That’s why you’ll find a step in this tutorial where you’ll refactor parts of your app.&lt;/p&gt;
&lt;p&gt;If you want to have a look at the final source code, go ahead and download it:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/build-a-python-url-shortener-with-fastapi-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-build-a-python-url-shortener-with-fastapi-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get access to the source code&lt;/a&gt; that you’ll use to build your Python URL shortener with FastAPI.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;This project is a great starting point to extend your API with more functionality.
At the end of this tutorial, you’ll find ideas about what to build next.&lt;/p&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To get the most out of this tutorial, you should be comfortable with the following concepts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;Object-Oriented Programming (OOP) in Python 3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-json/&quot;&gt;Working with JSON data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-type-checking/&quot;&gt;Python Type Checking&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/urllib-request/&quot;&gt;Handling HTTP requests&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The linked resources will help you better understand the code that you write in this tutorial.
However, in this tutorial, you’ll build your app step by step.
So even if you’re not familiar with the concepts above, then you’ll be able to follow along.&lt;/p&gt;
&lt;h2 id=&quot;step-1-prepare-your-environment&quot;&gt;Step 1: Prepare Your Environment&lt;a class=&quot;headerlink&quot; href=&quot;#step-1-prepare-your-environment&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this step, you’ll prepare the development environment for your FastAPI app.
First, you’ll create the folder structure for your app.
Then, you’ll create a &lt;strong&gt;virtual environment&lt;/strong&gt; and install all &lt;strong&gt;project dependencies&lt;/strong&gt; that you need for your project.
Finally, you’ll learn how to store &lt;strong&gt;environment variables&lt;/strong&gt; outside of your code and how to load the variables into your app.&lt;/p&gt;
&lt;h3 id=&quot;create-the-projects-folder-structure&quot;&gt;Create the Project’s Folder Structure&lt;a class=&quot;headerlink&quot; href=&quot;#create-the-projects-folder-structure&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In this section, you’ll create your project structure.
You can name the root folder of your project any way you like.
For example, you could name it &lt;code&gt;url_shortener_project/&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/build-a-python-url-shortener-with-fastapi/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/build-a-python-url-shortener-with-fastapi/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using Python Class Constructors</title>
      <id>https://realpython.com/courses/using-python-class-constructors/</id>
      <link href="https://realpython.com/courses/using-python-class-constructors/"/>
      <updated>2022-05-17T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how class constructors work in Python. You&#x27;ll also explore Python&#x27;s instantiation process, which has two main steps: instance creation and instance initialization.</summary>
      <content type="html">
        &lt;p&gt;Class constructors are a fundamental part of &lt;strong&gt;object-oriented programming&lt;/strong&gt; in Python. They allow you to create and properly initialize objects of a given class, making those objects ready to use. Class constructors internally trigger Python&amp;rsquo;s instantiation process, which runs through two main steps: &lt;strong&gt;instance creation&lt;/strong&gt; and &lt;strong&gt;instance initialization&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you want to dive deeper into how Python internally constructs objects and learn how to customize the process, then this video course is for you.&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;Understand Python&amp;rsquo;s internal &lt;strong&gt;instantiation process&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Customize object initialization using &lt;strong&gt;&lt;code&gt;.__init__()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Fine-tune object creation by overriding &lt;strong&gt;&lt;code&gt;.__new__()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With this knowledge, you&amp;rsquo;ll be able to tweak the creation and initialization of objects in your custom Python classes, which will give you control over the instantiation process at a more advanced level.&lt;/p&gt;
&lt;p&gt;To better understand the examples and concepts in this tutorial, 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://docs.python.org/3/glossary.html#term-special-method&quot;&gt;special methods&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>Linear Regression in Python</title>
      <id>https://realpython.com/linear-regression-in-python/</id>
      <link href="https://realpython.com/linear-regression-in-python/"/>
      <updated>2022-05-16T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll get started with linear regression in Python. Linear regression is one of the fundamental statistical and machine learning techniques, and Python is a popular choice for machine learning.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;You’re living in an era of large amounts of &lt;a href=&quot;https://realpython.com/tutorials/data-science/&quot;&gt;data&lt;/a&gt;, powerful computers, and &lt;a href=&quot;https://realpython.com/python-ai-neural-network/&quot;&gt;artificial intelligence&lt;/a&gt;. This is just the beginning. &lt;a href=&quot;https://realpython.com/data-science-podcasts/&quot;&gt;Data science&lt;/a&gt; and machine learning are driving image recognition, development of autonomous vehicles, decisions in the financial and energy sectors, advances in medicine, the rise of social networks, and more. Linear regression is an important part of this.&lt;/p&gt;
&lt;p&gt;Linear regression is one of the fundamental statistical and machine learning techniques. Whether you want to do &lt;a href=&quot;https://realpython.com/python-statistics/&quot;&gt;statistics&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/tutorials/machine-learning/&quot;&gt;machine learning&lt;/a&gt;, or &lt;a href=&quot;https://realpython.com/what-can-i-do-with-python/#scientific-computing&quot;&gt;scientific computing&lt;/a&gt;, there’s a good chance that you’ll need it. It’s best to build a solid foundation first and then proceed toward more complex methods.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this article, you’ll have learned:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What linear regression &lt;strong&gt;is&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What linear regression is &lt;strong&gt;used&lt;/strong&gt; for&lt;/li&gt;
&lt;li&gt;How linear regression &lt;strong&gt;works&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;implement&lt;/strong&gt; linear regression in Python, step by step&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;#&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-numpy-learning-guide&quot; data-focus=&quot;false&quot;&gt;Click here to get access to a free NumPy Resources Guide&lt;/a&gt; that points you to the best tutorials, videos, and books for improving your NumPy skills.&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;i class=&quot;fa fa-graduation-cap&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt; Take the Quiz:&lt;/strong&gt; Test your knowledge with our interactive “Linear Regression in Python” 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/linear-regression-in-python/&quot; target=&quot;_blank&quot;&gt;Take the Quiz »&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;regression&quot;&gt;Regression&lt;a class=&quot;headerlink&quot; href=&quot;#regression&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Regression analysis is one of the most important fields in statistics and machine learning. There are many regression methods available. Linear regression is one of them.&lt;/p&gt;
&lt;h3 id=&quot;what-is-regression&quot;&gt;What Is Regression?&lt;a class=&quot;headerlink&quot; href=&quot;#what-is-regression&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Regression searches for relationships among &lt;strong&gt;variables&lt;/strong&gt;. For example, you can observe several employees of some company and try to understand how their salaries depend on their &lt;strong&gt;features&lt;/strong&gt;, such as experience, education level, role, city of employment, and so on.&lt;/p&gt;
&lt;p&gt;This is a regression problem where data related to each employee represents one &lt;strong&gt;observation&lt;/strong&gt;. The presumption is that the experience, education, role, and city are the independent features, while the salary depends on them.&lt;/p&gt;
&lt;p&gt;Similarly, you can try to establish the mathematical dependence of housing prices on area, number of bedrooms, distance to the city center, and so on.&lt;/p&gt;
&lt;p&gt;Generally, in regression analysis, you consider some phenomenon of interest and have a number of observations. Each observation has two or more features. Following the assumption that at least one of the features depends on the others, you try to establish a relation among them.&lt;/p&gt;
&lt;p&gt;In other words, you need to find a &lt;strong&gt;function that maps some features or variables to others&lt;/strong&gt; sufficiently well.&lt;/p&gt;
&lt;p&gt;The dependent features are called the &lt;strong&gt;dependent variables&lt;/strong&gt;, &lt;strong&gt;outputs&lt;/strong&gt;, or &lt;strong&gt;responses&lt;/strong&gt;. The independent features are called the &lt;strong&gt;independent variables&lt;/strong&gt;, &lt;strong&gt;inputs&lt;/strong&gt;, &lt;strong&gt;regressors&lt;/strong&gt;, or &lt;strong&gt;predictors&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Regression problems usually have one continuous and unbounded dependent variable. The inputs, however, can be continuous, discrete, or even categorical data such as gender, nationality, or brand.&lt;/p&gt;
&lt;p&gt;It’s a common practice to denote the outputs with 𝑦 and the inputs with 𝑥. If there are two or more independent variables, then they can be represented as the vector 𝐱 = (𝑥₁, …, 𝑥ᵣ), where 𝑟 is the number of inputs.&lt;/p&gt;
&lt;h3 id=&quot;when-do-you-need-regression&quot;&gt;When Do You Need Regression?&lt;a class=&quot;headerlink&quot; href=&quot;#when-do-you-need-regression&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Typically, you need regression to answer whether and how some phenomenon influences the other or how &lt;strong&gt;several&lt;/strong&gt; variables are related. For example, you can use it to determine &lt;em&gt;if&lt;/em&gt; and &lt;em&gt;to what extent&lt;/em&gt; experience or gender impacts salaries.&lt;/p&gt;
&lt;p&gt;Regression is also useful when you want to &lt;strong&gt;forecast&lt;/strong&gt; a response using a new set of predictors. For example, you could try to predict electricity consumption of a household for the next hour given the outdoor temperature, time of day, and number of residents in that household.&lt;/p&gt;
&lt;p&gt;Regression is used in many different fields, including economics, computer science, and the social sciences. Its importance rises every day with the availability of large amounts of data and increased awareness of the practical value of data.&lt;/p&gt;
&lt;h2 id=&quot;linear-regression&quot;&gt;Linear Regression&lt;a class=&quot;headerlink&quot; href=&quot;#linear-regression&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Linear regression is probably one of the most important and widely used regression techniques. It’s among the simplest regression methods. One of its main advantages is the ease of interpreting results.&lt;/p&gt;
&lt;h3 id=&quot;problem-formulation&quot;&gt;Problem Formulation&lt;a class=&quot;headerlink&quot; href=&quot;#problem-formulation&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When implementing linear regression of some dependent variable 𝑦 on the set of independent variables 𝐱 = (𝑥₁, …, 𝑥ᵣ), where 𝑟 is the number of predictors, you assume a linear relationship between 𝑦 and 𝐱: 𝑦 = 𝛽₀ + 𝛽₁𝑥₁ + ⋯ + 𝛽ᵣ𝑥ᵣ + 𝜀. This equation is the &lt;strong&gt;regression equation&lt;/strong&gt;. 𝛽₀, 𝛽₁, …, 𝛽ᵣ are the &lt;strong&gt;regression coefficients&lt;/strong&gt;, and 𝜀 is the &lt;strong&gt;random error&lt;/strong&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/linear-regression-in-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/linear-regression-in-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 #109: Start Testing Your Python with doctest &amp; Pagination in Django</title>
      <id>https://realpython.com/podcasts/rpp/109/</id>
      <link href="https://realpython.com/podcasts/rpp/109/"/>
      <updated>2022-05-13T12:00:00+00:00</updated>
      <summary>Did you know you can add testing to your Python code while simultaneously documenting it? Using docstrings, you can create examples of how your functions should interact in a Python REPL and test them with the built-in doctest module. This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Did you know you can add testing to your Python code while simultaneously documenting it? Using docstrings, you can create examples of how your functions should interact in a Python REPL and test them with the built-in doctest module. This week on the show, Christopher Trudeau is here, 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>pandas GroupBy: Your Guide to Grouping Data in Python</title>
      <id>https://realpython.com/pandas-groupby/</id>
      <link href="https://realpython.com/pandas-groupby/"/>
      <updated>2022-05-11T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to work adeptly with the pandas GroupBy facility while mastering ways to manipulate, transform, and summarize data. You&#x27;ll work with real-world datasets and chain GroupBy methods together to get data in an output that suits your purpose.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Whether you’ve just started working with &lt;a href=&quot;https://realpython.com/pandas-python-explore-dataset/&quot;&gt;pandas&lt;/a&gt; and want to master one of its core capabilities, or you’re looking to fill in some gaps in your understanding about &lt;code&gt;.groupby()&lt;/code&gt;, this tutorial will help you to break down and visualize a &lt;strong&gt;pandas GroupBy&lt;/strong&gt; operation from start to finish.&lt;/p&gt;
&lt;p&gt;This tutorial is meant to complement the &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html&quot;&gt;official pandas documentation&lt;/a&gt; and the &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/user_guide/cookbook.html#cookbook-grouping&quot;&gt;pandas Cookbook&lt;/a&gt;, where you’ll see self-contained, bite-sized examples. Here, however, you’ll focus on three more involved walkthroughs that use real-world datasets.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll cover:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How to use pandas &lt;strong&gt;GroupBy operations&lt;/strong&gt; on &lt;strong&gt;real-world data&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How the &lt;strong&gt;split-apply-combine&lt;/strong&gt; chain of operations works&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;decompose&lt;/strong&gt; the split-apply-combine chain into steps&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;categorize methods&lt;/strong&gt; of a pandas GroupBy object based on their intent and result&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This tutorial assumes that you have some experience with pandas itself, including how to read CSV files into memory as pandas objects with &lt;code&gt;read_csv()&lt;/code&gt;. If you need a refresher, then check out &lt;a href=&quot;https://realpython.com/python-csv/#reading-csv-files-with-pandas&quot;&gt;Reading CSVs With pandas&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/pandas-read-write-files/&quot;&gt;pandas: How to Read and Write Files&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can download the source code for all the examples in this tutorial by clicking on the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Download Datasets:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/pandas-groupby/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-pandas-groupby&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the datasets that you’ll use&lt;/a&gt; to learn about pandas’ GroupBy in this tutorial.&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;Before you proceed, make sure that you have the latest version of pandas available within a new &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;:&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-windows&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body active small&quot; id=&quot;windows-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#windows-1&quot; role=&quot;tab&quot; aria-controls=&quot;windows-1&quot; aria-selected=&quot;true&quot;&gt;&lt;i class=&quot;fa fa-windows text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;Windows&lt;/a&gt;
  &lt;/li&gt;




  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-linuxmacos&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body small&quot; id=&quot;macos-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#linux-macos-1&quot; role=&quot;tab&quot; aria-controls=&quot;linux-macos-1&quot; aria-selected=&quot;false&quot;&gt;&lt;i class=&quot;fa fa-linux text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;&lt;i class=&quot;fa fa-apple text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;Linux + macOS&lt;/a&gt;
  &lt;/li&gt;

&lt;/ul&gt;
&lt;div class=&quot;tab-content mt-2 mb-0 js-platform-widget-content&quot;&gt;
&lt;div aria-labelledby=&quot;windows-tab-1&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight pscon&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Scripts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Activate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ps1&lt;/span&gt;
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pip&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pandas&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python3 -m venv venv
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; venv/bin/activate
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python -m pip install pandas
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this tutorial, you’ll focus on three datasets:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;a href=&quot;https://github.com/unitedstates/congress-legislators&quot;&gt;U.S. Congress dataset&lt;/a&gt; contains public information on historical members of Congress and illustrates several fundamental capabilities of &lt;code&gt;.groupby()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;http://archive.ics.uci.edu/ml/datasets/Air+Quality&quot;&gt;air quality dataset&lt;/a&gt; contains periodic gas sensor readings. This will allow you to work with &lt;a href=&quot;https://realpython.com/python-numbers/#floating-point-numbers&quot;&gt;floats&lt;/a&gt; and time series data.&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;http://archive.ics.uci.edu/ml/datasets/News+Aggregator&quot;&gt;news aggregator dataset&lt;/a&gt; holds metadata on several hundred thousand news articles. You’ll be working with strings and doing text &lt;a href=&quot;https://en.wikipedia.org/wiki/Data_wrangling&quot;&gt;munging&lt;/a&gt; with &lt;code&gt;.groupby()&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can download the source code for all the examples in this tutorial by clicking on the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Download Datasets:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/pandas-groupby/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-pandas-groupby&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the datasets that you’ll use&lt;/a&gt; to learn about pandas’ GroupBy in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Once you’ve downloaded the &lt;code&gt;.zip&lt;/code&gt; file, unzip the file to a folder called &lt;code&gt;groupby-data/&lt;/code&gt; in your current directory. Before you read on, ensure that your &lt;a href=&quot;https://realpython.com/directory-tree-generator-python/&quot;&gt;directory tree&lt;/a&gt; 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;./
│
└── groupby-data/
    │
    ├── legislators-historical.csv
    ├── airqual.csv
    └── news.csv
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With &lt;code&gt;pandas&lt;/code&gt; installed, your virtual environment activated, and the datasets downloaded, you’re ready to jump in!&lt;/p&gt;
&lt;h2 id=&quot;example-1-us-congress-dataset&quot;&gt;Example 1: U.S. Congress Dataset&lt;a class=&quot;headerlink&quot; href=&quot;#example-1-us-congress-dataset&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’ll jump right into things by dissecting a &lt;a href=&quot;https://github.com/unitedstates/congress-legislators&quot;&gt;dataset of historical members of Congress&lt;/a&gt;. You can read the CSV file into a &lt;a href=&quot;https://realpython.com/pandas-dataframe/&quot;&gt;pandas &lt;code&gt;DataFrame&lt;/code&gt;&lt;/a&gt; with &lt;code&gt;read_csv()&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# pandas_legislators.py&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pandas&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pd&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;dtypes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;first_name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;category&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;gender&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;category&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;category&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;state&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;category&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;party&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;category&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read_csv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;groupby-data/legislators-historical.csv&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;dtype&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dtypes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;usecols&lt;/span&gt;&lt;span class=&quot;o&quot;&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;dtypes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;birthday&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;last_name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;parse_dates&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;birthday&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The dataset contains members’ first and last names, birthday, gender, type (&lt;code&gt;&quot;rep&quot;&lt;/code&gt; for House of Representatives or &lt;code&gt;&quot;sen&quot;&lt;/code&gt; for Senate), U.S. state, and political party. You can use &lt;code&gt;df.tail()&lt;/code&gt; to view the last few rows of the dataset:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pandas_legislators&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;df&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;df&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;      last_name first_name   birthday gender type state       party&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;11970   Garrett     Thomas 1972-03-27      M  rep    VA  Republican&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;11971    Handel      Karen 1962-04-18      F  rep    GA  Republican&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;11972     Jones     Brenda 1959-10-24      F  rep    MI    Democrat&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;11973    Marino        Tom 1952-08-15      M  rep    PA  Republican&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;11974     Jones     Walter 1943-02-10      M  rep    NC  Republican&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;DataFrame&lt;/code&gt; uses categorical &lt;strong&gt;dtypes&lt;/strong&gt; for &lt;a href=&quot;https://realpython.com/python-pandas-tricks/#5-use-categorical-data-to-save-on-time-and-space&quot;&gt;space efficiency&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&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;df&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dtypes&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;last_name             object&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;first_name          category&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;birthday      datetime64[ns]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;gender              category&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;type                category&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;state               category&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;party               category&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;dtype: object&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/pandas-groupby/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/pandas-groupby/ »&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>Deploying a Flask Application Using Heroku</title>
      <id>https://realpython.com/courses/deploying-a-flask-application-using-heroku/</id>
      <link href="https://realpython.com/courses/deploying-a-flask-application-using-heroku/"/>
      <updated>2022-05-10T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to create a Python Flask example web application and deploy it using Heroku. You’ll also use Git to track changes to the code, and you’ll configure a deployment workflow with different environments for staging and production.</summary>
      <content type="html">
        &lt;p&gt;In this video course, you&amp;rsquo;ll create a Python &lt;a href=&quot;https://flask.palletsprojects.com/&quot;&gt;Flask&lt;/a&gt; example application and deploy it using &lt;a href=&quot;https://heroku.com&quot;&gt;Heroku&lt;/a&gt;, making it publicly available on the web. Heroku removes much of the infrastructure burden related to building and running &lt;a href=&quot;https://realpython.com/python-web-applications/&quot;&gt;web applications&lt;/a&gt;, allowing you to focus on creating an awesome app.&lt;/p&gt;
&lt;p&gt;Besides deploying the app, you&amp;rsquo;ll use Git to track changes to the code, and you&amp;rsquo;ll also configure a deployment workflow with different environments for staging and production. Using this setup, you&amp;rsquo;ll be able to test and preview the app before releasing it. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a Python &lt;strong&gt;Flask example web application&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Deploy&lt;/strong&gt; the web application using Heroku&lt;/li&gt;
&lt;li&gt;Implement a deployment &lt;strong&gt;workflow&lt;/strong&gt; using Heroku &lt;strong&gt;pipelines&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Manage &lt;strong&gt;configuration&lt;/strong&gt; and &lt;strong&gt;secrets&lt;/strong&gt; for different environments in a secure way&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This course assumes that you understand the basics of how web applications work and that you have some experience using Git. To get up to speed on these topics, check out &lt;a href=&quot;https://realpython.com/python-web-applications-with-flask-part-i/&quot;&gt;Python Web Applications with Flask (Tutorial Series)&lt;/a&gt; and  &lt;a href=&quot;https://realpython.com/python-git-github-intro/&quot;&gt;Introduction to Git and GitHub for Python Developers&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As you&amp;rsquo;ll learn through this video course, by combining Flask and Heroku, you can minimize the effort required to create and run web applications.&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 News: What&#x27;s New From April 2022</title>
      <id>https://realpython.com/python-news-april-2022/</id>
      <link href="https://realpython.com/python-news-april-2022/"/>
      <updated>2022-05-09T14:00:00+00:00</updated>
      <summary>In April 2022, the PyCon US conference happened in Salt Lake City. During the conference, Python developers met for the annual Language Summit, and Anaconda announced PyScript, a way to write Python directly inside HTML. In this article, you&#x27;ll learn more about what happened in the last month in the world of Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;April 2022&lt;/strong&gt; saw the return of the &lt;strong&gt;PyCon US&lt;/strong&gt; conference in person in Salt Lake City. During the conference, Python developers met for the annual &lt;strong&gt;Language Summit&lt;/strong&gt;, and &lt;a href=&quot;https://www.anaconda.com/blog/pyscript-python-in-the-browser&quot;&gt;Anaconda&lt;/a&gt; announced &lt;strong&gt;PyScript&lt;/strong&gt;, a way to write Python directly inside HTML. Earlier in the month, the Python Software Foundation (PSF) welcomed its new &lt;strong&gt;executive director&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Read on to dive into the biggest &lt;strong&gt;Python news&lt;/strong&gt; from the past month!  &lt;/p&gt;
&lt;h2 id=&quot;pyscript-python-in-your-browser&quot;&gt;PyScript: Python in Your Browser&lt;a class=&quot;headerlink&quot; href=&quot;#pyscript-python-in-your-browser&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;During his keynote at &lt;a href=&quot;#pycon-us-2022&quot;&gt;PyCon US&lt;/a&gt;, Anaconda CEO &lt;a href=&quot;https://twitter.com/pwang&quot;&gt;Peter Wang&lt;/a&gt; unveiled the &lt;strong&gt;PyScript&lt;/strong&gt; project. &lt;a href=&quot;https://pyscript.net/&quot;&gt;PyScript&lt;/a&gt; allows you to write Python directly inside HTML and run it in your browser. Consider the following example:&lt;/p&gt;
&lt;div class=&quot;highlight html&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;stylesheet&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://pyscript.net/alpha/pyscript.css&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;defer&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;https://pyscript.net/alpha/pyscript.js&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;    &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;py-script&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; print(&#x27;Hello, World!&#x27;) &lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;py-script&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note the &lt;code&gt;&amp;lt;py-script&amp;gt;&lt;/code&gt; tag, which can contain any valid Python code. In this case, this is the traditional &lt;code&gt;Hello, World!&lt;/code&gt; greeting.&lt;/p&gt;
&lt;p&gt;This is functioning code. You can copy the above code block into a file, such as &lt;code&gt;hello.html&lt;/code&gt;, and save that file to your computer. Then you can open it in your browser, for example by using &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-control&quot;&gt;Ctrl&lt;/kbd&gt;&lt;span&gt;+&lt;/span&gt;&lt;kbd&gt;O&lt;/kbd&gt;&lt;/span&gt; or &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-command&quot;&gt;Cmd&lt;/kbd&gt;&lt;span&gt;+&lt;/span&gt;&lt;kbd&gt;O&lt;/kbd&gt;&lt;/span&gt; and selecting &lt;code&gt;hello.html&lt;/code&gt;. Alternatively, you can test a similar &lt;a href=&quot;https://pyscript.net/examples/hello_world.html&quot;&gt;example&lt;/a&gt; immediately on the &lt;a href=&quot;https://pyscript.net/examples/&quot;&gt;PyScript demos page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;PyScript provides custom HTML tags, including &lt;code&gt;&amp;lt;py-script&amp;gt;&lt;/code&gt;, which you saw above. There are several other tags as well, with many still in development. However, here are a couple that are immediately useful:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;py-env&amp;gt;&lt;/code&gt;&lt;/strong&gt; lists packages that should be made available in the environment.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;&amp;lt;py-repl&amp;gt;&lt;/code&gt;&lt;/strong&gt; creates a working Python REPL to interact with the environment.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-april-2022/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-april-2022/ »&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 #108: Run Python in a Browser With Pyodide &amp; The Power of f-Strings</title>
      <id>https://realpython.com/podcasts/rpp/108/</id>
      <link href="https://realpython.com/podcasts/rpp/108/"/>
      <updated>2022-05-06T12:00:00+00:00</updated>
      <summary>Have you heard about the projects working toward getting Python to run in the browser? Maybe you would like to try it out for yourself, by building an interactive Python REPL with Pyodide and WebAssembly (WASM). This week on the show, Christopher Trudeau is here, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you heard about the projects working toward getting Python to run in the browser? Maybe you would like to try it out for yourself, by building an interactive Python REPL with Pyodide and WebAssembly (WASM). This week on the show, Christopher Trudeau is here, and he&#x27;s brought 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>Top Python Game Engines</title>
      <id>https://realpython.com/top-python-game-engines/</id>
      <link href="https://realpython.com/top-python-game-engines/"/>
      <updated>2022-05-04T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll explore several Python game engines available to you. For each, you&#x27;ll code simple examples and a more advanced game to learn the game engine&#x27;s strengths and weaknesses.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Like many people, maybe you wanted to write video games when you first learned to code. But were those games like the games you played? Maybe there was no Python when you started, no Python games available for you to study, and no game engines to speak of. With no real guidance or framework to assist you, the advanced graphics and sound that you experienced in other games may have remained out of reach.&lt;/p&gt;
&lt;p&gt;Now, there’s Python, and a host of great Python game engines available. This powerful combination makes crafting great computer games much easier than in the past. In this tutorial, you’ll explore several of these game engines, learning what you need to start crafting your own Python video games!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this article, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Understand the &lt;strong&gt;pros and cons&lt;/strong&gt; of several &lt;strong&gt;popular Python game engines&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;See these game engines &lt;strong&gt;in action&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Understand how they &lt;strong&gt;compare&lt;/strong&gt; to &lt;strong&gt;stand-alone game engines&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Learn about &lt;strong&gt;other Python game engines&lt;/strong&gt; available&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should be well-versed in Python programming, including &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;. An understanding of basic game concepts is helpful, but not necessary.&lt;/p&gt;
&lt;p&gt;Ready to dive in? Click the link below to download the source code for all the games that you’ll be creating:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/top-python-game-engines-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-top-python-game-engines-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to try out Python game engines.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;python-game-engines-overview&quot;&gt;Python Game Engines Overview&lt;a class=&quot;headerlink&quot; href=&quot;#python-game-engines-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Game engines for Python most often take the form of Python libraries, which can be installed in a variety of ways. Most are available on &lt;a href=&quot;https://pypi.org/&quot;&gt;PyPI&lt;/a&gt; and can be installed with &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;. However, a few are available only on GitHub, GitLab, or other code sharing locations, and they may require other installation steps. This article will cover installation methods for all the engines discussed.&lt;/p&gt;
&lt;p&gt;Python is a general purpose programming language, and it’s used for a variety of tasks other than writing computer games. In contrast, there are many different stand-alone game engines that are tailored specifically to writing games. Some of these include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.unrealengine.com/&quot;&gt;The Unreal Engine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://unity.com/&quot;&gt;Unity&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://godotengine.org/&quot;&gt;Godot&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These stand-alone game engines differ from Python game engines in several key aspects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Language support:&lt;/strong&gt; Languages like C++, C#, and JavaScript are popular for games written in stand-alone game engines, as the engines themselves are often written in these languages. Very few stand-alone engines support Python.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Proprietary scripting support:&lt;/strong&gt; In addition, many stand-alone game engines maintain and support their own scripting languages, which may not resemble Python. For example, Unity uses C# natively, while Unreal works best with C++. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Platform support:&lt;/strong&gt; Many modern stand-alone game engines can produce games for a variety of platforms, including mobile and dedicated game systems, with very little effort. In contrast, porting a Python game across various platforms, especially mobile platforms, can be a major undertaking.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Licensing options:&lt;/strong&gt; Games written using a stand-alone game engine may have different licensing options and restrictions, based on the engine used.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So why use Python to write games at all? In a word, Python. Using a stand-alone game engine often requires you to learn a new programming or scripting language. Python game engines leverage your existing knowledge of Python, reducing the learning curve and getting you moving forward quickly.&lt;/p&gt;
&lt;p&gt;There are many game engines available for the Python environment. The engines that you’ll learn about here all share the following criteria:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;They’re relatively popular engines, or they cover aspects of gaming that aren’t usually covered.&lt;/li&gt;
&lt;li&gt;They’re currently maintained.&lt;/li&gt;
&lt;li&gt;They have good documentation available.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For each engine, you’ll learn about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Installation methods&lt;/li&gt;
&lt;li&gt;Basic concepts, as well as assumptions that the engine makes&lt;/li&gt;
&lt;li&gt;Major features and capabilities&lt;/li&gt;
&lt;li&gt;Two game implementations, to allow for comparison&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Where appropriate, you should install these game engines in a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;. Full source code for the games in this tutorial is available for download at the link below and will be referenced throughout the article:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/top-python-game-engines-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-top-python-game-engines-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to try out Python game engines.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;With the source code downloaded, you’re ready to begin.&lt;/p&gt;
&lt;h2 id=&quot;pygame&quot;&gt;Pygame&lt;a class=&quot;headerlink&quot; href=&quot;#pygame&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When people think of Python game engines, the first thought many have is &lt;a href=&quot;https://www.pygame.org&quot;&gt;Pygame&lt;/a&gt;. In fact, there’s already &lt;a href=&quot;https://realpython.com/pygame-a-primer/&quot;&gt;a great primer on Pygame&lt;/a&gt; available at Real Python.&lt;/p&gt;
&lt;p&gt;Written as a replacement for the stalled PySDL library, Pygame wraps and extends the &lt;a href=&quot;https://www.libsdl.org/&quot;&gt;SDL library&lt;/a&gt;, which stands for &lt;strong&gt;Simple DirectMedia Layer&lt;/strong&gt;. SDL provides cross-platform access to your system’s underlying multimedia hardware components, such as sound, video, mouse, keyboard, and joystick. The cross-platform nature of both SDL and Pygame means that you can write games and rich multimedia Python programs for every platform that supports them!&lt;/p&gt;
&lt;h3 id=&quot;pygame-installation&quot;&gt;Pygame Installation&lt;a class=&quot;headerlink&quot; href=&quot;#pygame-installation&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/top-python-game-engines/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/top-python-game-engines/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Testing Your Code With pytest</title>
      <id>https://realpython.com/courses/testing-your-code-with-pytest/</id>
      <link href="https://realpython.com/courses/testing-your-code-with-pytest/"/>
      <updated>2022-05-03T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to take your testing to the next level with pytest. You&#x27;ll cover intermediate and advanced pytest features such as fixtures, marks, parameters, and plugins. With pytest, you can make your test suites fast, effective, and less painful to maintain.</summary>
      <content type="html">
        &lt;p&gt;&lt;a href=&quot;https://realpython.com/python-testing/&quot;&gt;Testing your code&lt;/a&gt; brings a wide variety of benefits. It increases your confidence that the code behaves as you expect and ensures that changes to your code won&amp;rsquo;t cause regressions. Writing and maintaining tests is hard work, so you should leverage all the tools at your disposal to make it as painless as possible. &lt;a href=&quot;https://docs.pytest.org/&quot;&gt;pytest&lt;/a&gt; is one of the best tools you can use to boost your testing productivity.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;strong&gt;benefits&lt;/strong&gt; pytest offers&lt;/li&gt;
&lt;li&gt;How to ensure your tests are &lt;strong&gt;stateless&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to make repetitious tests more &lt;strong&gt;comprehensible&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to run &lt;strong&gt;subsets&lt;/strong&gt; of tests by name or custom groups&lt;/li&gt;
&lt;li&gt;How to create and maintain &lt;strong&gt;reusable&lt;/strong&gt; testing utilities&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s min() and max(): Find Smallest and Largest Values</title>
      <id>https://realpython.com/python-min-and-max/</id>
      <link href="https://realpython.com/python-min-and-max/"/>
      <updated>2022-05-02T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to use Python&#x27;s built-in min() and max() functions to find the smallest and largest values. You&#x27;ll also learn how to modify their standard behavior by providing a suitable key function. Finally, you&#x27;ll code a few practical examples of using min() and max().</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s built-in &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; functions come in handy when you need to find the &lt;strong&gt;smallest&lt;/strong&gt; and &lt;strong&gt;largest&lt;/strong&gt; values in an &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-iterable&quot;&gt;iterable&lt;/a&gt; or in a series of &lt;strong&gt;regular arguments&lt;/strong&gt;. Even though these might seem like fairly basic computations, they turn out to have many interesting use cases in real-world programing. You’ll try out some of those use cases here.&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;Use Python’s &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; to find &lt;strong&gt;smallest&lt;/strong&gt; and &lt;strong&gt;largest&lt;/strong&gt; values in your data&lt;/li&gt;
&lt;li&gt;Call &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; with a single &lt;strong&gt;iterable&lt;/strong&gt; or with any number of &lt;strong&gt;regular arguments&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; with &lt;strong&gt;strings&lt;/strong&gt; and &lt;strong&gt;dictionaries&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Tweak the behavior of &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; with the &lt;strong&gt;&lt;code&gt;key&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;default&lt;/code&gt;&lt;/strong&gt; arguments&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;comprehensions&lt;/strong&gt; and &lt;strong&gt;generator expressions&lt;/strong&gt; as arguments to &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once you have this knowledge under your belt, then you’ll be prepared to write a bunch of practical examples that will showcase the usefulness of &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt;. Finally, you’ll code your own versions of &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; in pure Python, which can help you understand how these functions work internally.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-mastery-course/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-mastery-course&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you’ll need to take your Python skills to the next level.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To get the most out of this tutorial, you should have some previous knowledge of Python programming, including topics like &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/list-comprehension-python/&quot;&gt;list comprehensions&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/introduction-to-python-generators/#building-generators-with-generator-expressions&quot;&gt;generator expressions&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;getting-started-with-pythons-min-and-max-functions&quot;&gt;Getting Started With Python’s &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; Functions&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-pythons-min-and-max-functions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python includes several &lt;a href=&quot;https://docs.python.org/3/library/functions.html&quot;&gt;built-in functions&lt;/a&gt; that make your life more pleasant and productive because they mean you don’t need to reinvent the wheel. Two examples of these functions are &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt;. They mostly apply to &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-iterable&quot;&gt;iterables&lt;/a&gt;, but you can use them with multiple regular arguments as well. What’s their job? They take care of &lt;em&gt;finding the smallest and largest values&lt;/em&gt; in their input data.&lt;/p&gt;
&lt;p&gt;Whether you’re using Python’s &lt;code&gt;min()&lt;/code&gt; or &lt;code&gt;max()&lt;/code&gt;, you can use the function to achieve two slightly different behaviors. The standard behavior for each is to &lt;a href=&quot;https://realpython.com/python-return-statement/&quot;&gt;return&lt;/a&gt; the minimum or maximum value through straightforward comparison of the input data as it stands. The alternative behavior is to use a single-argument function to modify the comparison criteria before finding the smallest and largest values.&lt;/p&gt;
&lt;p&gt;To explore the standard behavior of &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt;, you can start by calling each function with either a single iterable as an argument or with two or more regular arguments. That’s what you’ll do right away.&lt;/p&gt;
&lt;h3 id=&quot;calling-min-and-max-with-a-single-iterable-argument&quot;&gt;Calling &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; With a Single Iterable Argument&lt;a class=&quot;headerlink&quot; href=&quot;#calling-min-and-max-with-a-single-iterable-argument&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The built-in &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; have two different signatures that allow you to call them either with an iterable as their first argument or with two or more regular arguments. The signature that accepts a single iterable argument looks something like this: &lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iterable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;minimum_value&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iterable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;maximum_value&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Both functions take a required argument called &lt;code&gt;iterable&lt;/code&gt; and return the minimum and maximum values respectively. They also take two optional &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/#keyword-only-arguments&quot;&gt;keyword-only&lt;/a&gt; arguments: &lt;code&gt;default&lt;/code&gt; and &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; In the above signatures, the asterisk (&lt;code&gt;*&lt;/code&gt;) means that the following arguments are keyword-only arguments, while the square brackets (&lt;code&gt;[]&lt;/code&gt;) denote that the enclosed content is optional.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Here’s a summary of what the arguments to &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; do:&lt;/p&gt;
&lt;div class=&quot;table-responsive&quot;&gt;
&lt;table class=&quot;table table-hover&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th class=&quot;text-left&quot;&gt;Argument&lt;/th&gt;
&lt;th class=&quot;text-left&quot;&gt;Description&lt;/th&gt;
&lt;th&gt;Required&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;&lt;code&gt;iterable&lt;/code&gt;&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;Takes an iterable object, like a &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;list, tuple&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt;, or &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;&lt;code&gt;default&lt;/code&gt;&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;Holds a value to return if the input iterable is empty&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;Accepts a single-argument function to customize the comparison criteria&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Later in this tutorial, you’ll learn more about the optional &lt;code&gt;default&lt;/code&gt; and &lt;code&gt;key&lt;/code&gt; arguments. For now, just focus on the &lt;code&gt;iterable&lt;/code&gt; argument, which is a required argument that leverages the standard behavior of &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; in Python:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-5&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([])&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;ValueError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;min() arg is an empty sequence&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;9&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([])&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;ValueError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;max() arg is an empty sequence&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In these examples, you call &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; with a list of integer &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;numbers&lt;/a&gt; and then with an empty list. The first call to &lt;code&gt;min()&lt;/code&gt; returns the smallest number in the input list, &lt;code&gt;-5&lt;/code&gt;. In contrast, the first call to &lt;code&gt;max()&lt;/code&gt; returns the largest number in the list, or &lt;code&gt;9&lt;/code&gt;. If you pass an empty iterator to &lt;code&gt;min()&lt;/code&gt; or &lt;code&gt;max()&lt;/code&gt;, then you get a &lt;code&gt;ValueError&lt;/code&gt; because there’s nothing to do on an empty iterable.&lt;/p&gt;
&lt;p&gt;An important detail to note about &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; is that all the values in the input iterable must be comparable. Otherwise, you get an error. For example, numeric values work okay:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;5.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-5&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;5.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;9&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;These examples combine &lt;code&gt;int&lt;/code&gt; and &lt;code&gt;float&lt;/code&gt; numbers in the calls to &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt;. You get the expected result in both cases because these data types are comparable.&lt;/p&gt;
&lt;p&gt;However, what would happen if you mixed &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt; and numbers? Check out the following examples:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;5.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-5&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;TypeError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;&#x27;&amp;lt;&#x27; not supported between instances of &#x27;str&#x27; and &#x27;int&#x27;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;5.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;-5&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;TypeError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;&#x27;&amp;gt;&#x27; not supported between instances of &#x27;str&#x27; and &#x27;int&#x27;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-min-and-max/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-min-and-max/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Real Python at PyCon US 2022</title>
      <id>https://realpython.com/real-python-pycon-us-2022/</id>
      <link href="https://realpython.com/real-python-pycon-us-2022/"/>
      <updated>2022-04-29T17:15:00+00:00</updated>
      <summary>PyCon US is finally happening in person again. If you&#x27;re in Salt Lake City, then come meet us at our Real Python booth and join our open space!</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;PyCon US is back as an in-person conference. &lt;a href=&quot;https://us.pycon.org/2022/&quot;&gt;PyCon US 2022&lt;/a&gt; is happening in &lt;a href=&quot;https://en.wikipedia.org/wiki/Salt_Lake_City&quot;&gt;Salt Lake City&lt;/a&gt; April 29 to May 1, and Real Python is there as well. Come join us at &lt;strong&gt;our booth&lt;/strong&gt; and at the &lt;strong&gt;open space&lt;/strong&gt; on Saturday.&lt;/p&gt;
&lt;p&gt;In this article, you’ll learn where you can find &lt;strong&gt;Real Python&lt;/strong&gt; at PyCon in Salt Lake City, and get to know what some of our team members are excited about at the conference.&lt;/p&gt;
&lt;h2 id=&quot;meet-real-python-at-pycon-us-2022&quot;&gt;Meet Real Python at PyCon US 2022&lt;a class=&quot;headerlink&quot; href=&quot;#meet-real-python-at-pycon-us-2022&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&quot;https://realpython.com/pycon-guide/&quot;&gt;PyCon US&lt;/a&gt; conference has been an annual meeting place for the Python community since 2003. Because of the COVID pandemic, the conference went virtual in 2020 and 2021. At Real Python, we’re excited about being able to meet in person this year. Come say hello if you’re in Salt Lake City!&lt;/p&gt;
&lt;h3 id=&quot;visit-the-real-python-booth&quot;&gt;Visit the Real Python Booth&lt;a class=&quot;headerlink&quot; href=&quot;#visit-the-real-python-booth&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The exhibit hall is a lively place at any PyCon conference. Here, you can stroll around and chat with other attendees while exploring what sponsors and exhibitors have brought to the table. It’s a great place to hang out and make new friends!&lt;/p&gt;
&lt;p&gt;Real Python has a booth at this year’s conference. We’re excited about having our own place to hang out and show our content to everyone. You can find us at &lt;strong&gt;booth 228&lt;/strong&gt;, which is just opposite Microsoft and AWS. Look for our logo and friendly faces—we’ll be smiling with our eyes!&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/CDDC3BFB-878C-434D-813F-5833E47AA2EE.a773537892c1.jpeg&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/CDDC3BFB-878C-434D-813F-5833E47AA2EE.a773537892c1.jpeg&quot; width=&quot;1600&quot; height=&quot;1200&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/CDDC3BFB-878C-434D-813F-5833E47AA2EE.a773537892c1.jpeg&amp;amp;w=400&amp;amp;sig=e5d5acf2d4cfa8c0682de8bf3ed5fc6dccf1a0ae 400w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/CDDC3BFB-878C-434D-813F-5833E47AA2EE.a773537892c1.jpeg&amp;amp;w=800&amp;amp;sig=e93645680559f59d632eaa6bebfb4fdac0309066 800w, https://files.realpython.com/media/CDDC3BFB-878C-434D-813F-5833E47AA2EE.a773537892c1.jpeg 1600w&quot; sizes=&quot;75vw&quot; alt=&quot;Real Python team members at PyCon 2022&quot; data-asset=&quot;4344&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;Stop by the booth to hear about all the content that we offer, or have a chat about your favorite packages, square roots, or the latest developments in Python.&lt;/p&gt;
&lt;h3 id=&quot;join-our-open-space&quot;&gt;Join Our Open Space&lt;a class=&quot;headerlink&quot; href=&quot;#join-our-open-space&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://realpython.com/pycon-guide/#open-spaces&quot;&gt;open spaces&lt;/a&gt; are a unique staple of PyCon. These are self-organized one-hour meetup-like &lt;a href=&quot;https://us.pycon.org/2022/events/open-spaces/&quot;&gt;events&lt;/a&gt; that are happening throughout the conference. Check out the &lt;a href=&quot;http://pycon.us/os&quot;&gt;Open Space board&lt;/a&gt; to see if there’s anything that you’d like to join!&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/real-python-pycon-us-2022/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/real-python-pycon-us-2022/ »&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>Why Is It Important to Close Files in Python?</title>
      <id>https://realpython.com/why-close-file-python/</id>
      <link href="https://realpython.com/why-close-file-python/"/>
      <updated>2022-04-27T14:00:00+00:00</updated>
      <summary>Model citizens use context managers to open and close file resources in Python, but have you ever wondered why it&#x27;s important to close files? In this tutorial, you&#x27;ll take a deep dive into the reasons why it&#x27;s important to close files and what can happen if you dont.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;At some point in your Python coding journey, you learn that you should use a &lt;strong&gt;context manager&lt;/strong&gt; to open files. Python context managers make it easy to &lt;strong&gt;close your files&lt;/strong&gt; once you’re done with them:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;hello.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;w&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, World!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;a href=&quot;https://realpython.com/python-with-statement/&quot;&gt;&lt;code&gt;with&lt;/code&gt; statement&lt;/a&gt; initiates a context manager. In this example, the context manager &lt;a href=&quot;https://realpython.com/read-write-files-python/#opening-and-closing-a-file-in-python&quot;&gt;opens&lt;/a&gt; the file &lt;code&gt;hello.txt&lt;/code&gt; and &lt;strong&gt;manages&lt;/strong&gt; the file resource as long as the &lt;strong&gt;context&lt;/strong&gt; is active. In general, all the code in the indented block depends on the file object being open. Once the indented block either ends or raises an exception, then the file will close.&lt;/p&gt;
&lt;p&gt;If you’re not using a context manager or you’re working in a different language, then you might explicitly close files with the &lt;a href=&quot;https://realpython.com/python-with-statement/#the-try-finally-approach&quot;&gt;&lt;code&gt;try&lt;/code&gt; … &lt;code&gt;finally&lt;/code&gt; approach&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;hello.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;w&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, World!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;finally&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;finally&lt;/code&gt; block that closes the file runs unconditionally, whether the &lt;code&gt;try&lt;/code&gt; block succeeds or fails. While this syntax effectively closes the file, the Python context manager offers less verbose and more intuitive syntax. Additionally, it’s a bit more &lt;a href=&quot;https://docs.python.org/3/reference/compound_stmts.html#the-with-statement&quot;&gt;flexible&lt;/a&gt; than simply wrapping your code with &lt;code&gt;try&lt;/code&gt; … &lt;code&gt;finally&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You probably use context managers to manage files already, but have you ever wondered why most tutorials and four out of five dentists recommend doing this? In short, &lt;strong&gt;why is it important to close files in Python?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll dive into that very question. First, you’ll learn about how file handles are a &lt;strong&gt;limited resource&lt;/strong&gt;. Then you’ll experiment with the &lt;strong&gt;consequences&lt;/strong&gt; of not closing your files.&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 Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/cpython-internals-sample/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-cpython-internals-sample&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Get a sample chapter from CPython Internals: Your Guide to the Python 3 Interpreter&lt;/a&gt; showing you how to unlock the inner workings of the Python language, compile the Python interpreter from source  code, and participate in the development of CPython.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;in-short-files-are-resources-limited-by-the-operating-system&quot;&gt;In Short: Files Are Resources Limited by the Operating System&lt;a class=&quot;headerlink&quot; href=&quot;#in-short-files-are-resources-limited-by-the-operating-system&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python delegates file operations to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Operating_system&quot;&gt;&lt;strong&gt;operating system&lt;/strong&gt;&lt;/a&gt;. The operating system is the mediator between &lt;a href=&quot;https://en.wikipedia.org/wiki/Process_(computing)&quot;&gt;&lt;strong&gt;processes&lt;/strong&gt;&lt;/a&gt;, such as Python, and all the &lt;strong&gt;system resources&lt;/strong&gt;, such as the hard drive, RAM, and CPU time.&lt;/p&gt;
&lt;p&gt;When you open a file with &lt;code&gt;open()&lt;/code&gt;, you make a &lt;a href=&quot;https://en.wikipedia.org/wiki/System_call&quot;&gt;&lt;strong&gt;system call&lt;/strong&gt;&lt;/a&gt; to the operating system to locate that file on the hard drive and prepare it for reading or writing. The operating system will then return an &lt;a href=&quot;https://realpython.com/python-bitwise-operators/#unsigned-integers&quot;&gt;unsigned integer&lt;/a&gt; called a &lt;strong&gt;file handle&lt;/strong&gt; on Windows and a &lt;strong&gt;file descriptor&lt;/strong&gt; on UNIX-like systems, including Linux and macOS:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/open_file.b4d0477f04f1.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/open_file.b4d0477f04f1.png&quot; width=&quot;3200&quot; height=&quot;1238&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/open_file.b4d0477f04f1.png&amp;amp;w=800&amp;amp;sig=bc83f051172a23f6a7b291b2113712a6e2c35727 800w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/open_file.b4d0477f04f1.png&amp;amp;w=1600&amp;amp;sig=ed37c3e326e87827fedae6bc89cab11778fb791d 1600w, https://files.realpython.com/media/open_file.b4d0477f04f1.png 3200w&quot; sizes=&quot;75vw&quot; alt=&quot;Illustration of Python making a system call for a file handle&quot; data-asset=&quot;4331&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;A Python process making a system call and getting the integer 10 as the file handle&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Once you have the number associated with the file, you’re ready to do &lt;a href=&quot;https://realpython.com/read-write-files-python/&quot;&gt;read or write operations&lt;/a&gt;. Whenever Python wants to read, write, or close the file, it’ll make another system call, providing the file handle number. The Python file object has a &lt;code&gt;.fileno()&lt;/code&gt; method that you can use to find the file handle:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;with&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;test_file.txt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;w&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&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;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fileno&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;.fileno()&lt;/code&gt; method on the opened file object will return the integer used by the operating system as a file descriptor. Just like how you might use an ID field to get a record from a database, Python provides this number to the operating system every time it reads or writes from a file.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/why-close-file-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/why-close-file-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 #107: Type-Safe ORM With Prisma Client &amp; Real Python at PyCon US 2022</title>
      <id>https://realpython.com/podcasts/rpp/107/</id>
      <link href="https://realpython.com/podcasts/rpp/107/"/>
      <updated>2022-04-22T12:00:00+00:00</updated>
      <summary>Are you using an Object-Relational Mapper (ORM) for your Python projects? What if it could work with SQL or No-SQL databases and be fully type-safe? This week on the show, Robert Craigie talks about Prisma Client Python.</summary>
      <content type="html">
        &lt;p&gt;Are you using an Object-Relational Mapper (ORM) for your Python projects? What if it could work with SQL or No-SQL databases and be fully type-safe? This week on the show, Robert Craigie talks about Prisma Client 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>Building a Django User Management System</title>
      <id>https://realpython.com/courses/building-a-django-user-management-system/</id>
      <link href="https://realpython.com/courses/building-a-django-user-management-system/"/>
      <updated>2022-04-19T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to extend your Django application with a user management system, complete with email sending and third-party authentication.</summary>
      <content type="html">
        &lt;p&gt;If you&amp;rsquo;re building your own Django applications, you might decide to extend them with user accounts. In this video course, you&amp;rsquo;ll learn how to work with Django user management and add it to your program.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll be able to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create an application where users can &lt;strong&gt;register&lt;/strong&gt;, &lt;strong&gt;log in&lt;/strong&gt;, and &lt;strong&gt;reset&lt;/strong&gt; and &lt;strong&gt;change passwords&lt;/strong&gt; on their own&lt;/li&gt;
&lt;li&gt;Edit the default &lt;strong&gt;Django templates&lt;/strong&gt; responsible for &lt;strong&gt;user management&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Send password reset emails&lt;/strong&gt; to actual email addresses&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Authenticate&lt;/strong&gt; using an &lt;strong&gt;external service&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You may find it useful to complete &lt;a href=&quot;https://realpython.com/courses/django-portfolio-project/&quot;&gt;Get Started With Django: Build a Portfolio App&lt;/a&gt; before beginning this course. However, you can also apply Django user management to any Django apps that you&amp;rsquo;ve created.&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 #106: Class Constructors &amp; Pythonic Image Processing</title>
      <id>https://realpython.com/podcasts/rpp/106/</id>
      <link href="https://realpython.com/podcasts/rpp/106/"/>
      <updated>2022-04-15T12:00:00+00:00</updated>
      <summary>Do you know the difference between creating a class instance and initializing it? Would you like an interactive tour of the Python Pillow library? This week on the show, Christopher Trudeau is here, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Do you know the difference between creating a class instance and initializing it? Would you like an interactive tour of the Python Pillow library? This week on the show, Christopher Trudeau is here, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Exploring Keywords in Python</title>
      <id>https://realpython.com/courses/exploring-keywords-in-python/</id>
      <link href="https://realpython.com/courses/exploring-keywords-in-python/"/>
      <updated>2022-04-12T14:00:00+00:00</updated>
      <summary>Python keywords make up the fundamental building blocks of any Python program. In this video course, you&#x27;ll learn the basic syntax and usage for each of Python&#x27;s thirty-five keywords so you can write more efficient and readable code.</summary>
      <content type="html">
        &lt;p&gt;Every programming language has special reserved words, or &lt;strong&gt;keywords&lt;/strong&gt;, that have specific meanings and restrictions around how they should be used. Python is no different. Python keywords are the fundamental building blocks of any Python program. &lt;/p&gt;
&lt;p&gt;In this video course, you&amp;rsquo;ll find a basic introduction to all Python keywords along with other resources that will be helpful for learning more about each keyword.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll be able to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Identify&lt;/strong&gt; Python keywords&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Understand&lt;/strong&gt; what each keyword is used for&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Work&lt;/strong&gt; with keywords programmatically using the &lt;code&gt;keyword&lt;/code&gt; module&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #105: Creating Better Error Messages for Python 3.10 &amp; 3.11</title>
      <id>https://realpython.com/podcasts/rpp/105/</id>
      <link href="https://realpython.com/podcasts/rpp/105/"/>
      <updated>2022-04-08T12:00:00+00:00</updated>
      <summary>What goes into creating those enhanced error messages in the latest versions of Python? How does the new PEG parser help to pinpoint where errors have occurred? This week on the show, Pablo Galindo Salgado talks about the work that goes into creating these improvements.</summary>
      <content type="html">
        &lt;p&gt;What goes into creating those enhanced error messages in the latest versions of Python? How does the new PEG parser help to pinpoint where errors have occurred? This week on the show, Pablo Galindo Salgado talks about the work that goes into creating these improvements.&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 REST APIs With FastAPI</title>
      <id>https://realpython.com/courses/python-rest-apis-with-fastapi/</id>
      <link href="https://realpython.com/courses/python-rest-apis-with-fastapi/"/>
      <updated>2022-04-05T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn the main concepts of FastAPI and how to use it to quickly create web APIs that implement best practices by default. By the end of it, you will be able to start creating production-ready web APIs.</summary>
      <content type="html">
        &lt;p&gt;Creating APIs, or &lt;strong&gt;application programming interfaces&lt;/strong&gt;, is an important part of making your software accessible to a broad range of users. In this video course, you&amp;rsquo;ll learn the main concepts of &lt;strong&gt;FastAPI&lt;/strong&gt; and how to use it to quickly create web APIs that implement best practices by default.&lt;/p&gt;
&lt;p&gt;By the end of it, you&amp;rsquo;ll be able to start creating production-ready web APIs, and you&amp;rsquo;ll have the understanding needed to go deeper and learn more for your specific use cases.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;path parameters&lt;/strong&gt; to get a unique URL path per item&lt;/li&gt;
&lt;li&gt;Receive JSON data in your requests using &lt;strong&gt;pydantic&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use API best practices, including &lt;strong&gt;validation&lt;/strong&gt;, &lt;strong&gt;serialization&lt;/strong&gt;, and &lt;strong&gt;documentation&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Continue learning about FastAPI for &lt;strong&gt;your use cases&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #104: Building a Hash Table in Python and Thoughtful REST API Design</title>
      <id>https://realpython.com/podcasts/rpp/104/</id>
      <link href="https://realpython.com/podcasts/rpp/104/"/>
      <updated>2022-04-01T12:00:00+00:00</updated>
      <summary>Do you understand how a hash table works? What if you could learn about building one while practicing test-driven development? What are best practices when designing a REST API? This week on the show, Christopher Trudeau is here, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Do you understand how a hash table works? What if you could learn about building one while practicing test-driven development? What are best practices when designing a REST API? This week on the show, Christopher Trudeau is here, and he&#x27;s brought 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>Using Python&#x27;s datetime Module</title>
      <id>https://realpython.com/courses/python-datetime-module/</id>
      <link href="https://realpython.com/courses/python-datetime-module/"/>
      <updated>2022-03-29T14:00:00+00:00</updated>
      <summary>Have you ever wondered about working with dates and times in Python? In this video course, you&#x27;ll learn all about the built-in Python datetime library. You&#x27;ll also learn about how to manage time zones and daylight saving time, and how to do accurate arithmetic on dates and times.</summary>
      <content type="html">
        &lt;p&gt;Python has several different modules to deal with dates and times. This course concentrates on the primary one, &lt;strong&gt;&lt;code&gt;datetime&lt;/code&gt;&lt;/strong&gt;. Dates and times are messy things! Shifts due to daylight savings time and time zones complicate any computing with dates and times. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll tackle that messiness and learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How to use the &lt;strong&gt;&lt;code&gt;datetime&lt;/code&gt;&lt;/strong&gt; module&lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;&lt;code&gt;zoneinfo&lt;/code&gt;&lt;/strong&gt; module does and how to use it&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;calculate the difference&lt;/strong&gt; between two &lt;code&gt;datetime&lt;/code&gt; objects&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #103: Becoming More Effective at Manipulating Data With Pandas</title>
      <id>https://realpython.com/podcasts/rpp/103/</id>
      <link href="https://realpython.com/podcasts/rpp/103/"/>
      <updated>2022-03-25T12:00:00+00:00</updated>
      <summary>Do you wonder if you&#x27;re taking the right approach when shaping data in pandas? Is your Jupyter workflow getting out of hand? This week on the show, Matt Harrison talks about his new book, &quot;Effective Pandas: Patterns for Data Manipulation.&quot;</summary>
      <content type="html">
        &lt;p&gt;Do you wonder if you&#x27;re taking the right approach when shaping data in pandas? Is your Jupyter workflow getting out of hand? This week on the show, Matt Harrison talks about his new book, &quot;Effective Pandas: Patterns for Data Manipulation.&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>Python Basics: Code Your First Python Program</title>
      <id>https://realpython.com/courses/python-basics-first-program/</id>
      <link href="https://realpython.com/courses/python-basics-first-program/"/>
      <updated>2022-03-22T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll write your first Python program. Along the way, you&#x27;ll learn about errors, declare variables and inspect their values, and try your hand at writing comments.</summary>
      <content type="html">
        &lt;p&gt;In the previous Python Basics video course, you &lt;a href=&quot;https://realpython.com/courses/setting-up-python/&quot;&gt;set up Python&lt;/a&gt; on your computer. With Python installed, you&amp;rsquo;re ready ready to start coding!&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;Write your &lt;strong&gt;first Python program&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Learn what happens when you run a program with an &lt;strong&gt;error&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Learn how to &lt;strong&gt;declare a variable&lt;/strong&gt; and &lt;strong&gt;inspect its value&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Learn how to &lt;strong&gt;write comments&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This course can be enjoyed alone or as an accompaniment to &lt;a href=&quot;http://pythonbasicsbook.com&quot;&gt;Python Basics: A Practical Introduction to Python 3&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Ready to begin your Python journey? Let&amp;rsquo;s go!&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 #102: Making Your Notebook Interactive and Using Python&#x27;s Assert</title>
      <id>https://realpython.com/podcasts/rpp/102/</id>
      <link href="https://realpython.com/podcasts/rpp/102/"/>
      <updated>2022-03-18T12:00:00+00:00</updated>
      <summary>Would you like to build visualizations that allow your audience to play with data? How do you effectively use Python&#x27;s assert statement during development? This week on the show, Christopher Trudeau is here, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Would you like to build visualizations that allow your audience to play with data? How do you effectively use Python&#x27;s assert statement during development? This week on the show, Christopher Trudeau is here, and he&#x27;s brought 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>Sorting Data in Python With Pandas</title>
      <id>https://realpython.com/courses/sorting-data-python-pandas/</id>
      <link href="https://realpython.com/courses/sorting-data-python-pandas/"/>
      <updated>2022-03-15T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to sort data in a pandas DataFrame using the pandas sort functions sort_values() and sort_index(). You&#x27;ll learn how to sort by one or more columns and by index in ascending or descending order.</summary>
      <content type="html">
        &lt;p&gt;Learning pandas &lt;strong&gt;sort methods&lt;/strong&gt; is a great way to start with or practice doing basic &lt;a href=&quot;https://realpython.com/pandas-python-explore-dataset/&quot;&gt;data analysis using Python&lt;/a&gt;. Most commonly, data analysis is done with &lt;a href=&quot;https://realpython.com/openpyxl-excel-spreadsheets-python/&quot;&gt;spreadsheets&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-sql-libraries/&quot;&gt;SQL&lt;/a&gt;, or &lt;a href=&quot;https://realpython.com/learning-paths/pandas-data-science/&quot;&gt;pandas&lt;/a&gt;. One of the great things about using pandas is that it can handle a large amount of data and offers highly performant data manipulation capabilities.&lt;/p&gt;
&lt;p&gt;In this video course, you&amp;rsquo;ll learn how to use &lt;code&gt;.sort_values()&lt;/code&gt; and &lt;code&gt;.sort_index()&lt;/code&gt;, which will enable you to sort data efficiently in a DataFrame.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this video course, you&amp;rsquo;ll know how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sort a &lt;strong&gt;pandas DataFrame&lt;/strong&gt; by the values of one or more columns&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;ascending&lt;/code&gt; parameter to change the &lt;strong&gt;sort order&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Sort a DataFrame by its &lt;code&gt;index&lt;/code&gt; using &lt;strong&gt;&lt;code&gt;.sort_index()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Organize &lt;strong&gt;missing data&lt;/strong&gt; while sorting values&lt;/li&gt;
&lt;li&gt;Sort a DataFrame &lt;strong&gt;in-place&lt;/strong&gt; using &lt;code&gt;inplace&lt;/code&gt; set to &lt;code&gt;True&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  

</feed>
