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

  
    <entry>
      <title>Using the len() Function in Python</title>
      <id>https://realpython.com/len-python-function/</id>
      <link href="https://realpython.com/len-python-function/"/>
      <updated>2021-10-20T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how and when to use the len() Python function. You&#x27;ll also learn how to customize your class definitions so that objects of a user-defined class can be used as arguments in len().</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In many situations, you’ll need to find the number of items stored in a data structure. Python’s built-in function &lt;code&gt;len()&lt;/code&gt; is the tool that will help you with this task.&lt;/p&gt;
&lt;p&gt;There are some cases in which the use of &lt;code&gt;len()&lt;/code&gt; is straightforward. However, there are other times when you’ll need to understand how this function works in more detail and how to apply it to different data types.&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;Find the length of  &lt;strong&gt;built-in data types&lt;/strong&gt; using &lt;code&gt;len()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;len()&lt;/code&gt; with &lt;strong&gt;third-party data types&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Provide support for &lt;code&gt;len()&lt;/code&gt; with &lt;strong&gt;user-defined classes&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By the end of this article, you’ll know when to use the &lt;code&gt;len()&lt;/code&gt; Python function and how to use it effectively. You’ll know which built-in data types are valid arguments for &lt;code&gt;len()&lt;/code&gt; and which ones you can’t use. You’ll also understand how to use &lt;code&gt;len()&lt;/code&gt; with third-party types, such as  &lt;code&gt;ndarray&lt;/code&gt; in &lt;a href=&quot;https://realpython.com/numpy-tutorial/&quot;&gt;NumPy&lt;/a&gt; and &lt;code&gt;DataFrame&lt;/code&gt; in &lt;a href=&quot;https://realpython.com/pandas-python-explore-dataset/&quot;&gt;pandas&lt;/a&gt;, and with your own classes.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-shortened&quot; data-focus=&quot;false&quot;&gt;Click here to get a Python Cheat Sheet&lt;/a&gt; and learn the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-pythons-len&quot;&gt;Getting Started With Python’s &lt;code&gt;len()&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-pythons-len&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The function &lt;a href=&quot;https://docs.python.org/3.9/library/functions.html?highlight=len#len&quot;&gt;&lt;code&gt;len()&lt;/code&gt;&lt;/a&gt; is one of Python’s built-in functions. It returns the length of an object. For example, it can return the number of items in a list. You can use the function with many different data types. However, not all data types are valid arguments for &lt;code&gt;len()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can start by looking at the help for this function:&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;help&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Help on built-in function len in module builtins:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;len(obj, /)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    Return the number of items in a container.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The function takes an object as an argument and returns the length of that object. The &lt;a href=&quot;https://docs.python.org/3/library/functions.html?highlight=len#len&quot;&gt;documentation&lt;/a&gt; for &lt;code&gt;len()&lt;/code&gt; goes a bit further:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set). (&lt;a href=&quot;https://docs.python.org/3/library/functions.html?highlight=len#len&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When you use built-in data types and many third-party types with &lt;code&gt;len()&lt;/code&gt;, the function doesn’t need to iterate through the data structure. The length of a container object is stored as an attribute of the object. The value of this attribute is modified each time items are added to or removed from the data structure, and &lt;code&gt;len()&lt;/code&gt; returns the value of the length attribute. This ensures that &lt;code&gt;len()&lt;/code&gt; works efficiently.&lt;/p&gt;
&lt;p&gt;In the following sections, you’ll learn about how to use &lt;code&gt;len()&lt;/code&gt; with sequences and collections. You’ll also learn about some data types that you cannot use as arguments for the &lt;code&gt;len()&lt;/code&gt; Python function.&lt;/p&gt;
&lt;h3 id=&quot;using-len-with-built-in-sequences&quot;&gt;Using &lt;code&gt;len()&lt;/code&gt; With Built-in Sequences&lt;a class=&quot;headerlink&quot; href=&quot;#using-len-with-built-in-sequences&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A &lt;strong&gt;sequence&lt;/strong&gt; is a container with ordered items. &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;Lists, tuples&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt; are three of the basic built-in sequences in Python. You can find the length of a sequence by calling &lt;code&gt;len()&lt;/code&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;greeting&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Good Day!&quot;&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;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;greeting&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;n&quot;&gt;office_days&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;Tuesday&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Thursday&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Friday&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;office_days&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3&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;london_coordinates&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;51.50722&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;mf&quot;&gt;0.1275&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;london_coordinates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When finding the length of the string &lt;code&gt;greeting&lt;/code&gt;, the list &lt;code&gt;office_days&lt;/code&gt;, and the tuple &lt;code&gt;london_coordinates&lt;/code&gt;, you use &lt;code&gt;len()&lt;/code&gt; in the same manner. All three data types are valid arguments for &lt;code&gt;len()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The function &lt;code&gt;len()&lt;/code&gt; always returns an integer as it’s counting the number of items in the object that you pass to it. The function returns &lt;code&gt;0&lt;/code&gt; if the argument is an empty sequence:&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;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(())&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the examples above, you find the length of an empty string, an empty list, and an empty tuple. The function returns &lt;code&gt;0&lt;/code&gt; in each case.&lt;/p&gt;
&lt;p&gt;A &lt;code&gt;range&lt;/code&gt; object is also a sequence that you can create using &lt;a href=&quot;https://realpython.com/python-range/&quot;&gt;&lt;code&gt;range()&lt;/code&gt;&lt;/a&gt;. A &lt;code&gt;range&lt;/code&gt; object doesn’t store all the values but generates them when they’re needed. However, you can still find the length of a &lt;code&gt;range&lt;/code&gt; object using &lt;code&gt;len()&lt;/code&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;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This range of numbers includes the integers from &lt;code&gt;1&lt;/code&gt; to &lt;code&gt;19&lt;/code&gt; with increments of &lt;code&gt;2&lt;/code&gt;. The length of a &lt;code&gt;range&lt;/code&gt; object can be determined from the start, stop, and step values.&lt;/p&gt;
&lt;p&gt;In this section, you’ve used the &lt;code&gt;len()&lt;/code&gt; Python function with strings, lists, tuples, and &lt;code&gt;range&lt;/code&gt; objects. However, you can also use the function with any other built-in sequence.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/len-python-function/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/len-python-function/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Assignment Expressions and Using the Walrus Operator</title>
      <id>https://realpython.com/courses/python-assignment-expressions-walrus-operator/</id>
      <link href="https://realpython.com/courses/python-assignment-expressions-walrus-operator/"/>
      <updated>2021-10-19T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn about assignment expressions and the walrus operator. The biggest change in Python 3.8 was the inclusion of the := operator, which you can use to assign variables in the middle of expressions. You&#x27;ll see several examples of how to take advantage of this new feature.</summary>
      <content type="html">
        &lt;p&gt;Each new version of Python adds new features to the language. For Python 3.8, the biggest change is the addition of &lt;strong&gt;assignment expressions&lt;/strong&gt;. Specifically, the &lt;code&gt;:=&lt;/code&gt; operator gives you a new syntax for assigning variables in the middle of expressions. This operator is colloquially known as the &lt;strong&gt;walrus operator&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This course is an in-depth introduction to the walrus operator. You&amp;rsquo;ll learn some of the motivations for the syntax update and explore some examples where assignment expressions can be useful.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Identify &lt;strong&gt;the walrus operator&lt;/strong&gt; and understand its meaning&lt;/li&gt;
&lt;li&gt;Understand &lt;strong&gt;use cases&lt;/strong&gt; for the walrus operator&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Avoid repetitive code&lt;/strong&gt; by using the walrus operator&lt;/li&gt;
&lt;li&gt;Convert between code using the walrus operator and code using &lt;strong&gt;other assignment methods&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Understand the impacts on &lt;strong&gt;backward compatibility&lt;/strong&gt; when using the walrus operator&lt;/li&gt;
&lt;li&gt;Use appropriate &lt;strong&gt;style&lt;/strong&gt; in your assignment expressions&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>A Roadmap to XML Parsers in Python</title>
      <id>https://realpython.com/python-xml-parser/</id>
      <link href="https://realpython.com/python-xml-parser/"/>
      <updated>2021-10-18T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn what XML parsers are available in Python and how to pick the right parsing model for your specific use case. You&#x27;ll explore Python&#x27;s built-in parsers as well as major third-party libraries.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you’ve ever tried to parse an &lt;strong&gt;XML document&lt;/strong&gt; in Python before, then you know how surprisingly difficult such a task can be. On the one hand, the &lt;a href=&quot;https://www.python.org/dev/peps/pep-0020/&quot;&gt;Zen of Python&lt;/a&gt; promises only one obvious way to achieve your goal. At the same time, the standard library follows the &lt;a href=&quot;https://docs.python.org/3/tutorial/stdlib.html#batteries-included&quot;&gt;batteries included&lt;/a&gt; motto by letting you choose from not one but several XML parsers. Luckily, the Python community solved this surplus problem by creating even more XML parsing libraries. &lt;/p&gt;
&lt;p&gt;Jokes aside, all XML parsers have their place in a world full of smaller or bigger challenges. It’s worthwhile to familiarize yourself with the available tools.&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;Choose the right XML &lt;strong&gt;parsing model&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use the XML parsers in the &lt;strong&gt;standard library&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use major XML parsing &lt;strong&gt;libraries&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Parse XML documents declaratively using &lt;strong&gt;data binding&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use safe XML parsers to eliminate &lt;strong&gt;security vulnerabilities&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can use this tutorial as a &lt;strong&gt;roadmap&lt;/strong&gt; to guide you through the confusing world of XML parsers in Python. By the end of it, you’ll be able to pick the right XML parser for a given problem. To get the most out of this tutorial, you should already be familiar with &lt;a href=&quot;https://en.wikipedia.org/wiki/XML&quot;&gt;XML&lt;/a&gt; and its building blocks, as well as how to &lt;a href=&quot;https://realpython.com/working-with-files-in-python/&quot;&gt;work with files in Python&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;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;choose-the-right-xml-parsing-model&quot;&gt;Choose the Right XML Parsing Model&lt;a class=&quot;headerlink&quot; href=&quot;#choose-the-right-xml-parsing-model&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It turns out that you can process XML documents using a few language-agnostic strategies. Each demonstrates different memory and speed trade-offs, which can partially justify the wide range of XML parsers available in Python. In the following section, you’ll find out their differences and strengths.&lt;/p&gt;
&lt;h3 id=&quot;document-object-model-dom&quot;&gt;Document Object Model (DOM)&lt;a class=&quot;headerlink&quot; href=&quot;#document-object-model-dom&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Historically, the first and the most widespread model for parsing XML has been the DOM, or the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model&quot;&gt;Document Object Model&lt;/a&gt;, originally defined by the World Wide Web Consortium (W3C). You might have already heard about the DOM because web browsers expose a DOM interface through &lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt; to let you manipulate the HTML code of your websites. Both XML and HTML belong to the same family of &lt;a href=&quot;https://en.wikipedia.org/wiki/Markup_language&quot;&gt;markup languages&lt;/a&gt;, which makes parsing XML with the DOM possible.&lt;/p&gt;
&lt;p&gt;The DOM is arguably the most straightforward and versatile model to use. It defines a handful of &lt;strong&gt;standard operations&lt;/strong&gt; for traversing and modifying document elements arranged in a hierarchy of objects. An abstract representation of the entire document tree is stored in memory, giving you &lt;strong&gt;random access&lt;/strong&gt; to the individual elements.&lt;/p&gt;
&lt;p&gt;While the DOM tree allows for fast and &lt;strong&gt;omnidirectional navigation&lt;/strong&gt;, building its abstract representation in the first place can be time-consuming. Moreover, the XML gets &lt;strong&gt;parsed at once&lt;/strong&gt;, as a whole, so it has to be reasonably small to fit the available memory. This renders the DOM suitable only for moderately large configuration files rather than multi-gigabyte &lt;a href=&quot;https://en.wikipedia.org/wiki/XML_database&quot;&gt;XML databases&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Use a DOM parser when convenience is more important than processing time and when memory is not an issue. Some typical use cases are when you need to parse a relatively small document or when you only need to do the parsing infrequently.&lt;/p&gt;
&lt;h3 id=&quot;simple-api-for-xml-sax&quot;&gt;Simple API for XML (SAX)&lt;a class=&quot;headerlink&quot; href=&quot;#simple-api-for-xml-sax&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To address the shortcomings of the DOM, the Java community came up with a library through a collaborative effort, which then became an alternative model for parsing XML in other languages. There was no formal specification, only organic discussions on a mailing list. The end result was an &lt;strong&gt;event-based streaming API&lt;/strong&gt; that operates sequentially on individual elements rather than the whole tree.&lt;/p&gt;
&lt;p&gt;Elements are processed from top to bottom in the same order they appear in the document. The parser triggers user-defined &lt;a href=&quot;https://en.wikipedia.org/wiki/Callback_(computer_programming)&quot;&gt;callbacks&lt;/a&gt; to handle specific XML nodes as it finds them in the document. This approach is known as &lt;strong&gt;“push” parsing&lt;/strong&gt; because elements are pushed to your functions by the parser.&lt;/p&gt;
&lt;p&gt;SAX also lets you discard elements if you’re not interested in them. This means it has a much lower memory footprint than DOM and can deal with arbitrarily large files, which is great for &lt;strong&gt;single-pass processing&lt;/strong&gt; such as indexing, conversion to other formats, and so on.&lt;/p&gt;
&lt;p&gt;However, finding or modifying random tree nodes is cumbersome because it usually requires multiple passes on the document and tracking the visited nodes. SAX is also inconvenient for handling deeply nested elements. Finally, the SAX model just allows for &lt;strong&gt;read-only&lt;/strong&gt; parsing.&lt;/p&gt;
&lt;p&gt;In short, SAX is cheap in terms of space and time but more difficult to use than DOM in most cases. It works well for parsing very large documents or parsing incoming XML data in real time.&lt;/p&gt;
&lt;h3 id=&quot;streaming-api-for-xml-stax&quot;&gt;Streaming API for XML (StAX)&lt;a class=&quot;headerlink&quot; href=&quot;#streaming-api-for-xml-stax&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Although somewhat less popular in Python, this third approach to parsing XML builds on top of SAX. It extends the idea of &lt;strong&gt;streaming&lt;/strong&gt; but uses a &lt;strong&gt;“pull” parsing&lt;/strong&gt; model instead, which gives you more control. You can think of StAX as an &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-iterator&quot;&gt;iterator&lt;/a&gt; advancing a &lt;strong&gt;cursor object&lt;/strong&gt; through an XML document, where custom handlers call the parser on demand and not the other way around.&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; It’s possible to combine more than one XML parsing model. For example, you can use SAX or StAX to quickly find an interesting piece of data in the document and then build a DOM representation of only that particular branch in memory.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Using StAX gives you more control over the parsing process and allows for more convenient &lt;strong&gt;state management&lt;/strong&gt;. The events in the stream are only consumed when requested, enabling &lt;a href=&quot;https://en.wikipedia.org/wiki/Lazy_evaluation&quot;&gt;lazy evaluation&lt;/a&gt;. Other than that, its performance should be on par with SAX, depending on the parser implementation.&lt;/p&gt;
&lt;h2 id=&quot;learn-about-xml-parsers-in-pythons-standard-library&quot;&gt;Learn About XML Parsers in Python’s Standard Library&lt;a class=&quot;headerlink&quot; href=&quot;#learn-about-xml-parsers-in-pythons-standard-library&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this section, you’ll take a look at Python’s built-in XML parsers, which are available to you in nearly every Python distribution. You’re going to compare those parsers against a sample &lt;a href=&quot;https://en.wikipedia.org/wiki/Scalable_Vector_Graphics&quot;&gt;Scalable Vector Graphics (SVG)&lt;/a&gt; image, which is an XML-based format. By processing the same document with different parsers, you’ll be able to choose the one that suits you best.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-xml-parser/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-xml-parser/ »&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 #82: Welcoming the CPython Developer in Residence</title>
      <id>https://realpython.com/podcasts/rpp/82/</id>
      <link href="https://realpython.com/podcasts/rpp/82/"/>
      <updated>2021-10-15T12:00:00+00:00</updated>
      <summary>Earlier this year, the Python Software Foundation announced the creation of the Developer in Residence role. The first Visionary Sponsors of the PSF have provided funding for this new role for one year. What development responsibilities does this job address? This week on the show, we talk to previous guest Łukasz Langa about becoming the first CPython Developer in Residence.</summary>
      <content type="html">
        &lt;p&gt;Earlier this year, the Python Software Foundation announced the creation of the Developer in Residence role. The first Visionary Sponsors of the PSF have provided funding for this new role for one year. What development responsibilities does this job address? This week on the show, we talk to previous guest Łukasz Langa about becoming the first CPython Developer in Residence.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s property(): Add Managed Attributes to Your Classes</title>
      <id>https://realpython.com/python-property/</id>
      <link href="https://realpython.com/python-property/"/>
      <updated>2021-10-13T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how to create managed attributes, also known as properties, using Python&#x27;s property() in your custom classes.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;With Python’s &lt;a href=&quot;https://docs.python.org/3/library/functions.html#property&quot;&gt;&lt;code&gt;property()&lt;/code&gt;&lt;/a&gt;, you can create &lt;strong&gt;managed attributes&lt;/strong&gt; in your classes. You can use managed attributes, also known as &lt;strong&gt;properties&lt;/strong&gt;, when you need to modify their internal implementation without changing the public &lt;a href=&quot;https://en.wikipedia.org/wiki/API&quot;&gt;API&lt;/a&gt; of the class. Providing stable APIs can help you avoid breaking your users’ code when they rely on your classes and objects.&lt;/p&gt;
&lt;p&gt;Properties are arguably the most popular way to create managed attributes quickly and in the purest &lt;a href=&quot;https://realpython.com/learning-paths/writing-pythonic-code/&quot;&gt;Pythonic&lt;/a&gt; style.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create &lt;strong&gt;managed attributes&lt;/strong&gt; or &lt;strong&gt;properties&lt;/strong&gt; in your classes&lt;/li&gt;
&lt;li&gt;Perform &lt;strong&gt;lazy attribute evaluation&lt;/strong&gt; and provide &lt;strong&gt;computed attributes&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Avoid &lt;strong&gt;setter&lt;/strong&gt; and &lt;strong&gt;getter&lt;/strong&gt; methods to make your classes more Pythonic&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;read-only&lt;/strong&gt;, &lt;strong&gt;read-write&lt;/strong&gt;, and &lt;strong&gt;write-only&lt;/strong&gt; properties&lt;/li&gt;
&lt;li&gt;Create consistent and &lt;strong&gt;backward-compatible APIs&lt;/strong&gt; for your classes&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll also write a few practical examples that use &lt;code&gt;property()&lt;/code&gt; for validating input data, computing attribute values dynamically, logging your code, and more. To get the most out of this tutorial, you should know the basics of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented&lt;/a&gt; programming and &lt;a href=&quot;https://realpython.com/primer-on-python-decorators/&quot;&gt;decorators&lt;/a&gt; in Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-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;managing-attributes-in-your-classes&quot;&gt;Managing Attributes in Your Classes&lt;a class=&quot;headerlink&quot; href=&quot;#managing-attributes-in-your-classes&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When you define a class in an &lt;a href=&quot;https://en.wikipedia.org/wiki/Object-oriented_programming&quot;&gt;object-oriented&lt;/a&gt; programming language, you’ll probably end up with some instance and class &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/#class-and-instance-attributes&quot;&gt;attributes&lt;/a&gt;. In other words, you’ll end up with variables that are accessible through the instance, class, or even both, depending on the language. Attributes represent or hold the internal &lt;a href=&quot;https://en.wikipedia.org/wiki/State_(computer_science)&quot;&gt;state&lt;/a&gt; of a given object, which you’ll often need to access and mutate.&lt;/p&gt;
&lt;p&gt;Typically, you have at least two ways to manage an attribute. Either you can access and mutate the attribute directly or you can use &lt;strong&gt;methods&lt;/strong&gt;. Methods are functions attached to a given class. They provide the behaviors and actions that an object can perform with its internal data and attributes.&lt;/p&gt;
&lt;p&gt;If you expose your attributes to the user, then they become part of the public &lt;a href=&quot;https://en.wikipedia.org/wiki/API&quot;&gt;API&lt;/a&gt; of your classes. Your user will access and mutate them directly in their code. The problem comes when you need to change the internal implementation of a given attribute.&lt;/p&gt;
&lt;p&gt;Say you’re working on a &lt;code&gt;Circle&lt;/code&gt; class. The initial implementation has a single attribute called &lt;code&gt;.radius&lt;/code&gt;. You finish coding the class and make it available to your end users. They start using &lt;code&gt;Circle&lt;/code&gt; in their code to create a lot of awesome projects and applications. Good job!&lt;/p&gt;
&lt;p&gt;Now suppose that you have an important user that comes to you with a new requirement. They don’t want &lt;code&gt;Circle&lt;/code&gt; to store the radius any longer. They need a public &lt;code&gt;.diameter&lt;/code&gt; attribute.&lt;/p&gt;
&lt;p&gt;At this point, removing &lt;code&gt;.radius&lt;/code&gt; to start using &lt;code&gt;.diameter&lt;/code&gt; could break the code of some of your end users. You need to manage this situation in a way other than removing &lt;code&gt;.radius&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Programming languages such as &lt;a href=&quot;https://realpython.com/oop-in-python-vs-java/&quot;&gt;Java&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/C%2B%2B&quot;&gt;C++&lt;/a&gt; encourage you to never expose your attributes to avoid this kind of problem. Instead, you should provide &lt;strong&gt;getter&lt;/strong&gt; and &lt;strong&gt;setter&lt;/strong&gt; methods, also known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Accessor_method&quot;&gt;accessors&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Mutator_method&quot;&gt;mutators&lt;/a&gt;, respectively. These methods offer a way to change the internal implementation of your attributes without changing your public API.&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; Getter and setter methods are often considered an &lt;a href=&quot;https://en.wikipedia.org/wiki/Anti-pattern&quot;&gt;anti-pattern&lt;/a&gt; and a signal of poor object-oriented design. The main argument behind this proposition is that these methods break &lt;a href=&quot;https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)&quot;&gt;encapsulation&lt;/a&gt;. They allow you to access and mutate the components of your objects.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In the end, these languages need getter and setter methods because they don’t provide a suitable way to change the internal implementation of an attribute if a given requirement changes. Changing the internal implementation would require an API modification, which can break your end users’ code.&lt;/p&gt;
&lt;h3 id=&quot;the-getter-and-setter-approach-in-python&quot;&gt;The Getter and Setter Approach in Python&lt;a class=&quot;headerlink&quot; href=&quot;#the-getter-and-setter-approach-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Technically, there’s nothing that stops you from using getter and setter &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/#instance-methods&quot;&gt;methods&lt;/a&gt; in Python. Here’s how this approach would look:&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;# point.py&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fm&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_x&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;set_x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;get_y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_y&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;set_y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this example, you create &lt;code&gt;Point&lt;/code&gt; with two &lt;strong&gt;non-public attributes&lt;/strong&gt; &lt;code&gt;._x&lt;/code&gt; and &lt;code&gt;._y&lt;/code&gt; to hold the &lt;a href=&quot;https://en.wikipedia.org/wiki/Cartesian_coordinate_system&quot;&gt;Cartesian coordinates&lt;/a&gt; of the point at hand.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Python doesn’t have the notion of &lt;a href=&quot;https://en.wikipedia.org/wiki/Access_modifiers&quot;&gt;access modifiers&lt;/a&gt;, such as &lt;code&gt;private&lt;/code&gt;, &lt;code&gt;protected&lt;/code&gt;, and &lt;code&gt;public&lt;/code&gt;, to restrict access to attributes and methods. In Python, the distinction is between &lt;strong&gt;public&lt;/strong&gt; and &lt;strong&gt;non-public&lt;/strong&gt; class members.&lt;/p&gt;
&lt;p&gt;If you want to signal that a given attribute or method is non-public, then you have to use the well-known Python &lt;a href=&quot;https://www.python.org/dev/peps/pep-0008/#method-names-and-instance-variables&quot;&gt;convention&lt;/a&gt; of prefixing the name with an underscore (&lt;code&gt;_&lt;/code&gt;). That’s the reason behind the naming of the attributes &lt;code&gt;._x&lt;/code&gt; and &lt;code&gt;._y&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Note that this is just a convention. It doesn’t stop you and other programmers from accessing the attributes using &lt;strong&gt;dot notation&lt;/strong&gt;, as in &lt;code&gt;obj._attr&lt;/code&gt;. However, it’s bad practice to violate this convention.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To access and mutate the value of either &lt;code&gt;._x&lt;/code&gt; or &lt;code&gt;._y&lt;/code&gt;, you can use the corresponding getter and setter methods. Go ahead and save the above definition of &lt;code&gt;Point&lt;/code&gt; in a Python &lt;a href=&quot;https://realpython.com/python-modules-packages/&quot;&gt;module&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-import/&quot;&gt;import&lt;/a&gt; the class into your &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interactive shell&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here’s how you can work with &lt;code&gt;Point&lt;/code&gt; in your code:&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;point&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Point&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;point&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;12&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;point&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_y&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;n&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;point&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get_x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;42&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Non-public attributes are still accessible&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;point&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_x&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;42&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;point&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_y&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With &lt;code&gt;.get_x()&lt;/code&gt; and &lt;code&gt;.get_y()&lt;/code&gt;, you can access the current values of &lt;code&gt;._x&lt;/code&gt; and &lt;code&gt;._y&lt;/code&gt;. You can use the setter method to store a new value in the corresponding managed attribute. From this code, you can confirm that Python doesn’t restrict access to non-public attributes. Whether or not you do so is up to you.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-property/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-property/ »&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 Pygame to Build an Asteroids Game in Python</title>
      <id>https://realpython.com/courses/asteroids-game-python-pygame/</id>
      <link href="https://realpython.com/courses/asteroids-game-python-pygame/"/>
      <updated>2021-10-12T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll build a clone of the Asteroids game in Python using Pygame. Step by step, you&#x27;ll add images, input handling, game logic, sounds, and text to your program.</summary>
      <content type="html">
        &lt;p&gt;Do you want to create your own computer games but like Python too much to abandon it for a career as a game developer? There&amp;rsquo;s a solution for that! With the Pygame module, you can use your amazing Python skills to create games, from the basic to the very complex. Below, you&amp;rsquo;ll learn how to use Pygame by making a clone of the Asteroids game!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to build a complete game, including:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Loading &lt;strong&gt;images&lt;/strong&gt; and displaying them on the screen&lt;/li&gt;
&lt;li&gt;Handling &lt;strong&gt;user input&lt;/strong&gt; in order to control the game&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Moving objects&lt;/strong&gt; according to the &lt;strong&gt;game logic&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Detecting &lt;strong&gt;collisions&lt;/strong&gt; between objects&lt;/li&gt;
&lt;li&gt;Displaying &lt;strong&gt;text&lt;/strong&gt; on the screen&lt;/li&gt;
&lt;li&gt;Playing &lt;strong&gt;sounds&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>Representing Rational Numbers With Python Fractions</title>
      <id>https://realpython.com/python-fractions/</id>
      <link href="https://realpython.com/python-fractions/"/>
      <updated>2021-10-11T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn about the Fraction data type in Python, which can represent rational numbers precisely without the rounding errors in binary arithmetic. You&#x27;ll find that this is especially important in financial and other high-precision applications.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The &lt;code&gt;fractions&lt;/code&gt; module in Python is arguably one of the most underused elements of the standard library. Even though it may not be well-known, it’s a useful tool to have under your belt because it can help address the shortcomings of floating-point arithmetic in binary. That’s essential if you plan to work with &lt;strong&gt;financial data&lt;/strong&gt; or if you require &lt;strong&gt;infinite precision&lt;/strong&gt; for your calculations.&lt;/p&gt;
&lt;p&gt;Towards the end of this tutorial, you’ll see a few &lt;a href=&quot;#studying-a-python-fraction-in-action&quot;&gt;hands-on examples&lt;/a&gt; where fractions are the most suitable and elegant choice. You’ll also learn about their weaknesses and how to make the best use of them along the way.&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;Convert between &lt;strong&gt;decimal&lt;/strong&gt; and &lt;strong&gt;fractional&lt;/strong&gt; notation&lt;/li&gt;
&lt;li&gt;Perform &lt;strong&gt;rational number arithmetic&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Approximate &lt;strong&gt;irrational numbers&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Represent fractions exactly with &lt;strong&gt;infinite precision&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Know when to &lt;strong&gt;choose&lt;/strong&gt; &lt;code&gt;Fraction&lt;/code&gt; over &lt;code&gt;Decimal&lt;/code&gt; or &lt;code&gt;float&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The majority of this tutorial goes over the &lt;code&gt;fractions&lt;/code&gt; module, which in itself doesn’t require in-depth Python knowledge other than an understanding of its &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;numeric types&lt;/a&gt;. However, you’ll be in a good place to work through all the code examples that follow if you’re familiar with more advanced concepts such as Python’s built-in &lt;a href=&quot;https://realpython.com/python-collections-module/&quot;&gt;&lt;code&gt;collections&lt;/code&gt; module&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-itertools/&quot;&gt;&lt;code&gt;itertools&lt;/code&gt; module&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/introduction-to-python-generators/&quot;&gt;generators&lt;/a&gt;. You should already be comfortable with these topics if you want to make the most out of this tutorial.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;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;decimal-vs-fractional-notation&quot;&gt;Decimal vs Fractional Notation&lt;a class=&quot;headerlink&quot; href=&quot;#decimal-vs-fractional-notation&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let’s take a walk down memory lane to bring back your school knowledge of numbers and avoid possible confusion. There are four concepts at play here:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Types of numbers in mathematics&lt;/li&gt;
&lt;li&gt;Numeral systems&lt;/li&gt;
&lt;li&gt;Notations of numbers&lt;/li&gt;
&lt;li&gt;Numeric data types in Python&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You’ll get a quick overview of each of these now to better understand the purpose of the &lt;code&gt;Fraction&lt;/code&gt; data type in Python.&lt;/p&gt;
&lt;h3 id=&quot;classification-of-numbers&quot;&gt;Classification of Numbers&lt;a class=&quot;headerlink&quot; href=&quot;#classification-of-numbers&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you don’t remember the classification of numbers, here’s a quick refresher:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/diagram-numbers-math.25b0c13bfd67.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-66&quot; src=&quot;https://files.realpython.com/media/diagram-numbers-math.25b0c13bfd67.png&quot; width=&quot;1256&quot; height=&quot;1256&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/diagram-numbers-math.25b0c13bfd67.png&amp;amp;w=314&amp;amp;sig=5c969aaf3c6a5b59743ad66b6cabb61804b69635 314w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/diagram-numbers-math.25b0c13bfd67.png&amp;amp;w=628&amp;amp;sig=7a51cb355e37c81fa80899a1ec61b3ad511cda1c 628w, https://files.realpython.com/media/diagram-numbers-math.25b0c13bfd67.png 1256w&quot; sizes=&quot;75vw&quot; alt=&quot;The Main Types of Numbers in Mathematics&quot; data-asset=&quot;3785&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Types of Numbers&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;There are many more types of numbers in mathematics, but these are the most relevant in day-to-day life. At the very top, you’ll find &lt;a href=&quot;https://realpython.com/python-complex-numbers/&quot;&gt;complex numbers&lt;/a&gt; that include &lt;a href=&quot;https://en.wikipedia.org/wiki/Imaginary_number&quot;&gt;imaginary&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Real_number&quot;&gt;real&lt;/a&gt; numbers. Real numbers are, in turn, comprised of &lt;a href=&quot;https://en.wikipedia.org/wiki/Rational_number&quot;&gt;rational&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Irrational_number&quot;&gt;irrational&lt;/a&gt; numbers. Finally, rational numbers contain &lt;a href=&quot;https://en.wikipedia.org/wiki/Integer&quot;&gt;integers&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Natural_number&quot;&gt;natural&lt;/a&gt; numbers.&lt;/p&gt;
&lt;h3 id=&quot;numeral-systems-and-notations&quot;&gt;Numeral Systems and Notations&lt;a class=&quot;headerlink&quot; href=&quot;#numeral-systems-and-notations&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;There have been various systems of expressing numbers visually over the centuries. Today, most people use a &lt;a href=&quot;https://en.wikipedia.org/wiki/Positional_notation&quot;&gt;positional numeral system&lt;/a&gt; based on Hindu-Arabic symbols. You can choose any &lt;a href=&quot;https://en.wikipedia.org/wiki/Radix&quot;&gt;base or radix&lt;/a&gt; for such a system. However, while people prefer the &lt;strong&gt;decimal system&lt;/strong&gt; (base-10), computers work best in the &lt;strong&gt;binary system&lt;/strong&gt; (base-2).&lt;/p&gt;
&lt;p&gt;Within the decimal system itself, you can represent some numbers using alternative notations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Decimal:&lt;/strong&gt; 0.75&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fractional:&lt;/strong&gt; ¾&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Neither of these is better or more precise than the other. Expressing a number in decimal notation is perhaps more intuitive because it resembles a &lt;a href=&quot;https://en.wikipedia.org/wiki/Percentage&quot;&gt;percentage&lt;/a&gt;. Comparing decimals is also more straightforward since they already have a common denominator—the base of the system. Finally, decimal numbers can communicate precision by keeping the trailing and leading zeros.&lt;/p&gt;
&lt;p&gt;On the other hand, fractions are more convenient in performing &lt;strong&gt;symbolic algebra&lt;/strong&gt; by hand, which is why they’re mainly used in school. But can you recall the last time you used fractions? If you can’t, then that’s because decimal notation is central in calculators and computers nowadays.&lt;/p&gt;
&lt;p&gt;The fractional notation is typically associated with &lt;strong&gt;rational numbers&lt;/strong&gt; only. After all, the very definition of a rational number states that you can express it as a quotient, or a &lt;em&gt;fraction&lt;/em&gt;, of two integers as long as the denominator is nonzero. However, that’s not the whole story when you factor in &lt;a href=&quot;https://en.wikipedia.org/wiki/Continued_fraction&quot;&gt;infinite continued fractions&lt;/a&gt; that can approximate irrational numbers:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/latex_decimal_vs_fractional.ed464ec10585.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-66&quot; src=&quot;https://files.realpython.com/media/latex_decimal_vs_fractional.ed464ec10585.png&quot; width=&quot;2297&quot; height=&quot;744&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/latex_decimal_vs_fractional.ed464ec10585.png&amp;amp;w=574&amp;amp;sig=b607653e71bc379aa2e0997cd0c53fa29cd5519c 574w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/latex_decimal_vs_fractional.ed464ec10585.png&amp;amp;w=1148&amp;amp;sig=86d244a986db1f404859cb8a8bac938c0fa49e1f 1148w, https://files.realpython.com/media/latex_decimal_vs_fractional.ed464ec10585.png 2297w&quot; sizes=&quot;75vw&quot; alt=&quot;Decimal vs Fractional Notation&quot; data-asset=&quot;3784&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;Irrational numbers always have a non-terminating and non-repeating decimal expansion. For example, the decimal expansion of pi (π) never runs out of digits that seem to have a random distribution. If you were to plot their histogram, then each digit would have a roughly similar frequency.&lt;/p&gt;
&lt;p&gt;On the other hand, most rational numbers have a terminating decimal expansion. However, some can have an &lt;strong&gt;infinite recurring decimal expansion&lt;/strong&gt; with one or more digits repeated over a period. The repeated digits are commonly denoted with an ellipsis (0.33333…) in the decimal notation. Regardless of their decimal expansion, rational numbers such as the number representing one-third always look elegant and compact in the fractional notation.&lt;/p&gt;
&lt;h3 id=&quot;numeric-data-types-in-python&quot;&gt;Numeric Data Types in Python&lt;a class=&quot;headerlink&quot; href=&quot;#numeric-data-types-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-fractions/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-fractions/ »&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 #81: Exploring the New Features of Python 3.10</title>
      <id>https://realpython.com/podcasts/rpp/81/</id>
      <link href="https://realpython.com/podcasts/rpp/81/"/>
      <updated>2021-10-08T12:00:00+00:00</updated>
      <summary>Python 3.10 is here! This week on the show, two former guests and Real Python authors return to talk about the new version. Geir Arne Hjelle&#x27;s article was posted to the site Monday, and it&#x27;s titled &quot;Python 3.10: Cool New Features for You to Try&quot;. Christopher Trudeau&#x27;s video course came out on Tuesday, and it covers the topics from the article with multiple visual examples of Python 3.10 code.</summary>
      <content type="html">
        &lt;p&gt;Python 3.10 is here! This week on the show, two former guests and Real Python authors return to talk about the new version. Geir Arne Hjelle&#x27;s article was posted to the site Monday, and it&#x27;s titled &quot;Python 3.10: Cool New Features for You to Try&quot;. Christopher Trudeau&#x27;s video course came out on Tuesday, and it covers the topics from the article with multiple visual examples of Python 3.10 code.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s sum(): The Pythonic Way to Sum Values</title>
      <id>https://realpython.com/python-sum-function/</id>
      <link href="https://realpython.com/python-sum-function/"/>
      <updated>2021-10-06T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how to use Python&#x27;s sum() function to add numeric values together. You also learn how to concatenate sequences, such as lists and tuples, using sum().</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s built-in function &lt;code&gt;sum()&lt;/code&gt; is an efficient and &lt;a href=&quot;https://realpython.com/learning-paths/writing-pythonic-code/&quot;&gt;Pythonic&lt;/a&gt; way to sum a list of numeric values. Adding several numbers together is a common intermediate step in many computations, so &lt;code&gt;sum()&lt;/code&gt; is a pretty handy tool for a Python programmer.&lt;/p&gt;
&lt;p&gt;As an additional and interesting use case, you can concatenate &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;lists and tuples&lt;/a&gt; using &lt;code&gt;sum()&lt;/code&gt;, which can be convenient when you need to flatten a list of lists.&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;Sum numeric values by hand using &lt;strong&gt;general techniques and tools&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Python’s &lt;code&gt;sum()&lt;/code&gt;&lt;/strong&gt; to add several numeric values efficiently&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Concatenate lists and tuples&lt;/strong&gt; with &lt;code&gt;sum()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;sum()&lt;/code&gt; to approach common &lt;strong&gt;summation problems&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use appropriate values for the &lt;strong&gt;arguments&lt;/strong&gt; in &lt;code&gt;sum()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Decide between &lt;code&gt;sum()&lt;/code&gt; and &lt;strong&gt;alternative tools&lt;/strong&gt; to sum and concatenate objects&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This knowledge will help you efficiently approach and solve summation problems in your code using either &lt;code&gt;sum()&lt;/code&gt; or other alternative and specialized tools.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-shortened&quot; data-focus=&quot;false&quot;&gt;Click here to get a Python Cheat Sheet&lt;/a&gt; and learn the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;understanding-the-summation-problem&quot;&gt;Understanding the Summation Problem&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-the-summation-problem&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Summing numeric values together is a fairly common problem in programming. For example, say you have a list of numbers [1, 2, 3, 4, 5] and want to add them together to compute their total sum. With standard arithmetic, you’ll do something like this:&lt;/p&gt;
&lt;p&gt;1 + 2 + 3 + 4 + 5 = 15&lt;/p&gt;
&lt;p&gt;As far as math goes, this expression is pretty straightforward. It walks you through a short series of additions until you find the sum of all the numbers.&lt;/p&gt;
&lt;p&gt;It’s possible to do this particular calculation by hand, but imagine some other situations where it might not be so possible. If you have a particularly long list of numbers, adding by hand can be inefficient and error-prone. What happens if you don’t even know how many items are in the list? Finally, imagine a scenario where the number of items you need to add changes dynamically or unpredictably. &lt;/p&gt;
&lt;p&gt;In situations like these, whether you have a long or short list of &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;numbers&lt;/a&gt;, Python can be quite useful to solve &lt;strong&gt;summation problems&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you want to sum the numbers by creating your own solution from scratch, then you can try using a &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/a&gt;:&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;numbers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;total&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;total&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;total&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;15&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, you first create &lt;code&gt;total&lt;/code&gt; and initialize it to &lt;code&gt;0&lt;/code&gt;. This &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variable&lt;/a&gt; works as an &lt;a href=&quot;https://en.wikipedia.org/wiki/Accumulator_(computing)&quot;&gt;accumulator&lt;/a&gt; in which you store intermediate results until you get the final one. The loop iterates through &lt;code&gt;numbers&lt;/code&gt; and updates &lt;code&gt;total&lt;/code&gt; by accumulating each successive value using an &lt;a href=&quot;https://docs.python.org/3/reference/simple_stmts.html#augmented-assignment-statements&quot;&gt;augmented assignment&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can also wrap the &lt;code&gt;for&lt;/code&gt; loop in a &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;function&lt;/a&gt;. This way, you can reuse the code for different lists:&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;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sum_numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;total&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;total&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;total&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sum_numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;15&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;sum_numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In &lt;code&gt;sum_numbers()&lt;/code&gt;, you take an &lt;a href=&quot;https://realpython.com/python-for-loop/#iterables&quot;&gt;iterable&lt;/a&gt;—specifically, a list of numeric values—as an argument and &lt;a href=&quot;https://realpython.com/python-return-statement/&quot;&gt;return&lt;/a&gt; the total sum of the values in the input list. If the input list is empty, then the function returns &lt;code&gt;0&lt;/code&gt;. The &lt;code&gt;for&lt;/code&gt; loop is the same one that you saw before.&lt;/p&gt;
&lt;p&gt;You can also use &lt;a href=&quot;https://realpython.com/python-recursion/&quot;&gt;recursion&lt;/a&gt; instead of iteration. Recursion is a &lt;a href=&quot;https://realpython.com/python-functional-programming/&quot;&gt;functional programming&lt;/a&gt; technique where a function is called within its own definition. In other words, a recursive function calls itself in a loop:&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;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;sum_numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sum_numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:])&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sum_numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;15&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When you define a recursive function, you take the risk of running into an infinite loop. To prevent this, you need to define both a &lt;strong&gt;base case&lt;/strong&gt; that stops the recursion and a &lt;strong&gt;recursive case&lt;/strong&gt; to call the function and start the implicit loop.&lt;/p&gt;
&lt;p&gt;In the above example, the base case implies that the sum of a zero-length list is &lt;code&gt;0&lt;/code&gt;. The recursive case implies that the total sum is the first value, &lt;code&gt;numbers[0]&lt;/code&gt;, plus the sum of the rest of the values, &lt;code&gt;numbers[1:]&lt;/code&gt;. Because the recursive case uses a shorter sequence on each iteration, you expect to run into the base case when &lt;code&gt;numbers&lt;/code&gt; is a zero-length list. As a final result, you get the sum of all the items in your input list, &lt;code&gt;numbers&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; In this example, if you don’t check for an empty input list (your base case), then &lt;code&gt;sum_numbers()&lt;/code&gt; will never run into an infinite recursive loop. When your &lt;code&gt;numbers&lt;/code&gt; list reaches a length of &lt;code&gt;0&lt;/code&gt;, the code tries to access an item from the empty list, which raises an &lt;code&gt;IndexError&lt;/code&gt; and breaks the loop.&lt;/p&gt;
&lt;p&gt;With this kind of implementation, you’ll never get a sum from this function. You’ll get an &lt;code&gt;IndexError&lt;/code&gt; every time.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Another option to sum a list of numbers in Python is to use &lt;a href=&quot;https://realpython.com/python-reduce-function/&quot;&gt;&lt;code&gt;reduce()&lt;/code&gt;&lt;/a&gt; from &lt;a href=&quot;https://docs.python.org/3/library/functools.html#module-functools&quot;&gt;&lt;code&gt;functools&lt;/code&gt;&lt;/a&gt;. To get the sum of a list of numbers, you can pass either &lt;a href=&quot;https://docs.python.org/3/library/operator.html#operator.add&quot;&gt;&lt;code&gt;operator.add&lt;/code&gt;&lt;/a&gt; or an appropriate &lt;a href=&quot;https://realpython.com/python-lambda/&quot;&gt;&lt;code&gt;lambda&lt;/code&gt; function&lt;/a&gt; as the first argument to &lt;code&gt;reduce()&lt;/code&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;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;functools&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reduce&lt;/span&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;operator&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;add&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;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;15&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;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;add&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;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;reduce() of empty sequence with no initial value&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;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;lambda&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;15&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-sum-function/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-sum-function/ »&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>Cool New Features in Python 3.10</title>
      <id>https://realpython.com/courses/cool-new-features-python-310/</id>
      <link href="https://realpython.com/courses/cool-new-features-python-310/"/>
      <updated>2021-10-05T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll explore some of the coolest and most useful features in Python 3.10. You&#x27;ll appreciate more user-friendly error messages, learn about how you can handle complicated data structures with structural pattern matching, and explore new enhancements to Python&#x27;s type system.</summary>
      <content type="html">
        &lt;p&gt;Python 3.10 is out! Volunteers have been working on the new version since May 2020 to bring you a better, faster, and more secure Python. As of &lt;a href=&quot;https://www.python.org/dev/peps/pep-0619/&quot;&gt;October 4, 2021&lt;/a&gt;, the first official version is available.&lt;/p&gt;
&lt;p&gt;Each new version of Python brings a host of changes. You can read about all of them in the &lt;a href=&quot;https://docs.python.org/3.10/whatsnew/3.10.html&quot;&gt;documentation&lt;/a&gt;. Here, you&amp;rsquo;ll get to learn about the coolest new features.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Debugging with more helpful and precise &lt;strong&gt;error messages&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Using &lt;strong&gt;structural pattern matching&lt;/strong&gt; to work with data structures&lt;/li&gt;
&lt;li&gt;Adding more readable and more specific &lt;strong&gt;type hints&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Checking the &lt;strong&gt;length of sequences&lt;/strong&gt; when using &lt;code&gt;zip()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Calculating &lt;strong&gt;multivariable statistics&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python 3.10: Cool New Features for You to Try</title>
      <id>https://realpython.com/python310-new-features/</id>
      <link href="https://realpython.com/python310-new-features/"/>
      <updated>2021-10-04T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll explore some of the coolest and most useful features in Python 3.10. You&#x27;ll appreciate more user-friendly error messages, learn about how you can handle complicated data structures with structural pattern matching, and explore new enhancements to Python&#x27;s type system.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;a href=&quot;https://www.python.org/downloads/release/python-3100/&quot;&gt;Python 3.10 is out!&lt;/a&gt; Volunteers have been working on the new version since May 2020 to bring you a better, faster, and more secure Python. As of &lt;a href=&quot;https://www.python.org/dev/peps/pep-0619/&quot;&gt;October 4, 2021&lt;/a&gt;, the first official version is available.&lt;/p&gt;
&lt;p&gt;Each new version of Python brings a host of changes. You can read about all of them in the &lt;a href=&quot;https://docs.python.org/3.10/whatsnew/3.10.html&quot;&gt;documentation&lt;/a&gt;. Here, you’ll get to learn about the coolest new features.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Debugging with more helpful and precise &lt;strong&gt;error messages&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Using &lt;strong&gt;structural pattern matching&lt;/strong&gt; to work with data structures&lt;/li&gt;
&lt;li&gt;Adding more readable and more specific &lt;strong&gt;type hints&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Checking the &lt;strong&gt;length of sequences&lt;/strong&gt; when using &lt;code&gt;zip()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Calculating &lt;strong&gt;multivariable statistics&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To try out the new features yourself, you need to run Python 3.10. You can get it from the &lt;a href=&quot;https://www.python.org/downloads/&quot;&gt;Python homepage&lt;/a&gt;. Alternatively, you can &lt;a href=&quot;https://realpython.com/python-versions-docker/&quot;&gt;use Docker&lt;/a&gt; with the &lt;a href=&quot;https://hub.docker.com/_/python/&quot;&gt;latest Python image&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;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;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Bonus Learning Materials:&lt;/strong&gt; Check out &lt;a href=&quot;https://realpython.com/podcasts/rpp/81/&quot;&gt;Real Python Podcast Episode #81&lt;/a&gt; for Python 3.10 tips and a discussion with members of the &lt;em&gt;Real Python&lt;/em&gt; team.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;better-error-messages&quot;&gt;Better Error Messages&lt;a class=&quot;headerlink&quot; href=&quot;#better-error-messages&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python is often lauded for being a user-friendly programming language. While this is true, there are certain parts of Python that could be friendlier. Python 3.10 comes with a host of more precise and constructive error messages. In this section, you’ll see some of the newest improvements. The full list is available in the &lt;a href=&quot;https://docs.python.org/3.10/whatsnew/3.10.html#better-error-messages&quot;&gt;documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Think back to writing your first &lt;a href=&quot;https://www.scriptol.com/programming/hello-world.php&quot;&gt;Hello World&lt;/a&gt; program in Python:&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;# hello.py&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, World!)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Maybe you created a file, added the famous call to &lt;code&gt;print()&lt;/code&gt;, and saved it as &lt;code&gt;hello.py&lt;/code&gt;. You then ran the program, eager to call yourself a proper Pythonista. However, something went wrong:&lt;/p&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;python hello.py
&lt;span class=&quot;go&quot;&gt;  File &quot;/home/rp/hello.py&quot;, line 3&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    print(&quot;Hello, World!)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;                        ^&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;SyntaxError: EOL while scanning string literal&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;There was a &lt;code&gt;SyntaxError&lt;/code&gt; in the code. &lt;code&gt;EOL&lt;/code&gt;, what does that even mean? You went back to your code, and after a bit of staring and searching, you realized that there was a missing quotation mark at the end of your string.&lt;/p&gt;
&lt;p&gt;One of the more impactful improvements in Python 3.10 is better and more precise error messages for many common issues. If you run your buggy Hello World in Python 3.10, you’ll get a bit more help than in earlier versions of Python:&lt;/p&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;python hello.py
&lt;span class=&quot;go&quot;&gt;  File &quot;/home/rp/hello.py&quot;, line 3&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    print(&quot;Hello, World!)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;          ^&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;SyntaxError: unterminated string literal (detected at line 3)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The error message is still a bit technical, but gone is the mysterious &lt;code&gt;EOL&lt;/code&gt;. Instead, the message tells you that you need to terminate your string! There are similar improvements to many different error messages, as you’ll see below.&lt;/p&gt;
&lt;p&gt;A &lt;a href=&quot;https://realpython.com/invalid-syntax-python/&quot;&gt;&lt;code&gt;SyntaxError&lt;/code&gt;&lt;/a&gt; is an error raised when your code is parsed, before it even starts to execute. Syntax errors can be tricky to debug because the interpreter provides imprecise or sometimes even misleading error messages. The following code is missing a curly brace to terminate the dictionary:&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;linenos&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# unterminated_dict.py&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 2&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;months&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;linenos&quot;&gt; 4&lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;October&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 5&lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;November&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 6&lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;December&quot;&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 7&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 8&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;months&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; is the tenth month&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 missing closing curly brace that should have been on line 7 is an error. If you run this code with Python 3.9 or earlier, you’ll see the following error message:&lt;/p&gt;
&lt;div class=&quot;highlight pytb&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;  File &lt;span class=&quot;nb&quot;&gt;&quot;/home/rp/unterminated_dict.py&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;8&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;months&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; is the tenth month&quot;&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;gr&quot;&gt;SyntaxError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;invalid syntax&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The error message highlights line 8, but there are no syntactical problems in line 8! If you’ve experienced your share of syntax errors in Python, you might already know that the trick is to look at the lines &lt;em&gt;before&lt;/em&gt; the one Python complains about. In this case, you’re looking for the missing closing brace on line 7.&lt;/p&gt;
&lt;p&gt;In Python 3.10, the same code shows a much more helpful and precise error message:&lt;/p&gt;
&lt;div class=&quot;highlight pytb&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;  File &lt;span class=&quot;nb&quot;&gt;&quot;/home/rp/unterminated_dict.py&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;months&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;o&quot;&gt;^&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;SyntaxError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;&#x27;{&#x27; was never closed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This points you straight to the offending dictionary and allows you to fix the issue in no time.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python310-new-features/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python310-new-features/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #80: Make Your Python App Interactive With a Text User Interface (TUI)</title>
      <id>https://realpython.com/podcasts/rpp/80/</id>
      <link href="https://realpython.com/podcasts/rpp/80/"/>
      <updated>2021-10-01T12:00:00+00:00</updated>
      <summary>Have you wanted to create a Python application that goes further than a command-line interface? You would like it to have a friendly interface but don&#x27;t want to make a GUI (Graphical User Interface) or web application. Maybe a TUI (Text User Interface)would be a perfect fit for the project. This week on the show, we have Will McGugan to talk about his projects Textual and Rich.</summary>
      <content type="html">
        &lt;p&gt;Have you wanted to create a Python application that goes further than a command-line interface? You would like it to have a friendly interface but don&#x27;t want to make a GUI (Graphical User Interface) or web application. Maybe a TUI (Text User Interface)would be a perfect fit for the project. This week on the show, we have Will McGugan to talk about his projects Textual and Rich.&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>Hosting a Django Project on Heroku</title>
      <id>https://realpython.com/django-hosting-on-heroku/</id>
      <link href="https://realpython.com/django-hosting-on-heroku/"/>
      <updated>2021-09-29T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll learn about hosting Django projects in the cloud using Heroku, which is the favorite cloud platform provider of many startups and developers.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;As a novice &lt;a href=&quot;https://realpython.com/learning-paths/become-python-web-developer/&quot;&gt;web developer&lt;/a&gt;, you’ve built your &lt;a href=&quot;https://realpython.com/get-started-with-django-1/&quot;&gt;portfolio app&lt;/a&gt; and shared your code on &lt;a href=&quot;https://realpython.com/python-git-github-intro/&quot;&gt;GitHub&lt;/a&gt;. Perhaps, you’re hoping to attract technical recruiters to land your first &lt;a href=&quot;https://realpython.com/learning-paths/python-interview/&quot;&gt;programming job&lt;/a&gt;. Many &lt;a href=&quot;https://en.wikipedia.org/wiki/Coding_bootcamp&quot;&gt;coding bootcamp&lt;/a&gt; graduates are likely doing the same thing. To differentiate yourself from the crowd and boost your chances of getting noticed, you can start &lt;strong&gt;hosting&lt;/strong&gt; your Django project online.&lt;/p&gt;
&lt;p&gt;For a hobby Django project, you’ll want a hosting service that’s &lt;strong&gt;free&lt;/strong&gt; of charge, &lt;strong&gt;quick&lt;/strong&gt; to set up, &lt;strong&gt;user-friendly&lt;/strong&gt;, and &lt;strong&gt;well-integrated&lt;/strong&gt; with your existing technology stack. While &lt;a href=&quot;https://pages.github.com/&quot;&gt;GitHub Pages&lt;/a&gt; is perfect for hosting static websites and websites with &lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt;, you’ll need a &lt;strong&gt;web server&lt;/strong&gt; to run your &lt;a href=&quot;https://realpython.com/learning-paths/flask-by-example/&quot;&gt;Flask&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/learning-paths/django-web-development/&quot;&gt;Django&lt;/a&gt; project.&lt;/p&gt;
&lt;p&gt;There are a few major &lt;strong&gt;cloud platform&lt;/strong&gt; providers operating in different models, but you’re going to explore &lt;a href=&quot;https://www.heroku.com/&quot;&gt;Heroku&lt;/a&gt; in this tutorial. It ticks all the boxes—it’s free, quick to set up, user-friendly, and well-integrated with Django—and is the favorite cloud platform provider of many startups.&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;Take your &lt;strong&gt;Django&lt;/strong&gt; project &lt;strong&gt;online&lt;/strong&gt; in minutes&lt;/li&gt;
&lt;li&gt;Deploy your project to Heroku using &lt;strong&gt;Git&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use a &lt;strong&gt;Django-Heroku&lt;/strong&gt; integration library&lt;/li&gt;
&lt;li&gt;Hook your Django project up to a standalone &lt;strong&gt;relational database&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Manage the &lt;strong&gt;configuration&lt;/strong&gt; along with &lt;strong&gt;sensitive data&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To follow along, you can download the code and other resources by clicking the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/django-hosting-heroku-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-django-hosting-heroku-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the companion Django project as well as snapshots of the individual steps&lt;/a&gt; followed in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo-what-youll-build&quot;&gt;Demo: What You’ll Build&lt;a class=&quot;headerlink&quot; href=&quot;#demo-what-youll-build&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’re going to create a bare-bones Django project and deploy it to the cloud straight from the terminal. By the end, you’ll have a public and shareable link to your first Heroku app.&lt;/p&gt;
&lt;p&gt;Here’s a one-minute video demonstrating the necessary steps, from initializing an empty Git repository to viewing your finished project in the browser. Hang on and watch till the end for a quick preview of what you’re about to find in this tutorial:&lt;/p&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/552465720?background=1&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;p&gt;In addition to the steps shown in the screencast above, you’ll find a few more later on, but this should be enough to give you a general idea about how you’ll be working with Heroku in this tutorial.&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This tutorial isn’t so much about building any particular project, but rather &lt;strong&gt;hosting&lt;/strong&gt; one in the cloud using &lt;strong&gt;Heroku&lt;/strong&gt;. While Heroku supports &lt;a href=&quot;https://www.heroku.com/languages&quot;&gt;various languages&lt;/a&gt; and web frameworks, you’ll stick to Python and Django. Don’t worry if you don’t have any Django projects on hand. The first step will walk you through scaffolding a new Django project to get you started quickly. Alternatively, you can use a ready-made sample project that you’ll find later.&lt;/p&gt;
&lt;p&gt;Once you have your Django project ready, you’re going to sign up for a free Heroku account. Next, you’ll download a convenient command-line tool that will help you manage your apps online. As demonstrated in the screencast above, the command line is a quick way of working with Heroku. Finally, you’ll finish off with a deployed Django project hosted on your newly-configured Heroku instance. You can think of your final result as a placeholder for your future &lt;a href=&quot;https://realpython.com/intermediate-python-project-ideas/&quot;&gt;project ideas&lt;/a&gt;.&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;Before jumping ahead, make sure that you’re familiar with the basics of the &lt;a href=&quot;https://realpython.com/learning-paths/django-web-development/&quot;&gt;Django web framework&lt;/a&gt; and that you’re comfortable using it to set up a bare-bones project.&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; If you’re more experienced with Flask than Django, then you can check out a similar tutorial about &lt;a href=&quot;https://realpython.com/flask-by-example-part-1-project-setup/&quot;&gt;Deploying a Python Flask Example Application Using Heroku&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You should also have a &lt;a href=&quot;https://realpython.com/python-git-github-intro/&quot;&gt;Git&lt;/a&gt; client installed and configured so that you can interact conveniently with the Heroku platform from the command line. Finally, you should seriously consider using a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt; for your project. If you don’t already have a specific virtual environment tool in mind, you’ll find some options in this tutorial soon. &lt;/p&gt;
&lt;h2 id=&quot;step-1-scaffold-a-django-project-for-hosting&quot;&gt;Step 1: Scaffold a Django Project for Hosting&lt;a class=&quot;headerlink&quot; href=&quot;#step-1-scaffold-a-django-project-for-hosting&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To host a Django web application in the cloud, you need a working &lt;strong&gt;Django project&lt;/strong&gt;. For the purposes of this tutorial, it doesn’t have to be elaborate. Feel free to use one of your hobby projects or to &lt;a href=&quot;https://realpython.com/get-started-with-django-1/&quot;&gt;build a sample portfolio app&lt;/a&gt; if you’re short on time, and then skip ahead to &lt;a href=&quot;#step-2-create-a-local-git-repository&quot;&gt;creating your local Git repository&lt;/a&gt;. Otherwise, stick around to make a brand new project from scratch.&lt;/p&gt;
&lt;h3 id=&quot;create-a-virtual-environment&quot;&gt;Create a Virtual Environment&lt;a class=&quot;headerlink&quot; href=&quot;#create-a-virtual-environment&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;It’s a good habit to start every project by creating an isolated virtual environment that won’t be shared with other projects. This can keep your dependencies organized and help avoid package version conflicts. Some dependency managers and packaging tools like &lt;a href=&quot;https://realpython.com/pipenv-guide/&quot;&gt;Pipenv&lt;/a&gt; or &lt;a href=&quot;https://python-poetry.org/&quot;&gt;poetry&lt;/a&gt; automatically create and manage virtual environments for you to follow best practices. Many &lt;a href=&quot;https://realpython.com/python-ides-code-editors-guide/&quot;&gt;IDEs&lt;/a&gt; like &lt;a href=&quot;https://realpython.com/pycharm-guide/&quot;&gt;PyCharm&lt;/a&gt; do this by default, too, when you’re starting a new project.&lt;/p&gt;
&lt;p&gt;However, the most reliable and portable way of creating a Python virtual environment is to do it manually from the command line. You can use an external tool such as &lt;a href=&quot;https://virtualenvwrapper.readthedocs.io/en/latest/&quot;&gt;virtualenvwrapper&lt;/a&gt; or call the built-in &lt;a href=&quot;https://docs.python.org/3/library/venv.html&quot;&gt;&lt;code&gt;venv&lt;/code&gt; module&lt;/a&gt; directly. While virtualenvwrapper keeps all environments in a predefined parent folder, &lt;code&gt;venv&lt;/code&gt; expects you to specify a folder for every environment separately.&lt;/p&gt;
&lt;p&gt;You’ll be using the standard &lt;code&gt;venv&lt;/code&gt; module in this tutorial. It’s customary to place the virtual environment in the &lt;strong&gt;project root folder&lt;/strong&gt;, so let’s make one first and change the working directory to it:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/django-hosting-on-heroku/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/django-hosting-on-heroku/ »&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>Rock, Paper, Scissors With Python: A Command Line Game</title>
      <id>https://realpython.com/courses/python-rock-paper-scissors-game/</id>
      <link href="https://realpython.com/courses/python-rock-paper-scissors-game/"/>
      <updated>2021-09-28T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn to program rock paper scissors in Python from scratch. You&#x27;ll learn how to take in user input, make the computer choose a random action, determine a winner, and split your code into functions.</summary>
      <content type="html">
        &lt;p&gt;Game programming is a great way to learn how to program. You use many tools that you&amp;rsquo;ll see in the real world, plus you get to play a game to test your results! An ideal game to start your Python game programming journey is &lt;a href=&quot;https://en.wikipedia.org/wiki/Rock_paper_scissors&quot;&gt;rock paper scissors&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Code your own &lt;strong&gt;rock paper scissors&lt;/strong&gt; game &lt;/li&gt;
&lt;li&gt;Take in user input with &lt;strong&gt;&lt;code&gt;input()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Play several games in a row using a &lt;strong&gt;&lt;code&gt;while&lt;/code&gt; loop&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Clean up your code with &lt;strong&gt;&lt;code&gt;Enum&lt;/code&gt;&lt;/strong&gt; objects and &lt;strong&gt;functions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Define more complex rules with a &lt;strong&gt;dictionary&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>Reverse Strings in Python: reversed(), Slicing, and More</title>
      <id>https://realpython.com/reverse-string-python/</id>
      <link href="https://realpython.com/reverse-string-python/"/>
      <updated>2021-09-27T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how to reverse strings in Python by using available tools such as reversed() and slicing operations. You&#x27;ll also learn about a few useful ways to build reversed strings by hand.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;When you’re using Python strings often in your code, you may face the need to work with them in &lt;strong&gt;reverse order&lt;/strong&gt;. Python includes a few handy tools and techniques that can help you out in these situations. With them, you’ll be able to build reversed copies of existing strings quickly and efficiently.&lt;/p&gt;
&lt;p&gt;Knowing about these tools and techniques for reversing strings in Python will help you improve your proficiency as a Python developer.&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;Quickly build reversed strings through &lt;strong&gt;slicing&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;reversed copies&lt;/strong&gt; of existing strings using &lt;code&gt;reversed()&lt;/code&gt; and &lt;code&gt;.join()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;iteration&lt;/strong&gt; and &lt;strong&gt;recursion&lt;/strong&gt; to reverse existing strings manually&lt;/li&gt;
&lt;li&gt;Perform &lt;strong&gt;reverse iteration&lt;/strong&gt; over your strings&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sort&lt;/strong&gt; your strings in reverse order using &lt;code&gt;sorted()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To make the most out of this tutorial, you should know the basics of &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-while-loop/&quot;&gt;&lt;code&gt;while&lt;/code&gt;&lt;/a&gt; loops, and &lt;a href=&quot;https://realpython.com/python-thinking-recursively/&quot;&gt;recursion&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-basics-sample-download/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-basics-sample-download&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Get a sample chapter from Python Basics: A Practical Introduction to Python 3&lt;/a&gt; to see how you can go from beginner to intermediate in Python with a complete curriculum, up-to-date for Python 3.8.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;reversing-strings-with-core-python-tools&quot;&gt;Reversing Strings With Core Python Tools&lt;a class=&quot;headerlink&quot; href=&quot;#reversing-strings-with-core-python-tools&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Working with Python &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt; in &lt;strong&gt;reverse order&lt;/strong&gt; can be a requirement in some particular situations. For example, say you have a string &lt;code&gt;&quot;ABCDEF&quot;&lt;/code&gt; and you want a fast way to reverse it to get &lt;code&gt;&quot;FEDCBA&quot;&lt;/code&gt;. What Python tools can you use to help?&lt;/p&gt;
&lt;p&gt;Strings are &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-immutable&quot;&gt;immutable&lt;/a&gt; in Python, so reversing a given string &lt;a href=&quot;https://en.wikipedia.org/wiki/In-place_algorithm&quot;&gt;in place&lt;/a&gt; isn’t possible. You’ll need to create reversed &lt;strong&gt;copies&lt;/strong&gt; of your target strings to meet the requirement.&lt;/p&gt;
&lt;p&gt;Python provides two straightforward ways to reverse strings. Since strings are sequences, they’re &lt;strong&gt;indexable&lt;/strong&gt;, &lt;strong&gt;sliceable&lt;/strong&gt;, and &lt;strong&gt;iterable&lt;/strong&gt;. These features allow you to use &lt;a href=&quot;https://docs.python.org/dev/whatsnew/2.3.html#extended-slices&quot;&gt;slicing&lt;/a&gt; to directly generate a copy of a given string in reverse order. The second option is to use the built-in function &lt;a href=&quot;https://docs.python.org/dev/library/functions.html#reversed&quot;&gt;&lt;code&gt;reversed()&lt;/code&gt;&lt;/a&gt; to create an iterator that yields the characters of an input string in reverse order.&lt;/p&gt;
&lt;h3 id=&quot;reversing-strings-through-slicing&quot;&gt;Reversing Strings Through Slicing&lt;a class=&quot;headerlink&quot; href=&quot;#reversing-strings-through-slicing&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Slicing is a useful technique that allows you to extract items from a given sequence using different combinations of &lt;strong&gt;integer indices&lt;/strong&gt; known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Offset_(computer_science)&quot;&gt;offsets&lt;/a&gt;. When it comes to slicing strings, these offsets define the index of the first character in the slicing, the index of the character that stops the slicing, and a value that defines how many characters you want to jump through in each iteration.&lt;/p&gt;
&lt;p&gt;To slice a string, you can use the following syntax:&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;n&quot;&gt;a_string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;start&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;step&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;Your offsets are &lt;code&gt;start&lt;/code&gt;, &lt;code&gt;stop&lt;/code&gt;, and &lt;code&gt;step&lt;/code&gt;. This expression extracts all the characters from &lt;code&gt;start&lt;/code&gt; to &lt;code&gt;stop − 1&lt;/code&gt; by &lt;code&gt;step&lt;/code&gt;. You’re going to look more deeply at what all this means in just a moment.&lt;/p&gt;
&lt;p&gt;All the offsets are optional, and they have the following default values:&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;Offset&lt;/th&gt;
&lt;th&gt;Default Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;start&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;stop&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;len(a_string)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;step&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Here, &lt;code&gt;start&lt;/code&gt; represents the index of the first character in the slice, while &lt;code&gt;stop&lt;/code&gt; holds the index that stops the slicing operation. The third offset, &lt;code&gt;step&lt;/code&gt;, allows you to decide how many characters the slicing will jump through on each iteration.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; A slicing operation finishes when it reaches the index equal to or greater than &lt;code&gt;stop&lt;/code&gt;. This means that it never includes the item at that index, if any, in the final slice.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;step&lt;/code&gt; offset allows you to fine-tune how you extract desired characters from a string while skipping others:&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;letters&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;AaBbCcDd&quot;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Get all characters relying on default offsets&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;letters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[::]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;AaBbCcDd&#x27;&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;letters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[:]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;AaBbCcDd&#x27;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Get every other character from 0 to the end&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;letters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[::&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;ABCD&#x27;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Get every other character from 1 to the end&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;letters&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;abcd&#x27;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, you first slice &lt;code&gt;letters&lt;/code&gt; without providing explicit offset values to get a full copy of the original string. To this end, you can also use a slicing that omits the second colon (&lt;code&gt;:&lt;/code&gt;). With &lt;code&gt;step&lt;/code&gt; equal to &lt;code&gt;2&lt;/code&gt;, the slicing gets every other character from the target string. You can play around with different offsets to get a better sense of how slicing works.&lt;/p&gt;
&lt;p&gt;Why are slicing and this third offset relevant to reversing strings in Python? The answer lies in how &lt;code&gt;step&lt;/code&gt; works with negative values. If you provide a negative value to &lt;code&gt;step&lt;/code&gt;, then the slicing runs backward, meaning from right to left.&lt;/p&gt;
&lt;p&gt;For example, if you set &lt;code&gt;step&lt;/code&gt; equal to &lt;code&gt;-1&lt;/code&gt;, then you can build a slice that retrieves all the characters in reverse order:&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;letters&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;ABCDEF&quot;&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;letters&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;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;FEDCBA&#x27;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;letters&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;ABCDEF&#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/reverse-string-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/reverse-string-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 #79: Measuring Your Python Learning Progress</title>
      <id>https://realpython.com/podcasts/rpp/79/</id>
      <link href="https://realpython.com/podcasts/rpp/79/"/>
      <updated>2021-09-24T12:00:00+00:00</updated>
      <summary>Where are you along the path of learning Python? Do you feel like you&#x27;re making progress? What are ways you can put the learning path into a more precise focus? This week on the show, we talk with previous guest Martin Breuss about his recent article &quot;How Long Does It Take to Learn Python?&quot;</summary>
      <content type="html">
        &lt;p&gt;Where are you along the path of learning Python? Do you feel like you&#x27;re making progress? What are ways you can put the learning path into a more precise focus? This week on the show, we talk with previous guest Martin Breuss about his recent article &quot;How Long Does It Take to Learn Python?&quot;&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Django Template Language: Tags and Filters</title>
      <id>https://realpython.com/django-templates-tags-filters/</id>
      <link href="https://realpython.com/django-templates-tags-filters/"/>
      <updated>2021-09-22T14:00:00+00:00</updated>
      <summary>Django templates use their own mini-language that&#x27;s inspired by Python. This tutorial covers Django template tags and filters, explaining how to compile and use templates. It covers conditional blocks, looping, and inheritance in tags as well as filters for strings and filters for lists.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;a href=&quot;https://www.djangoproject.com/&quot;&gt;Django&lt;/a&gt; is a powerful framework for creating web applications in Python. Its features include &lt;a href=&quot;https://docs.djangoproject.com/en/3.2/topics/db/models/&quot;&gt;database models&lt;/a&gt;, &lt;a href=&quot;https://docs.djangoproject.com/en/3.2/topics/http/urls/&quot;&gt;routing URLs&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/django-view-authorization/&quot;&gt;authentication&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/django-user-management/&quot;&gt;user management&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/customize-django-admin-python/&quot;&gt;administrative tools&lt;/a&gt;, and a template language. You can compose reusable HTML that changes based on the data you pass to the template language. Django templates use tags and filters to define a mini-language that’s similar to Python—but isn’t Python.&lt;/p&gt;
&lt;p&gt;You’ll get to know Django templates through the tags and filters you use to compose reusable HTML.&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;Write, compile, and render a &lt;strong&gt;Django template&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use the &lt;strong&gt;&lt;code&gt;render()&lt;/code&gt; shortcut&lt;/strong&gt; in views to quickly use templates&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;template tags&lt;/strong&gt; for conditionals and loops in your templates&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;reusable templates&lt;/strong&gt; with inheritance and inclusion&lt;/li&gt;
&lt;li&gt;Modify the presentation of your data through &lt;strong&gt;template filters&lt;/strong&gt;&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-django-resources-learing-guide&quot; data-focus=&quot;false&quot;&gt;Click here to get access to a free Django Learning Resources Guide (PDF)&lt;/a&gt; that shows you tips and tricks as well as common pitfalls to avoid when building Python + Django web applications.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;creating-a-django-project&quot;&gt;Creating a Django Project&lt;a class=&quot;headerlink&quot; href=&quot;#creating-a-django-project&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To experiment with Django templates, you’re going to need a project so that you can play around with the code. You’ll be building moviepalace: the world’s smallest, simplest movie website. For a more detailed example of starting a new project, you can read &lt;a href=&quot;https://realpython.com/get-started-with-django-1/&quot;&gt;Get Started With Django Part 1: Build a Portfolio App&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Django isn’t part of the standard Python library, so you’ll first need to install it. When dealing with third-party libraries, you should use a virtual environment. For a refresher on virtual environments, you can read over &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;Python Virtual Environments: A Primer&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Once you have a virtual environment, run the following commands to get going:&lt;/p&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;linenos&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python -m pip install &lt;span class=&quot;nv&quot;&gt;django&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;.2.5
&lt;span class=&quot;linenos&quot;&gt; 2&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;django-admin startproject moviepalace
&lt;span class=&quot;linenos&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; moviepalace
&lt;span class=&quot;linenos&quot;&gt; 4&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python manage.py startapp moviefacts
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Line 1 installs Django into your virtual environment using &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;. On line 2, the &lt;code&gt;django-admin&lt;/code&gt; command creates a new Django project called &lt;code&gt;moviepalace&lt;/code&gt;. A Django project consists of apps, where your code lives. The fourth command creates an app named &lt;code&gt;moviefacts&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You’re almost ready to go. The last step is to tell Django about your newly created &lt;code&gt;moviefacts&lt;/code&gt; app. You do this by editing the &lt;code&gt;moviepalace/settings.py&lt;/code&gt; file and adding &lt;code&gt;&quot;moviefacts&quot;&lt;/code&gt; to the list of &lt;code&gt;INSTALLED_APPS&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;linenos&quot;&gt;33&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;INSTALLED_APPS&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;linenos&quot;&gt;34&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.admin&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;35&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.auth&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;36&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.contenttypes&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;37&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.sessions&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;38&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.messages&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;39&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.staticfiles&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;hll&quot;&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;moviefacts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;linenos&quot;&gt;41&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;With &lt;code&gt;moviefacts&lt;/code&gt; registered as an app, you can now write a view containing a template.&lt;/p&gt;
&lt;h2 id=&quot;getting-ready-to-use-django-templates&quot;&gt;Getting Ready to Use Django Templates&lt;a class=&quot;headerlink&quot; href=&quot;#getting-ready-to-use-django-templates&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Django was created at a &lt;a href=&quot;https://en.wikipedia.org/wiki/Lawrence_Journal-World&quot;&gt;newspaper&lt;/a&gt; to help build web applications quickly. One of the goals of the framework was to separate the concerns of the business logic from the presentation logic.&lt;/p&gt;
&lt;p&gt;Web designers, rather than Python programmers, frequently did the HTML development at the paper. Because of this, the developers decided not to allow the execution of Python within the template language. This decision simplified what the designers needed to know and sandboxed their code for security reasons. The end result was a separate mini-language. This approach is in contrast to the &lt;a href=&quot;https://en.wikipedia.org/wiki/PHP#Syntax&quot;&gt;PHP approach&lt;/a&gt;, where the code is directly embedded in the HTML.&lt;/p&gt;
&lt;h3 id=&quot;compiling-and-rendering-django-templates&quot;&gt;Compiling and Rendering Django Templates&lt;a class=&quot;headerlink&quot; href=&quot;#compiling-and-rendering-django-templates&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Django templates let you dynamically change output content within a rendering context. You can think of templates as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Form_letter&quot;&gt;form letter&lt;/a&gt;, where the letter’s contents include places where information can be inserted. You can run the rendering process multiple times with different data and get different results each time.&lt;/p&gt;
&lt;p&gt;Django provides the &lt;strong&gt;&lt;code&gt;Template&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;Context&lt;/code&gt;&lt;/strong&gt; classes to represent the string template being rendered and the data being used during generation. The &lt;code&gt;Context&lt;/code&gt; class is a wrapper to a &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;&lt;code&gt;dict&lt;/code&gt;&lt;/a&gt; and provides key-value pairs to populate the generated content. The result of a rendered template can be any text but is frequently HTML. Django &lt;em&gt;is&lt;/em&gt; a web framework, after all.&lt;/p&gt;
&lt;p&gt;It’s time to build your first template. To see one in action, you’ll first need a view. Add the following code to &lt;code&gt;moviefacts/views.py&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;linenos&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# moviefacts/views.py&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 2&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;django.http&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;HttpResponse&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;django.template&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Template&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 4&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 5&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;citizen_kane&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 6&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&quot;{{movie}} was released in {{year}}&quot;&quot;&quot;&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 7&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;template&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 8&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;movie&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Citizen Kane&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;year&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1941&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 9&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;10&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;11&lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;HttpResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;result&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;In this view, you see some of the main concepts that make up the Django templating language:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Line 6&lt;/strong&gt; contains references to &lt;code&gt;movie&lt;/code&gt; and &lt;code&gt;year&lt;/code&gt;. This is similar to a Python &lt;a href=&quot;https://realpython.com/python-f-strings/&quot;&gt;f-string&lt;/a&gt;. The double braces, or &lt;strong&gt;mustache brackets&lt;/strong&gt;, indicate the items that Django replaces when it renders the template.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Line 7&lt;/strong&gt; instantiates a &lt;code&gt;Template&lt;/code&gt; object by passing in the string that specifies the template.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Line 8&lt;/strong&gt; creates a &lt;code&gt;Context&lt;/code&gt; object by populating it with a dictionary. The &lt;code&gt;Context&lt;/code&gt; object contains all of the data available to the template when Django renders it. The template contains two items to replace: &lt;code&gt;{{movie}}&lt;/code&gt; with &lt;code&gt;&quot;Citizen Kane&quot;&lt;/code&gt; and &lt;code&gt;{{year}}&lt;/code&gt; with &lt;code&gt;1941&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Line 10&lt;/strong&gt; has the call to the &lt;code&gt;.render()&lt;/code&gt; method that generates the result.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Line 11&lt;/strong&gt; returns the rendered content wrapped in an &lt;code&gt;HttpResponse&lt;/code&gt; object.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To test this out, you’ll need to make this view available in the browser, so you’ll need to add a route. Modify &lt;code&gt;moviepalace/urls.py&lt;/code&gt; as follows:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/django-templates-tags-filters/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/django-templates-tags-filters/ »&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>Pass by Reference in Python: Best Practices</title>
      <id>https://realpython.com/courses/pass-by-reference-python-best-practices/</id>
      <link href="https://realpython.com/courses/pass-by-reference-python-best-practices/"/>
      <updated>2021-09-21T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll explore the concept of passing by reference and learn how it relates to Python&#x27;s own system for handling function arguments. You&#x27;ll look at several use cases for passing by reference and learn some best practices for implementing pass-by-reference constructs in Python.</summary>
      <content type="html">
        &lt;p&gt;After gaining some familiarity with Python, you may notice cases in which your functions don&amp;rsquo;t modify arguments in place as you might expect, especially if you&amp;rsquo;re familiar with other programming languages. Some languages handle function arguments as &lt;strong&gt;references&lt;/strong&gt; to existing &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt;, which is known as &lt;strong&gt;pass by reference&lt;/strong&gt;. Other languages handle them as &lt;strong&gt;independent values&lt;/strong&gt;, an approach known as &lt;strong&gt;pass by value&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re an intermediate Python programmer who wishes to understand Python&amp;rsquo;s peculiar way of handling function arguments, then this course is for you. You&amp;rsquo;ll implement real use cases of pass-by-reference constructs in Python and learn several best practices to avoid pitfalls with your function arguments.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What it means to &lt;strong&gt;pass by reference&lt;/strong&gt; and why you&amp;rsquo;d want to do so&lt;/li&gt;
&lt;li&gt;How passing by reference differs from both &lt;strong&gt;passing by value&lt;/strong&gt; and &lt;strong&gt;Python&amp;rsquo;s unique approach&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;function arguments&lt;/strong&gt; behave in Python&lt;/li&gt;
&lt;li&gt;How you can use certain &lt;strong&gt;mutable types&lt;/strong&gt; to pass by reference in Python&lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;best practices&lt;/strong&gt; are for replicating pass by reference in Python&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using the &quot;and&quot; Boolean Operator in Python</title>
      <id>https://realpython.com/python-and-operator/</id>
      <link href="https://realpython.com/python-and-operator/"/>
      <updated>2021-09-20T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how Python&#x27;s &quot;and&quot; operator works and how to use it in your code. You&#x27;ll get to know its special features and see what kind of programming problems you can solve by using &quot;and&quot; in Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python has three &lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Boolean&lt;/a&gt; operators, or &lt;strong&gt;logical operators&lt;/strong&gt;: &lt;code&gt;and&lt;/code&gt;, &lt;code&gt;or&lt;/code&gt;, and &lt;code&gt;not&lt;/code&gt;. You can use them to check if certain conditions are met before deciding the execution path your programs will follow. In this tutorial, you’ll learn about the &lt;code&gt;and&lt;/code&gt; operator and how to use it in your code.&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;Understand the logic behind Python’s &lt;strong&gt;&lt;code&gt;and&lt;/code&gt; operator&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Build and understand &lt;strong&gt;Boolean&lt;/strong&gt; and &lt;strong&gt;non-Boolean expressions&lt;/strong&gt; that use the &lt;code&gt;and&lt;/code&gt; operator&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;and&lt;/code&gt; operator in &lt;strong&gt;Boolean contexts&lt;/strong&gt; to decide the &lt;strong&gt;course of action&lt;/strong&gt; of your programs&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;and&lt;/code&gt; operator in &lt;strong&gt;non-Boolean contexts&lt;/strong&gt; to make your code more concise&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll also code a few practical examples that will help you understand how to use the &lt;code&gt;and&lt;/code&gt; operator to approach different problems in a &lt;a href=&quot;https://realpython.com/learning-paths/writing-pythonic-code/&quot;&gt;Pythonic&lt;/a&gt; way. Even if you don’t use all the features of &lt;code&gt;and&lt;/code&gt;, learning about them will allow you to write better and more accurate code.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-tricks-sample-pdf/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-tricks-sample-pdf&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Get a sample chapter from Python Tricks: The Book&lt;/a&gt; that shows you Python’s best practices with simple examples you can apply instantly to write more beautiful + Pythonic code.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;working-with-boolean-logic-in-python&quot;&gt;Working With Boolean Logic in Python&lt;a class=&quot;headerlink&quot; href=&quot;#working-with-boolean-logic-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Back in 1854, &lt;a href=&quot;https://en.wikipedia.org/wiki/George_Boole&quot;&gt;George Boole&lt;/a&gt; authored &lt;a href=&quot;https://en.wikipedia.org/wiki/The_Laws_of_Thought&quot;&gt;The Laws of Thought&lt;/a&gt;, which contains what’s known as &lt;a href=&quot;https://en.wikipedia.org/wiki/Boolean_algebra&quot;&gt;Boolean algebra&lt;/a&gt;. This algebra relies on two values: &lt;strong&gt;true&lt;/strong&gt; and &lt;strong&gt;false&lt;/strong&gt;. It also defines a set of Boolean operations, also known as logical operations, denoted by the generic operators &lt;a href=&quot;https://en.wikipedia.org/wiki/Logical_conjunction&quot;&gt;&lt;code&gt;AND&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Logical_disjunction&quot;&gt;&lt;code&gt;OR&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://en.wikipedia.org/wiki/Negation&quot;&gt;&lt;code&gt;NOT&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;These Boolean values and operators are pretty helpful in programming. For example, you can construct arbitrarily complex &lt;a href=&quot;https://en.wikipedia.org/wiki/Boolean_expression&quot;&gt;Boolean expressions&lt;/a&gt; with the operators and determine their resulting &lt;a href=&quot;https://en.wikipedia.org/wiki/Truth_value&quot;&gt;truth value&lt;/a&gt; as true or false. You can use the &lt;strong&gt;truth value&lt;/strong&gt; of Boolean expressions to decide the course of action of your programs.&lt;/p&gt;
&lt;p&gt;In Python, the &lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Boolean type&lt;/a&gt; &lt;code&gt;bool&lt;/code&gt; is a subclass of &lt;a href=&quot;https://docs.python.org/3/library/functions.html#int&quot;&gt;&lt;code&gt;int&lt;/code&gt;&lt;/a&gt; and can take the values &lt;code&gt;True&lt;/code&gt; or &lt;code&gt;False&lt;/code&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;nb&quot;&gt;issubclass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;True&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;help&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Help on class bool in module builtins:&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;class bool(int)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    ...&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;class &#x27;bool&#x27;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;class &#x27;bool&#x27;&amp;gt;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;isinstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;True&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;isinstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;True&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;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As you can see in this code, Python implements &lt;code&gt;bool&lt;/code&gt; as a subclass of &lt;code&gt;int&lt;/code&gt; with two possible values, &lt;code&gt;True&lt;/code&gt; and &lt;code&gt;False&lt;/code&gt;. These values are &lt;a href=&quot;https://docs.python.org/3/library/constants.html#built-in-constants&quot;&gt;built-in constants&lt;/a&gt; in Python. They’re internally implemented as integer &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;numbers&lt;/a&gt; with the value &lt;code&gt;1&lt;/code&gt; for &lt;code&gt;True&lt;/code&gt; and &lt;code&gt;0&lt;/code&gt; for &lt;code&gt;False&lt;/code&gt;. Note that both &lt;code&gt;True&lt;/code&gt; and &lt;code&gt;False&lt;/code&gt; must be capitalized.&lt;/p&gt;
&lt;p&gt;Along with the &lt;code&gt;bool&lt;/code&gt; type, Python provides three Boolean operators, or logical operators, that allow you to combine Boolean expressions and objects into more elaborate expressions. Those operators are the following:&lt;/p&gt;
&lt;div class=&quot;table-responsive&quot;&gt;
&lt;table class=&quot;table table-hover&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th class=&quot;text-left&quot;&gt;Operator&lt;/th&gt;
&lt;th class=&quot;text-left&quot;&gt;Logical Operation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;&lt;a href=&quot;https://realpython.com/python-keywords/#the-and-keyword&quot;&gt;&lt;code&gt;and&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;Conjunction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;&lt;a href=&quot;https://realpython.com/python-or-operator/&quot;&gt;&lt;code&gt;or&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;Disjunction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;&lt;a href=&quot;https://realpython.com/python-keywords/#the-not-keyword&quot;&gt;&lt;code&gt;not&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;Negation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;With these operators, you can connect several Boolean expressions and objects to build your own expressions. Unlike other languages, Python uses English words to denote Boolean operators. These words are &lt;strong&gt;keywords&lt;/strong&gt; of the language, so you can’t use them as identifiers.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn about Python’s &lt;code&gt;and&lt;/code&gt; operator. This operator implements the logical &lt;code&gt;AND&lt;/code&gt; operation. You’ll learn how it works and how to use it either in a Boolean or non-Boolean context.&lt;/p&gt;
&lt;h2 id=&quot;getting-started-with-pythons-and-operator&quot;&gt;Getting Started With Python’s &lt;code&gt;and&lt;/code&gt; Operator&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-pythons-and-operator&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python’s &lt;code&gt;and&lt;/code&gt; operator takes two &lt;strong&gt;operands&lt;/strong&gt;, which can be Boolean expressions, objects, or a combination. With those operands, the &lt;code&gt;and&lt;/code&gt; operator builds more elaborate expressions. The operands in an &lt;code&gt;and&lt;/code&gt; expression are commonly known as &lt;strong&gt;conditions&lt;/strong&gt;. If both conditions are true, then the &lt;code&gt;and&lt;/code&gt; expression returns a true result. Otherwise, it returns a false result:&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;kc&quot;&gt;True&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;True&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;False&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;False&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;False&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;False&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;False&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;False&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;False&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;These examples show that an &lt;code&gt;and&lt;/code&gt; expression only returns &lt;code&gt;True&lt;/code&gt; when both operands in the expressions are true. Since the &lt;code&gt;and&lt;/code&gt; operator takes two operands to build an expression, it’s a &lt;strong&gt;binary operator&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The quick examples above show what’s known as the &lt;code&gt;and&lt;/code&gt; operator’s truth table:&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;&lt;code&gt;operand1&lt;/code&gt;&lt;/th&gt;
&lt;th class=&quot;text-left&quot;&gt;&lt;code&gt;operand2&lt;/code&gt;&lt;/th&gt;
&lt;th class=&quot;text-left&quot;&gt;&lt;code&gt;operand1 and operand2&lt;/code&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;True&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;True&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;True&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;True&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;False&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;False&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;False&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;False&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;False&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-left&quot;&gt;False&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;True&lt;/td&gt;
&lt;td class=&quot;text-left&quot;&gt;False&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;This table summarizes the resulting &lt;strong&gt;truth value&lt;/strong&gt; of a Boolean expression like &lt;code&gt;operand1 and operand2&lt;/code&gt;. The result of the expression depends on the truth values of its operands. It’ll be true if both are true. Otherwise, it’ll be false. This is the general logic behind the &lt;code&gt;and&lt;/code&gt; operator. However, this operator can do more than that in Python.&lt;/p&gt;
&lt;p&gt;In the following sections, you’ll learn how to use &lt;code&gt;and&lt;/code&gt; for building your own expressions with different types of operands.&lt;/p&gt;
&lt;h3 id=&quot;using-pythons-and-operator-with-boolean-expressions&quot;&gt;Using Python’s &lt;code&gt;and&lt;/code&gt; Operator With Boolean Expressions&lt;a class=&quot;headerlink&quot; href=&quot;#using-pythons-and-operator-with-boolean-expressions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You’ll typically use logical operators to build &lt;strong&gt;compound Boolean expressions&lt;/strong&gt;, which are combinations of &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt; and values that produce a Boolean value as a result. In other words, Boolean expressions return &lt;code&gt;True&lt;/code&gt; or &lt;code&gt;False&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-and-operator/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-and-operator/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #78: Learning Python Through Illustrated Stories</title>
      <id>https://realpython.com/podcasts/rpp/78/</id>
      <link href="https://realpython.com/podcasts/rpp/78/"/>
      <updated>2021-09-17T12:00:00+00:00</updated>
      <summary>Are you a visual learner? Does it help to have programming concepts shared with concrete examples and images? Would you like to see if your child might be interested in programming? This week on the show, we talk with author Shari Eskenas about her books, &quot;A Day in Code - Python: Learn to Code in Python Through an Illustrated Story&quot; and &quot;Learn Python Through Nursery Rhymes &amp; Fairy Tales.&quot;</summary>
      <content type="html">
        &lt;p&gt;Are you a visual learner? Does it help to have programming concepts shared with concrete examples and images? Would you like to see if your child might be interested in programming? This week on the show, we talk with author Shari Eskenas about her books, &quot;A Day in Code - Python: Learn to Code in Python Through an Illustrated Story&quot; and &quot;Learn Python Through Nursery Rhymes &amp; Fairy Tales.&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>Using Data Classes in Python</title>
      <id>https://realpython.com/courses/python-data-classes/</id>
      <link href="https://realpython.com/courses/python-data-classes/"/>
      <updated>2021-09-14T14:00:00+00:00</updated>
      <summary>Data classes are one of the new features introduced in Python 3.7. When using data classes, you don&#x27;t have to write boilerplate code to get proper initialization, representation, and comparisons for your objects.</summary>
      <content type="html">
        &lt;p&gt;One &lt;a href=&quot;https://realpython.com/python37-new-features/&quot;&gt;new and exciting feature that came out in Python 3.7&lt;/a&gt; was the data class. A data class is a class typically containing mainly data, although there aren&amp;rsquo;t really any restrictions.&lt;/p&gt;
&lt;p&gt;With data classes, you don&amp;rsquo;t have to write boilerplate code to get proper initialization, representation, and comparisons for your objects.&lt;/p&gt;
&lt;p&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Define your own &lt;strong&gt;data classes&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;default values&lt;/strong&gt; to the fields in your data class&lt;/li&gt;
&lt;li&gt;Customize the &lt;strong&gt;ordering&lt;/strong&gt; of data class objects&lt;/li&gt;
&lt;li&gt;Work with &lt;strong&gt;immutable data classes&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 #77: Advantages of Completing Small Python Projects</title>
      <id>https://realpython.com/podcasts/rpp/77/</id>
      <link href="https://realpython.com/podcasts/rpp/77/"/>
      <updated>2021-09-10T12:00:00+00:00</updated>
      <summary>Are you a beginner or intermediate Python programmer who has made it through some of the fundamentals? Have you tried to tackle a big project but got stuck and frustrated? Completing some small projects might be the answer. This week on the show, we have author Al Sweigart and talk about his new book, &quot;The Big Book of Small Python Projects.&quot;</summary>
      <content type="html">
        &lt;p&gt;Are you a beginner or intermediate Python programmer who has made it through some of the fundamentals? Have you tried to tackle a big project but got stuck and frustrated? Completing some small projects might be the answer. This week on the show, we have author Al Sweigart and talk about his new book, &quot;The Big Book of Small Python Projects.&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>Graph Your Data With Python and ggplot</title>
      <id>https://realpython.com/courses/graph-data-with-python-and-ggplot/</id>
      <link href="https://realpython.com/courses/graph-data-with-python-and-ggplot/"/>
      <updated>2021-09-07T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to use ggplot in Python to build data visualizations with plotnine. You&#x27;ll discover what a grammar of graphics is and how it can help you create plots in a very concise and consistent way.</summary>
      <content type="html">
        &lt;p&gt;In this course, you&amp;rsquo;ll learn how to use &lt;code&gt;ggplot&lt;/code&gt; in Python to create data visualizations using a &lt;strong&gt;grammar of graphics&lt;/strong&gt;. A grammar of graphics is a high-level tool that allows you to create data plots in an efficient and consistent way. It abstracts most low-level details, letting you focus on creating meaningful and beautiful visualizations for your data. &lt;/p&gt;
&lt;p&gt;There are several Python packages that provide a grammar of graphics. This course focuses on &lt;strong&gt;plotnine&lt;/strong&gt; since it&amp;rsquo;s one of the most mature ones. plotnine is based on &lt;a href=&quot;https://ggplot2.tidyverse.org/&quot;&gt;&lt;code&gt;ggplot2&lt;/code&gt;&lt;/a&gt; from the R programming language, so if you have a background in R, then you can consider plotnine as the equivalent of &lt;code&gt;ggplot2&lt;/code&gt; in Python.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install &lt;strong&gt;plotnine&lt;/strong&gt; and &lt;strong&gt;Jupyter Notebook&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Combine the different elements of the &lt;strong&gt;grammar of graphics&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use plotnine to &lt;strong&gt;create visualizations&lt;/strong&gt; in an efficient and consistent way&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Export&lt;/strong&gt; your data visualizations to files&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This course assumes that you already have &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;some experience in Python&lt;/a&gt; and at least some knowledge of &lt;strong&gt;Jupyter Notebook&lt;/strong&gt; and &lt;strong&gt;pandas&lt;/strong&gt;. To get up to speed on these topics, check out &lt;a href=&quot;https://realpython.com/jupyter-notebook-introduction/&quot;&gt;Jupyter Notebook: An Introduction&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/pandas-python-explore-dataset/&quot;&gt;Using Pandas and Python to Explore Your Dataset&lt;/a&gt;.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #76: Harnessing Python&#x27;s math Module and Exposing Practical Pandas Functions</title>
      <id>https://realpython.com/podcasts/rpp/76/</id>
      <link href="https://realpython.com/podcasts/rpp/76/"/>
      <updated>2021-09-03T12:00:00+00:00</updated>
      <summary>How well do you know Python&#x27;s math module? Maybe you&#x27;ve used a few of the constants or arithmetic functions. You may be surprised by the amount of functionality hiding within this built-in library, and perhaps you don&#x27;t need to reach for an additional outside library. This week on the show, David Amos is back, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;How well do you know Python&#x27;s math module? Maybe you&#x27;ve used a few of the constants or arithmetic functions. You may be surprised by the amount of functionality hiding within this built-in library, and perhaps you don&#x27;t need to reach for an additional outside library. This week on the show, David Amos is back, 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>Splitting Datasets With scikit-learn and train_test_split()</title>
      <id>https://realpython.com/courses/splitting-datasets-scikit-learn-train-test-split/</id>
      <link href="https://realpython.com/courses/splitting-datasets-scikit-learn-train-test-split/"/>
      <updated>2021-08-31T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn why it&#x27;s important to split your dataset in supervised machine learning and how to do that with train_test_split() from scikit-learn.</summary>
      <content type="html">
        &lt;p&gt;One of the key aspects of supervised &lt;a href=&quot;https://realpython.com/learning-paths/machine-learning-python/&quot;&gt;machine learning&lt;/a&gt; is model evaluation and validation. When you evaluate the predictive performance of your model, it&amp;rsquo;s essential that the process be unbiased. Using &lt;a href=&quot;https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html&quot;&gt;&lt;strong&gt;&lt;code&gt;train_test_split()&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; from the data science library &lt;a href=&quot;https://scikit-learn.org/stable/index.html&quot;&gt;scikit-learn&lt;/a&gt;, you can split your dataset into subsets that minimize the potential for bias in your evaluation and validation process.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Why you need to &lt;strong&gt;split your dataset&lt;/strong&gt; in supervised machine learning&lt;/li&gt;
&lt;li&gt;Which &lt;strong&gt;subsets&lt;/strong&gt; of the dataset you need for an unbiased evaluation of your model&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;&lt;code&gt;train_test_split()&lt;/code&gt;&lt;/strong&gt; to split your data&lt;/li&gt;
&lt;li&gt;How to combine &lt;code&gt;train_test_split()&lt;/code&gt; with &lt;strong&gt;prediction methods&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition, you&amp;rsquo;ll get information on related tools from &lt;a href=&quot;https://scikit-learn.org/stable/modules/classes.html#module-sklearn.model_selection&quot;&gt;&lt;code&gt;sklearn.model_selection&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #75: Building With CircuitPython &amp; Constraints of Python for Microcontrollers</title>
      <id>https://realpython.com/podcasts/rpp/75/</id>
      <link href="https://realpython.com/podcasts/rpp/75/"/>
      <updated>2021-08-27T12:00:00+00:00</updated>
      <summary>Can you make a version of Python that fits within the memory constraints of a microcontroller and have it still feel like Python? That is the intention behind CircuitPython. This week on the show, we have Scott Shawcroft, who is the project lead for CircuitPython.</summary>
      <content type="html">
        &lt;p&gt;Can you make a version of Python that fits within the memory constraints of a microcontroller and have it still feel like Python? That is the intention behind CircuitPython. This week on the show, we have Scott Shawcroft, who is the project lead for CircuitPython.&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 the Python math Module</title>
      <id>https://realpython.com/courses/exploring-python-math-module/</id>
      <link href="https://realpython.com/courses/exploring-python-math-module/"/>
      <updated>2021-08-24T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you’ll learn all about Python’s math module for higher-level mathematical functions. Whether you’re working on a scientific project, a financial application, or any other type of programming endeavor, you just can’t escape the need for math!</summary>
      <content type="html">
        &lt;p&gt;In this course, you&amp;rsquo;ll learn all about Python&amp;rsquo;s &lt;strong&gt;&lt;code&gt;math&lt;/code&gt;&lt;/strong&gt; module. Mathematical calculations are an essential part of most Python development. Whether you&amp;rsquo;re working on a scientific project, a financial application, or any other type of programming endeavor, you just can&amp;rsquo;t escape the need for math.&lt;/p&gt;
&lt;p&gt;For straightforward mathematical calculations in Python, you can use the built-in mathematical &lt;strong&gt;operators&lt;/strong&gt;, such as addition (&lt;code&gt;+&lt;/code&gt;), subtraction (&lt;code&gt;-&lt;/code&gt;), division (&lt;code&gt;/&lt;/code&gt;), and multiplication (&lt;code&gt;*&lt;/code&gt;). But more advanced operations, such as exponential, logarithmic, trigonometric, or power functions, are not built in. Does that mean you need to implement all of these functions from scratch?&lt;/p&gt;
&lt;p&gt;Fortunately, no. Python provides a &lt;a href=&quot;https://realpython.com/python-modules-packages/&quot;&gt;module&lt;/a&gt; specifically designed for higher-level mathematical operations: the &lt;code&gt;math&lt;/code&gt; module.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What the Python &lt;code&gt;math&lt;/code&gt; module is&lt;/li&gt;
&lt;li&gt;How to use &lt;code&gt;math&lt;/code&gt; module functions to solve real-life problems&lt;/li&gt;
&lt;li&gt;What the constants of the &lt;code&gt;math&lt;/code&gt; module are, including pi, tau, and Euler&amp;rsquo;s number&lt;/li&gt;
&lt;li&gt;What the differences between built-in functions and &lt;code&gt;math&lt;/code&gt; functions are&lt;/li&gt;
&lt;li&gt;What the differences between &lt;code&gt;math&lt;/code&gt;, &lt;code&gt;cmath&lt;/code&gt;, and NumPy are&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A background in mathematics will be helpful here, but don&amp;rsquo;t worry if math isn&amp;rsquo;t your strong suit. This course will explain the basics of everything you need to know.&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 #74: Python&#x27;s Assignment Expressions and Fixing a Botched Release to PyPI</title>
      <id>https://realpython.com/podcasts/rpp/74/</id>
      <link href="https://realpython.com/podcasts/rpp/74/"/>
      <updated>2021-08-20T12:00:00+00:00</updated>
      <summary>Have you started to use Python&#x27;s assignment expression in your code? Maybe you have heard them called the walrus operator. Now that the controversy over the introduction in Python 3.8 has settled down, how can you use assignment expressions effectively in your code? This week on the show, David Amos is back, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you started to use Python&#x27;s assignment expression in your code? Maybe you have heard them called the walrus operator. Now that the controversy over the introduction in Python 3.8 has settled down, how can you use assignment expressions effectively in your code? This week on the show, David Amos is back, 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>Reading and Writing Files With Pandas</title>
      <id>https://realpython.com/courses/reading-writing-files-pandas/</id>
      <link href="https://realpython.com/courses/reading-writing-files-pandas/"/>
      <updated>2021-08-17T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn about the Pandas IO tools API and how you can use it to read and write files. You&#x27;ll use the Pandas read_csv() function to work with CSV files. You&#x27;ll also cover similar methods for efficiently working with Excel, CSV, JSON, HTML, SQL, pickle, and big data files.</summary>
      <content type="html">
        &lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://pandas.pydata.org/&quot;&gt;Pandas&lt;/a&gt;&lt;/strong&gt; is a powerful and flexible Python package that allows you to work with labeled and time series data. It also provides &lt;a href=&quot;https://realpython.com/python-statistics/&quot;&gt;statistics&lt;/a&gt; methods, enables plotting, and more. One crucial feature of Pandas is its ability to write and read Excel, CSV, and many other types of files. Functions like the Pandas &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html&quot;&gt;&lt;code&gt;read_csv()&lt;/code&gt;&lt;/a&gt; method enable you to work with files effectively. You can use them to save the data and labels from Pandas objects to a file and load them later as Pandas &lt;code&gt;Series&lt;/code&gt; or &lt;a href=&quot;https://realpython.com/pandas-dataframe/&quot;&gt;&lt;code&gt;DataFrame&lt;/code&gt;&lt;/a&gt; instances.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What the &lt;strong&gt;Pandas IO tools&lt;/strong&gt; API is&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;read and write data&lt;/strong&gt; to and from files&lt;/li&gt;
&lt;li&gt;How to use the methods of &lt;strong&gt;read_csv()&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to work with various &lt;strong&gt;file formats&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to work with &lt;strong&gt;big data&lt;/strong&gt; efficiently&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 #73: Supporting Python Open Source Projects and Maintainers</title>
      <id>https://realpython.com/podcasts/rpp/73/</id>
      <link href="https://realpython.com/podcasts/rpp/73/"/>
      <updated>2021-08-13T12:00:00+00:00</updated>
      <summary>How do you define open source software? What are the challenges an open source project and maintainers face? How do maintainers receive financial, legal, security, or other types of help? This week on the show, we have Josh Simmons from Tidelift and the Open Source Initiative to help answer these questions.</summary>
      <content type="html">
        &lt;p&gt;How do you define open source software? What are the challenges an open source project and maintainers face? How do maintainers receive financial, legal, security, or other types of help? This week on the show, we have Josh Simmons from Tidelift and the Open Source Initiative to help answer these questions.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  

</feed>
