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

  
    <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;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;p&gt;There are a few other ways to mess up dictionary syntax. A typical one is forgetting a comma after one of the items:&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>Build a Personal Diary With Django and Python</title>
      <id>https://realpython.com/django-diary-project-python/</id>
      <link href="https://realpython.com/django-diary-project-python/"/>
      <updated>2021-09-15T14:00:00+00:00</updated>
      <summary>In this beginner-friendly tutorial, you&#x27;ll build a personal diary in Django. You&#x27;ll use the strengths of the Django web framework and learn the basics of web apps.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;A &lt;strong&gt;diary&lt;/strong&gt; is a personal safe space. With the help of Django, you can create a diary on your own computer without storing data in anyone else’s cloud. By following along with the project below, you’ll see how quickly you can build a functioning &lt;strong&gt;web app&lt;/strong&gt; in Django without any external dependencies.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up a &lt;strong&gt;Django project&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Work with the standard &lt;strong&gt;SQLite&lt;/strong&gt; database&lt;/li&gt;
&lt;li&gt;Make use of the Django &lt;strong&gt;admin site&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;models&lt;/strong&gt; and &lt;strong&gt;class-based views&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Nest and style &lt;strong&gt;templates&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Secure your diary with &lt;strong&gt;authentication&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This tutorial will guide you &lt;strong&gt;step-by-step&lt;/strong&gt; to your final diary. If you’re just starting out with Django and want to finish your first real project, then this tutorial is for you!&lt;/p&gt;
&lt;p&gt;To get the complete source code for the Django project and its steps, click 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-diary-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-django-diary-project-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to build a personal diary web app with Django and Python in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo-video&quot;&gt;Demo Video&lt;a class=&quot;headerlink&quot; href=&quot;#demo-video&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On the main page of your diary, you’ll have a list of entries. You can scroll through them and create new ones with a click of a button. The styling is provided in this tutorial, so you can focus on the Django part of the code. Here’s a quick demo video of how it will look in action:&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/561429980?background=1&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;/div&gt;

&lt;p&gt;By the end of the tutorial, you’ll be able to flawlessly navigate your diary to create, read, update, and delete entries on demand.&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;The tutorial is divided into multiple steps. That way, you can take breaks and continue at your own pace. In each step, you’ll tackle a specific area of your diary project:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Setting up your Django diary project&lt;/li&gt;
&lt;li&gt;Creating entries on the back end&lt;/li&gt;
&lt;li&gt;Displaying entries on the front end&lt;/li&gt;
&lt;li&gt;Adding styling&lt;/li&gt;
&lt;li&gt;Managing entries on the front end&lt;/li&gt;
&lt;li&gt;Improving your user experience&lt;/li&gt;
&lt;li&gt;Implementing authentication&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;By following along, you’ll explore the basics of web apps and how to add common features of a Django project. After finishing the tutorial, you’ll have created your own personal diary app and will have a &lt;strong&gt;Django project blueprint&lt;/strong&gt; to build upon.&lt;/p&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You don’t need any previous knowledge of Django to complete this project. If you want to learn more about the topics you encounter in this tutorial, you’ll find links to resources along the way.&lt;/p&gt;
&lt;p&gt;However, you should be comfortable using the command line and have a &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;basic knowledge&lt;/a&gt; of Python and &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;classes&lt;/a&gt;. Although it helps to know about &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environments&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;, you’ll learn how to set everything up as you work through the tutorial.&lt;/p&gt;
&lt;h2 id=&quot;step-1-setting-up-your-django-diary&quot;&gt;Step 1: Setting Up Your Django Diary&lt;a class=&quot;headerlink&quot; href=&quot;#step-1-setting-up-your-django-diary&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Start the project by creating your project directory and setting up a &lt;strong&gt;virtual environment&lt;/strong&gt;. This setup will keep your code isolated from any other projects on your machine. You can name your project folder and the virtual environment any way you want. In this tutorial, the project folder is named &lt;code&gt;my-diary&lt;/code&gt;, and the virtual environment is named &lt;code&gt;.venv&lt;/code&gt;:&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;mkdir my-diary
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; my-diary
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python3 -m venv .venv
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; .venv/bin/activate
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Your prompt now starts with the name of your virtual environment in parenthesis. This is an indicator that the virtual environment is activated. For the rest of the tutorial, your virtual environment must be activated. All of the following steps will take place inside this directory or its subdirectories.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; To activate your virtual environment on &lt;strong&gt;Windows&lt;/strong&gt;, you might need to run this command:&lt;/p&gt;
&lt;div class=&quot;highlight doscon&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;c:\&amp;gt;&lt;/span&gt; python -m venv .venv
&lt;span class=&quot;gp&quot;&gt;c:\&amp;gt;&lt;/span&gt; .venv\Scripts\activate.bat
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For other platforms and shells, you might need to use a &lt;a href=&quot;https://docs.python.org/3/library/venv.html#creating-virtual-environments&quot;&gt;different command&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The only other requirement for your diary is Django itself. Install the specific version of this tutorial with &lt;code&gt;pip&lt;/code&gt;:&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 gp-VirtualEnv&quot;&gt;(.venv)&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.1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command installs Django and some dependencies that Django requires. That’s everything you need.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/django-diary-project-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/django-diary-project-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>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>Python News: What&#x27;s New From August 2021?</title>
      <id>https://realpython.com/python-news-august-2021/</id>
      <link href="https://realpython.com/python-news-august-2021/"/>
      <updated>2021-09-13T14:00:00+00:00</updated>
      <summary>August 2021 was an eventful month in the world of Python. In this article, you&#x27;ll get up to speed on everything that happened in the past month, including three new Python releases.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Summer holidays have ended, and it’s back to school again. While it was a time of leisure and getting disconnected from the virtual world for many of us, the Python maintainers and contributors have been busy working during that same period. Just in &lt;strong&gt;August 2021&lt;/strong&gt;, the Python community saw three new Python releases, bringing some important security fixes, optimizations, and brand-new features.&lt;/p&gt;
&lt;p&gt;Let’s dive into the biggest Python news from the past month!&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;python-310-is-almost-ready&quot;&gt;Python 3.10 Is Almost Ready&lt;a class=&quot;headerlink&quot; href=&quot;#python-310-is-almost-ready&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On August 3rd, the &lt;a href=&quot;https://pythoninsider.blogspot.com/2021/08/python-3100rc1-is-available.html&quot;&gt;first preview release of Python 3.10.0&lt;/a&gt; finally came out.&lt;/p&gt;
&lt;p&gt;The Python community has been holding their breath for months in anticipation of the next minor release of their favorite language. Python 3.10.0 will be packed with loads of exciting new &lt;a href=&quot;https://docs.python.org/3.10/whatsnew/3.10.html&quot;&gt;features and improvements&lt;/a&gt;. Some even sparked a bit of &lt;a href=&quot;https://lwn.net/Articles/845480/&quot;&gt;controversy&lt;/a&gt;, but that’s often the case with groundbreaking changes.&lt;/p&gt;
&lt;p&gt;If you can’t wait to give Python 3.10.0 a test drive before it’s officially released on &lt;strong&gt;October 4th&lt;/strong&gt;, then you can grab its release candidate that got published early last month. The final release will only include bug fixes without adding extra features, so the preview release is fairly complete.&lt;/p&gt;
&lt;p&gt;You can access the preview release in a couple of different ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can navigate your web browser to the official &lt;a href=&quot;https://www.python.org/downloads/release/python-3100rc1/&quot;&gt;Python 3.10.0rc1 downloads page&lt;/a&gt; and fetch either the source code to compile or a Python installer for your operating system.&lt;/li&gt;
&lt;li&gt;Alternatively, you can run the release candidate alongside your other Python interpreters with the help of &lt;a href=&quot;https://realpython.com/intro-to-pyenv/&quot;&gt;pyenv&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Finally, you can try the latest Python release without installing it by running the interpreter in a &lt;a href=&quot;https://realpython.com/python-versions-docker/&quot;&gt;Docker container&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-august-2021/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-august-2021/ »&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 #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>A Python Guide to the Fibonacci Sequence</title>
      <id>https://realpython.com/fibonacci-sequence-python/</id>
      <link href="https://realpython.com/fibonacci-sequence-python/"/>
      <updated>2021-09-08T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll explore the Fibonacci sequence in Python, which serves as an invaluable springboard into the world of recursion, and learn how to optimize recursive algorithms in the process.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The &lt;strong&gt;Fibonacci sequence&lt;/strong&gt; is a pretty famous sequence of integer numbers. The sequence comes up naturally in many problems and has a nice recursive definition. Learning how to generate it is an essential step in the pragmatic programmer’s journey toward mastering &lt;a href=&quot;https://realpython.com/python-recursion/&quot;&gt;recursion&lt;/a&gt;. In this tutorial, you’ll focus on learning what the Fibonacci sequence is and how to generate it using Python.&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;Generate the Fibonacci sequence using a &lt;strong&gt;recursive algorithm&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Optimize the recursive Fibonacci algorithm using &lt;strong&gt;memoization&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Generate the Fibonacci sequence using an &lt;strong&gt;iterative algorithm&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should know the basics of &lt;a href=&quot;https://realpython.com/sorting-algorithms-python/#measuring-efficiency-with-big-o-notation&quot;&gt;Big O notation&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/operator-function-overloading/#the-internals-of-operations-like-len-and&quot;&gt;Python’s special methods&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional statements&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;basic data structures&lt;/a&gt; like &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;lists&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-deque/#building-efficient-queues-with-deque&quot;&gt;queues&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/how-to-implement-python-stack/&quot;&gt;stacks&lt;/a&gt;. Having some familiarity with these concepts will greatly help you understand the new ones you’ll be exploring in this tutorial.&lt;/p&gt;
&lt;p&gt;Let’s dive right in!&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;getting-started-with-the-fibonacci-sequence&quot;&gt;Getting Started With the Fibonacci Sequence&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-the-fibonacci-sequence&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://www.britannica.com/biography/Fibonacci&quot;&gt;Leonardo Fibonacci&lt;/a&gt; was an Italian mathematician who was able to quickly produce an answer to this question asked by Emperor Frederick II of Swabia: “How many pairs of rabbits are obtained in a year, excluding cases of death, supposing that each couple gives birth to another couple every month and that the youngest couples are able to reproduce already at the second month of life?”&lt;/p&gt;
&lt;p&gt;The answer was the following sequence:&lt;/p&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-75&quot; src=&quot;https://files.realpython.com/media/9645419cf728c44cf0bd28ab667f69aa.017fa332ab15.png&quot; width=&quot;2724&quot; height=&quot;109&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/9645419cf728c44cf0bd28ab667f69aa.017fa332ab15.png&amp;amp;w=681&amp;amp;sig=0b595e92a2fe83aa2bbdf9f6ac5b659e7db18ef0 681w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/9645419cf728c44cf0bd28ab667f69aa.017fa332ab15.png&amp;amp;w=1362&amp;amp;sig=504db41e40099ac6a7eaabad2bbca50452f98468 1362w, https://files.realpython.com/media/9645419cf728c44cf0bd28ab667f69aa.017fa332ab15.png 2724w&quot; sizes=&quot;75vw&quot; alt=&quot;Fibonacci recurrence relation starting with 0&quot; data-asset=&quot;3766&quot;&gt;&lt;/figure&gt;

&lt;p&gt;The pattern begins after the first two numbers, 0 and 1, where each number in the sequence is always the sum of the two numbers before it. Indian mathematicians had known about this sequence since the sixth century, and Fibonacci leveraged it to calculate the growth of rabbit populations.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;F&lt;/em&gt;(&lt;em&gt;n&lt;/em&gt;) is used to indicate the number of pairs of rabbits present in month &lt;em&gt;n&lt;/em&gt;, so the sequence can be expressed like this:&lt;/p&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-50&quot; src=&quot;https://files.realpython.com/media/mwong-fibonacci-recurrence-relation.09c03cec1b7d.png&quot; width=&quot;1146&quot; height=&quot;332&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/mwong-fibonacci-recurrence-relation.09c03cec1b7d.png&amp;amp;w=286&amp;amp;sig=9a97942fc22f1130cf95db62923918a5ceaa8a33 286w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/mwong-fibonacci-recurrence-relation.09c03cec1b7d.png&amp;amp;w=573&amp;amp;sig=e70b1b5b487be72c05f429dca7f7706e7ba61551 573w, https://files.realpython.com/media/mwong-fibonacci-recurrence-relation.09c03cec1b7d.png 1146w&quot; sizes=&quot;75vw&quot; alt=&quot;The Fibonacci sequence described as a recurrence relation. F(0) and F(1) are defined to be 0, and the nth Fibonacci number is the sum of F(n-1) and F(n-2)&quot; data-asset=&quot;3721&quot;&gt;&lt;/figure&gt;

&lt;p&gt;In mathematical terminology, you’d call this a &lt;a href=&quot;https://en.wikipedia.org/wiki/Recurrence_relation&quot;&gt;recurrence relation&lt;/a&gt;, meaning that each term of the sequence (beyond 0 and 1) is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Function_(mathematics)&quot;&gt;function&lt;/a&gt; of the preceding terms.&lt;/p&gt;
&lt;p&gt;There’s also a version of the sequence where the first two numbers are both 1, like so:&lt;/p&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-75&quot; src=&quot;https://files.realpython.com/media/403b57adc167e9addd094b3b2d3540bb.ba099fd0fdc9.png&quot; width=&quot;2600&quot; height=&quot;109&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/403b57adc167e9addd094b3b2d3540bb.ba099fd0fdc9.png&amp;amp;w=650&amp;amp;sig=189dae4173bee083facad91c750beb942b49db0c 650w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/403b57adc167e9addd094b3b2d3540bb.ba099fd0fdc9.png&amp;amp;w=1300&amp;amp;sig=c7f884a5e37b7491edd3962407328172a871b208 1300w, https://files.realpython.com/media/403b57adc167e9addd094b3b2d3540bb.ba099fd0fdc9.png 2600w&quot; sizes=&quot;75vw&quot; alt=&quot;Fibonacci sequence starting with 11&quot; data-asset=&quot;3767&quot;&gt;&lt;/figure&gt;

&lt;p&gt;In this alternative version, &lt;em&gt;F&lt;/em&gt;(0) is still implicitly 0, but you start from &lt;em&gt;F&lt;/em&gt;(1) and &lt;em&gt;F&lt;/em&gt;(2) instead. The algorithm remains the same because you’re always summing the previous two numbers to get the next number in the sequence.&lt;/p&gt;
&lt;p&gt;For the purposes of this tutorial, you’ll use the version of the sequence that starts with 0.&lt;/p&gt;
&lt;h2 id=&quot;examining-the-recursion-behind-the-fibonacci-sequence&quot;&gt;Examining the Recursion Behind the Fibonacci Sequence&lt;a class=&quot;headerlink&quot; href=&quot;#examining-the-recursion-behind-the-fibonacci-sequence&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Generating the Fibonacci sequence is a classic recursive problem. &lt;strong&gt;Recursion&lt;/strong&gt; is when a function refers to itself to break down the problem it’s trying to solve. In every function call, the problem becomes smaller until it reaches a &lt;strong&gt;base case&lt;/strong&gt;, after which it will then return the result to each intermediate caller until it &lt;a href=&quot;https://realpython.com/python-return-statement/&quot;&gt;returns&lt;/a&gt; the final result back to the original caller.&lt;/p&gt;
&lt;p&gt;If you wanted to calculate the &lt;em&gt;F&lt;/em&gt;(5) Fibonacci number, you’d need to calculate its predecessors, &lt;em&gt;F&lt;/em&gt;(4) and &lt;em&gt;F&lt;/em&gt;(3), first. And in order to calculate &lt;em&gt;F&lt;/em&gt;(4) and &lt;em&gt;F&lt;/em&gt;(3), you would need to calculate their predecessors. The breakdown of &lt;em&gt;F&lt;/em&gt;(5) into smaller subproblems would look like this:&lt;/p&gt;
&lt;figure class=&quot;&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/mwong-fib5.afb4734df50f.png&quot; width=&quot;2069&quot; height=&quot;687&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/mwong-fib5.afb4734df50f.png&amp;amp;w=517&amp;amp;sig=f451c9f9e5fb6bb9cbe7e91d728cb488cbedc990 517w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/mwong-fib5.afb4734df50f.png&amp;amp;w=1034&amp;amp;sig=f1b9d2cee91c433a645d16711b95f510221df551 1034w, https://files.realpython.com/media/mwong-fib5.afb4734df50f.png 2069w&quot; sizes=&quot;75vw&quot; alt=&quot;How to calculate the fifth Fibonacci number&quot; data-asset=&quot;3720&quot;&gt;&lt;/figure&gt;

&lt;p&gt;Each time the Fibonacci function is called, it gets broken down into two smaller subproblems because that’s how you defined the recurrence relation. When it reaches the base case of either &lt;em&gt;F&lt;/em&gt;(0) or &lt;em&gt;F&lt;/em&gt;(1), it can finally return a result back to its caller.&lt;/p&gt;
&lt;p&gt;In order to calculate the fifth number in the Fibonacci sequence, you solve smaller but identical problems until you reach the base cases, where you can start returning a result:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/Screen_Shot_2021-06-04_at_3.24.02_PM.49155bd58b7d.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-75&quot; src=&quot;https://files.realpython.com/media/Screen_Shot_2021-06-04_at_3.24.02_PM.49155bd58b7d.png&quot; width=&quot;1448&quot; height=&quot;646&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Screen_Shot_2021-06-04_at_3.24.02_PM.49155bd58b7d.png&amp;amp;w=362&amp;amp;sig=17e623aa0c5158f601e13ab2ca7208974b2d599d 362w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Screen_Shot_2021-06-04_at_3.24.02_PM.49155bd58b7d.png&amp;amp;w=724&amp;amp;sig=4cac29f4993e1110e1d4c2a52b21b41b18581cd6 724w, https://files.realpython.com/media/Screen_Shot_2021-06-04_at_3.24.02_PM.49155bd58b7d.png 1448w&quot; sizes=&quot;75vw&quot; alt=&quot;Recursive representation of Fibonacci Sequence&quot; data-asset=&quot;3589&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/fibonacci-sequence-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/fibonacci-sequence-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>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>How Long Does It Take to Learn Python?</title>
      <id>https://realpython.com/how-long-does-it-take-to-learn-python/</id>
      <link href="https://realpython.com/how-long-does-it-take-to-learn-python/"/>
      <updated>2021-09-06T14:00:00+00:00</updated>
      <summary>In this article, you&#x27;ll assess whether or not learning Python is a good investment of your time, how long it will take you, and what background factors you need to consider when planning your learning journey. You&#x27;ll also learn what resources exist that can help you get started.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;You’ve probably found at least one blog post where the author reveals that they learned Python in a handful of days and quickly transitioned into a high-paying job. Some of these stories may be true, but they don’t help you prepare for a steady learning marathon. So, how long does it &lt;em&gt;really&lt;/em&gt; take to learn Python, and is it worth your time investment?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this article, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What “learning Python” means and how you can &lt;strong&gt;measure your progress&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What different &lt;strong&gt;reasons&lt;/strong&gt; there are for learning Python&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;background factors&lt;/strong&gt; affect your learning approach and outcome&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;How much time&lt;/strong&gt; you’ll want to invest in learning Python at &lt;strong&gt;different skill levels&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Which &lt;strong&gt;resources&lt;/strong&gt; you can use to improve your learning process&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get started, you’ll go over some different reasons people want to learn to program in Python. Keep your personal motivations in mind and identify where you place yourself. Your reasons for learning Python will impact both your approach and the amount of time you’ll need to set aside.&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;why-would-you-learn-python&quot;&gt;Why Would You Learn Python?&lt;a class=&quot;headerlink&quot; href=&quot;#why-would-you-learn-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You might be completely new to programming and on the fence about whether or not you should invest your time into learning Python. In this first section, you’ll think about the different reasons people want to learn this programming language. Take note of the one you identify with the most:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Career and job opportunities:&lt;/strong&gt; Maybe you want to start a new career as a software developer. Maybe you want to keep working at your current company and transition into a more technical role, such as data analysis. Programming proficiency is an excellent addition to any skill set you already have. Once you have the Python skills you need, you can ace your &lt;a href=&quot;https://realpython.com/learning-paths/python-interview/&quot;&gt;Python coding interview&lt;/a&gt; to get your dream job.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Automation:&lt;/strong&gt; Python can help you automate repetitive tasks that you regularly do in your job and private life. You could learn to automate your work with &lt;a href=&quot;https://realpython.com/openpyxl-excel-spreadsheets-python/&quot;&gt;Excel spreadsheets&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/beautiful-soup-web-scraper-python/&quot;&gt;build a web scraper&lt;/a&gt; to access public data from the Internet, create &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/&quot;&gt;command-line interfaces&lt;/a&gt;, or build bots for &lt;a href=&quot;https://realpython.com/twitter-bot-python-tweepy/&quot;&gt;Twitter&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/how-to-make-a-discord-bot-python/&quot;&gt;Discord&lt;/a&gt; that take work off your plate.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Curiosity:&lt;/strong&gt; Digital products are everywhere, and you probably use them daily. You might want to know how your digital thermometer works, how a popular website is built, or how your favorite computer game would look if you digitally took it apart.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Creativity:&lt;/strong&gt; You might have some fantastic ideas for your own games, and you could build them &lt;a href=&quot;https://realpython.com/platformer-python-arcade/&quot;&gt;with Arcade&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/asteroids-game-python/&quot;&gt;with Pygame&lt;/a&gt;. Or you may want to get started with &lt;a href=&quot;https://realpython.com/micropython/&quot;&gt;programming hardware&lt;/a&gt; for home automation, Internet of Things (IoT), or &lt;a href=&quot;https://realpython.com/embedded-python/&quot;&gt;embedded game development&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All of these are great reasons to get into programming! Your personal motivation for starting on this journey will affect how fast and how deeply you’ll learn Python. It’ll also influence which aspects of the language will require your focus. If you’re looking for inspiration on topics to tackle, then you can read about &lt;a href=&quot;https://realpython.com/what-can-i-do-with-python/&quot;&gt;what you can do with Python&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;what-does-learning-python-mean&quot;&gt;What Does “Learning Python” Mean?&lt;a class=&quot;headerlink&quot; href=&quot;#what-does-learning-python-mean&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Learning Python means more than just learning the Python programming language. You’ll need to know more than just the specifics of a single programming language to do something useful with your programming skills. At the same time, you don’t need to understand every single aspect of Python to be productive.&lt;/p&gt;
&lt;p&gt;Learning Python is about learning how to accomplish practical tasks with Python programming. It’s about a skill set that you can use to build projects for yourself or an employer.&lt;/p&gt;
&lt;h2 id=&quot;how-can-you-measure-your-learning-progress&quot;&gt;How Can You Measure Your Learning Progress?&lt;a class=&quot;headerlink&quot; href=&quot;#how-can-you-measure-your-learning-progress&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It’s often hard to say at what point you’ve fully learned something. Do you know Python when you know its syntax? Have you learned it when you know how to use a popular library without looking it up online? Or do you need to know all the ins and outs of the Python ecosystem to be able to say that you’ve learned Python?&lt;/p&gt;
&lt;p&gt;Realistically, you’ll probably never learn all there is to know about the Python ecosystem. There’s too much to know! Therefore, it’s helpful to separate your journey into different segments. This approach makes it easier for you to keep moving in the right direction.&lt;/p&gt;
&lt;p&gt;When you think about different skill levels, you might think of three traditional categories:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Beginner&lt;/li&gt;
&lt;li&gt;Intermediate&lt;/li&gt;
&lt;li&gt;Expert&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;However, it’s hard to define when someone stops being a beginner, and even experienced programmers often don’t consider themselves experts. On the other hand, some programmers with low ability may think of themselves as experts, a cognitive bias known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect&quot;&gt;Dunning-Kruger effect&lt;/a&gt;. With that in mind, mapping out your progress following this type of traditional classification might not be that useful for you.&lt;/p&gt;
&lt;h3 id=&quot;the-four-stages-of-competence&quot;&gt;The Four Stages of Competence&lt;a class=&quot;headerlink&quot; href=&quot;#the-four-stages-of-competence&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Instead, you’ll use a different framework that  follows the &lt;a href=&quot;https://en.wikipedia.org/wiki/Four_stages_of_competence&quot;&gt;four stages of competence&lt;/a&gt; for assessing your learning progress:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/four-stages.d678c620edb0.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/four-stages.d678c620edb0.png&quot; width=&quot;3356&quot; height=&quot;619&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/four-stages.d678c620edb0.png&amp;amp;w=839&amp;amp;sig=a4ced5af7d8b46818ad2430bc0b6820918551b52 839w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/four-stages.d678c620edb0.png&amp;amp;w=1678&amp;amp;sig=0dfa356d24bba0243aba26d810cf68f637f28c1a 1678w, https://files.realpython.com/media/four-stages.d678c620edb0.png 3356w&quot; sizes=&quot;75vw&quot; alt=&quot;The four stages of competence&quot; data-asset=&quot;3761&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;To make the four stages of competence more accessible, you’ll see the following short names to refer to each of the four stages:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Unawareness&lt;/strong&gt; for &lt;strong&gt;unconscious incompetence&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Awareness&lt;/strong&gt; for &lt;strong&gt;conscious incompetence&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ability&lt;/strong&gt; for &lt;strong&gt;conscious competence&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Expertise&lt;/strong&gt; for &lt;strong&gt;unconscious competence&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/how-long-does-it-take-to-learn-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/how-long-does-it-take-to-learn-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 #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>
  
    <entry>
      <title>Using the Python return Statement Effectively</title>
      <id>https://realpython.com/courses/effective-python-return-statement/</id>
      <link href="https://realpython.com/courses/effective-python-return-statement/"/>
      <updated>2021-08-10T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn how to use the Python return statement when writing functions. Additionally, you&#x27;ll cover some good programming practices related to the use of return. With this knowledge, you&#x27;ll be able to write readable, robust, and maintainable functions in Python.</summary>
      <content type="html">
        &lt;p&gt;The Python &lt;a href=&quot;https://en.wikipedia.org/wiki/Return_statement&quot;&gt;&lt;code&gt;return&lt;/code&gt; statement&lt;/a&gt; is a key component of &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/#instance-methods&quot;&gt;methods&lt;/a&gt;. You can use the &lt;code&gt;return&lt;/code&gt; statement to make your functions send Python objects back to the caller code. These objects are known as the function&amp;rsquo;s &lt;strong&gt;return value&lt;/strong&gt;. You can use them to perform further computation in your programs.&lt;/p&gt;
&lt;p&gt;Using the &lt;code&gt;return&lt;/code&gt; statement effectively is a core skill if you want to code custom functions that are &lt;a href=&quot;https://realpython.com/learning-paths/writing-pythonic-code/&quot;&gt;Pythonic&lt;/a&gt; and robust.&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;How to use the &lt;strong&gt;Python &lt;code&gt;return&lt;/code&gt; statement&lt;/strong&gt; in your functions&lt;/li&gt;
&lt;li&gt;How to return &lt;strong&gt;single&lt;/strong&gt; or &lt;strong&gt;multiple values&lt;/strong&gt; from your functions&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;best practices&lt;/strong&gt; to observe when using &lt;code&gt;return&lt;/code&gt; statements&lt;/li&gt;
&lt;li&gt;How to structure more &lt;strong&gt;advanced&lt;/strong&gt; return statements&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 #72: Starting With FastAPI and Examining Python&#x27;s Import System</title>
      <id>https://realpython.com/podcasts/rpp/72/</id>
      <link href="https://realpython.com/podcasts/rpp/72/"/>
      <updated>2021-08-06T12:00:00+00:00</updated>
      <summary>Have you heard of FastAPI?  An application programming interface is vital to make your software accessible to users across the internet. FastAPI is an excellent option for quickly creating a web API that implements best practices. 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 heard of FastAPI?  An application programming interface is vital to make your software accessible to users across the internet. FastAPI is an excellent option for quickly creating a web API that implements best practices. 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>Using sleep() to Code a Python Uptime Bot</title>
      <id>https://realpython.com/courses/python-sleep-uptime-bot/</id>
      <link href="https://realpython.com/courses/python-sleep-uptime-bot/"/>
      <updated>2021-08-03T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to add time delays to your Python programs. You&#x27;ll use the built-in time module to add Python sleep() calls to your code. To practice, you&#x27;ll use time.sleep() when making an uptime bot that checks whether a website is still live.</summary>
      <content type="html">
        &lt;p&gt;Have you ever needed to make your Python program wait for something? You might use a Python &lt;code&gt;sleep()&lt;/code&gt; call to simulate a delay in your program. Perhaps you need to wait for a file to upload or download, or for a graphic to load or be drawn to the screen. You might even need to pause between calls to a web &lt;a href=&quot;https://realpython.com/python-api/&quot;&gt;API&lt;/a&gt;, or between queries to a database. Adding Python &lt;strong&gt;&lt;code&gt;sleep()&lt;/code&gt;&lt;/strong&gt; calls to your program can help in each of these cases, and many more!&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;The basics of &lt;strong&gt;&lt;code&gt;time.sleep()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How you can use &lt;code&gt;timeit&lt;/code&gt; to &lt;strong&gt;measure&lt;/strong&gt; your code&amp;rsquo;s &lt;strong&gt;execution time&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to use &lt;code&gt;time.sleep()&lt;/code&gt; to build an &lt;strong&gt;uptime bot&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 #71: Start Using a Debugger With Your Python Code</title>
      <id>https://realpython.com/podcasts/rpp/71/</id>
      <link href="https://realpython.com/podcasts/rpp/71/"/>
      <updated>2021-07-30T12:00:00+00:00</updated>
      <summary>Are you still sprinkling print statements throughout your code while writing it? Print statements are often clunky and offer only a limited view of the state of your code. Have you thought there must be a better way? This week on the show, we have Nina Zakharenko to discuss her conference talk titled &quot;Goodbye Print, Hello Debugger.&quot;</summary>
      <content type="html">
        &lt;p&gt;Are you still sprinkling print statements throughout your code while writing it? Print statements are often clunky and offer only a limited view of the state of your code. Have you thought there must be a better way? This week on the show, we have Nina Zakharenko to discuss her conference talk titled &quot;Goodbye Print, Hello Debugger.&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>
  

</feed>
