<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title>Real Python</title>
  <link href="https://realpython.com/atom.xml" rel="self"/>
  <link href="https://realpython.com/"/>
  <updated>2022-02-18T12:00:00+00:00</updated>
  <id>https://realpython.com/</id>
  <author>
    <name>Real Python</name>
  </author>

  
    <entry>
      <title>The Real Python Podcast – Episode #98: Drawing Fractals With Python and Working With a Weather API</title>
      <id>https://realpython.com/podcasts/rpp/98/</id>
      <link href="https://realpython.com/podcasts/rpp/98/"/>
      <updated>2022-02-18T12:00:00+00:00</updated>
      <summary>Have you been wanting to explore fractals and complex numbers in Python? Would you like to practice working with APIs in Python through a new project? This week on the show, Christopher Trudeau is here, and he&#x27;s taking on the task of curating new issues of PyCoder&#x27;s Weekly going forward. He&#x27;ll be joining me as a cohost every other week and bringing a fresh batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you been wanting to explore fractals and complex numbers in Python? Would you like to practice working with APIs in Python through a new project? This week on the show, Christopher Trudeau is here, and he&#x27;s taking on the task of curating new issues of PyCoder&#x27;s Weekly going forward. He&#x27;ll be joining me as a cohost every other week and bringing a fresh 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>Providing Multiple Constructors in Your Python Classes</title>
      <id>https://realpython.com/python-multiple-constructors/</id>
      <link href="https://realpython.com/python-multiple-constructors/"/>
      <updated>2022-02-16T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how to provide multiple constructors in your Python classes. To this end, you&#x27;ll learn different techniques, such as checking argument types, using default argument values, writing class methods, and implementing single-dispatch methods.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Sometimes you need to write a Python class that provides multiple ways to construct objects. In other words, you want a class that implements &lt;strong&gt;multiple constructors&lt;/strong&gt;. This kind of class comes in handy when you need to create instances using different types or numbers of arguments. Having the tools to provide multiple constructors will help you write flexible classes that can adapt to changing needs.&lt;/p&gt;
&lt;p&gt;In Python, there are several techniques and tools that you can use to construct classes, including simulating multiple constructors through optional arguments, customizing instance creation via class methods, and doing special dispatch with decorators. If you want to learn about these techniques and tools, then this tutorial is for you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;optional arguments&lt;/strong&gt; and &lt;strong&gt;type checking&lt;/strong&gt; to simulate multiple constructors&lt;/li&gt;
&lt;li&gt;Write multiple constructors using the built-in &lt;strong&gt;&lt;code&gt;@classmethod&lt;/code&gt;&lt;/strong&gt; decorator&lt;/li&gt;
&lt;li&gt;Overload your class constructors using the &lt;strong&gt;&lt;code&gt;@singledispatchmethod&lt;/code&gt;&lt;/strong&gt; decorator&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll also get a peek under the hood at how Python internally &lt;strong&gt;constructs instances&lt;/strong&gt; of a regular class and how some &lt;strong&gt;standard-library classes&lt;/strong&gt; provide multiple constructors.&lt;/p&gt;
&lt;p&gt;To get the most out of this tutorial, you should have basic knowledge of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; and understand how to define &lt;a href=&quot;https://realpython.com/instance-class-and-static-methods-demystified/&quot;&gt;class methods&lt;/a&gt; with &lt;code&gt;@classmethod&lt;/code&gt;. You should also have experience working with &lt;a href=&quot;https://realpython.com/primer-on-python-decorators/&quot;&gt;decorators&lt;/a&gt; in Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-oop/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-oop&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get access to a free Python OOP Cheat Sheet&lt;/a&gt; that points you to the best tutorials, videos, and books to learn more about Object-Oriented Programming with Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;instantiating-classes-in-python&quot;&gt;Instantiating Classes in Python&lt;a class=&quot;headerlink&quot; href=&quot;#instantiating-classes-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python supports &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; with &lt;strong&gt;classes&lt;/strong&gt; that are straightforward to create and use. Python classes offer powerful features that can help you write better software. Classes are like blueprints for &lt;strong&gt;objects&lt;/strong&gt;, also known as &lt;strong&gt;instances&lt;/strong&gt;. In the same way that you can build several houses from a single blueprint, you can build several instances from a class.&lt;/p&gt;
&lt;p&gt;To define a class in Python, you need to use the &lt;a href=&quot;https://realpython.com/python-keywords/#structure-keywords-def-class-with-as-pass-lambda&quot;&gt;&lt;code&gt;class&lt;/code&gt;&lt;/a&gt; keyword followed by the class name:&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;c1&quot;&gt;# Define a Person class&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;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&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;def&lt;/span&gt; &lt;span class=&quot;fm&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&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;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Python has a rich set of &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-special-method&quot;&gt;special methods&lt;/a&gt; that you can use in your classes. Python implicitly calls special methods to automatically execute a wide variety of operations on instances. There are special methods to make your objects iterable, provide a suitable string representation for your objects, initialize instance attributes, and a lot more.&lt;/p&gt;
&lt;p&gt;A pretty common special method is &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__init__&quot;&gt;&lt;code&gt;.__init__()&lt;/code&gt;&lt;/a&gt;. This method provides what’s known as the &lt;strong&gt;instance initializer&lt;/strong&gt; in Python. This method’s job is to initialize &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/#class-and-instance-attributes&quot;&gt;instance attributes&lt;/a&gt; with appropriate values when you instantiate a given class.&lt;/p&gt;
&lt;p&gt;In &lt;code&gt;Person&lt;/code&gt;, the &lt;code&gt;.__init__()&lt;/code&gt; method’s first argument is called &lt;code&gt;self&lt;/code&gt;. This argument holds the current object or instance, which is passed implicitly in the method call. This argument is common to every &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/#instance-methods&quot;&gt;instance method&lt;/a&gt; in Python. The second argument to &lt;code&gt;.__init__()&lt;/code&gt; is called &lt;code&gt;name&lt;/code&gt; and will hold the person’s name as a &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Using &lt;a href=&quot;https://www.python.org/dev/peps/pep-0008/#function-and-method-arguments&quot;&gt;&lt;code&gt;self&lt;/code&gt;&lt;/a&gt; to name the current object is a pretty strong convention in Python but not a requirement. However, using another name will raise some eyebrows among your fellow Python developers.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Once you’ve defined a class, you can start &lt;strong&gt;instantiating&lt;/strong&gt; it. In other words, you can start creating objects of that class. To do this, you’ll use a familiar syntax. Just call the class using a pair of parentheses (&lt;code&gt;()&lt;/code&gt;), which is the same syntax that you use to call any Python &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;function&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;c1&quot;&gt;# Instantiating Person&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;john&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;John Doe&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;john&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;John Doe&#x27;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In Python, the class name provides what other languages, such as &lt;a href=&quot;https://realpython.com/python-vs-cpp/&quot;&gt;C++&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/java-vs-python/&quot;&gt;Java&lt;/a&gt;, call the &lt;strong&gt;class constructor&lt;/strong&gt;. Calling a class, like you did with &lt;code&gt;Person&lt;/code&gt;, triggers Python’s class &lt;strong&gt;instantiation process&lt;/strong&gt;, which internally runs in two steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Create&lt;/strong&gt; a new instance of the target class.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Initialize&lt;/strong&gt; the instance with suitable instance attribute values.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To continue with the above example, the value that you pass as an argument to &lt;code&gt;Person&lt;/code&gt; is internally passed to &lt;code&gt;.__init__()&lt;/code&gt; and then assigned to the instance attribute &lt;code&gt;.name&lt;/code&gt;. This way, you initialize your person instance, &lt;code&gt;john&lt;/code&gt;, with valid data, which you can confirm by accessing &lt;code&gt;.name&lt;/code&gt;. Success! &lt;code&gt;John Doe&lt;/code&gt; is indeed his name.&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; When you call the class to create a new instance, you need to provide as many arguments as &lt;code&gt;.__init__()&lt;/code&gt; requires so that this method can initialize all the instance attributes that demand an initial value.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now that you understand the object initialization mechanism, you’re ready to learn what Python does before it gets to this point in the instantiation process. It’s time to dig into another special method, called &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__new__&quot;&gt;&lt;code&gt;.__new__()&lt;/code&gt;&lt;/a&gt;. This method takes care of creating new instances in Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The &lt;code&gt;.__new__()&lt;/code&gt; special method is often called a &lt;strong&gt;class constructor&lt;/strong&gt; in Python. However, its job is actually to create new objects from the class blueprint, so you can more accurately call it an &lt;strong&gt;instance creator&lt;/strong&gt; or &lt;strong&gt;object creator&lt;/strong&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;.__new__()&lt;/code&gt; special method takes the underlying class as its first argument and returns a new object. This object is typically an instance of the input class, but in some cases, it can be an instance of a different class.&lt;/p&gt;
&lt;p&gt;If the object that &lt;code&gt;.__new__()&lt;/code&gt; returns is an instance of the current class, then this instance is immediately passed to &lt;code&gt;.__init__()&lt;/code&gt; for initialization purposes. These two steps run when you call the class.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-multiple-constructors/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-multiple-constructors/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python any(): Powered Up Boolean Function</title>
      <id>https://realpython.com/courses/python-any-boolean-function/</id>
      <link href="https://realpython.com/courses/python-any-boolean-function/"/>
      <updated>2022-02-15T14:00:00+00:00</updated>
      <summary>If you&#x27;ve ever wondered how to simplify complex conditionals by determining if at least one in a series of conditions is true, then look no further. This video course will teach you all about how to use any() in Python to do just that.</summary>
      <content type="html">
        &lt;p&gt;As a Python programmer, you&amp;rsquo;ll frequently deal with &lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Booleans&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional statements&lt;/a&gt;&amp;mdash;sometimes very complex ones. In those situations, you may need to rely on tools that can simplify logic and consolidate information. Fortunately,  &lt;strong&gt;&lt;code&gt;any()&lt;/code&gt;&lt;/strong&gt; in Python is such a tool. It looks through the elements in an iterable and returns a single value indicating whether any element is true in a Boolean context, or &lt;strong&gt;truthy.&lt;/strong&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;Use &lt;strong&gt;&lt;code&gt;any()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;not any()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Elimate long &lt;strong&gt;&lt;code&gt;or&lt;/code&gt; chains&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;any()&lt;/code&gt; with &lt;strong&gt;list comprehensions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Evalute values&lt;/strong&gt; that aren&amp;rsquo;t explicitly &lt;code&gt;True&lt;/code&gt; or &lt;code&gt;False&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Distinguish between &lt;strong&gt;&lt;code&gt;any()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;or&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;short-circuiting&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&#x27;s zipfile: Manipulate Your ZIP Files Efficiently</title>
      <id>https://realpython.com/python-zipfile/</id>
      <link href="https://realpython.com/python-zipfile/"/>
      <updated>2022-02-14T14:00:00+00:00</updated>
      <summary>In this guided tutorial, you&#x27;ll learn how to manipulate ZIP files using Python&#x27;s zipfile module from the standard library. Through hands-on examples, you&#x27;ll learn how to read, write, compress, and extract files from your ZIP files quickly.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;a href=&quot;https://docs.python.org/3/library/zipfile.html&quot;&gt;&lt;code&gt;zipfile&lt;/code&gt;&lt;/a&gt; is a standard library module intended to manipulate &lt;strong&gt;ZIP files&lt;/strong&gt;. This file format is a widely adopted industry standard when it comes to archiving and compressing digital data. You can use it to package together several related files. It also allows you to reduce the size of your files and save disk space. Most importantly, it facilitates data exchange over computer networks.&lt;/p&gt;
&lt;p&gt;Knowing how to create, read, write, populate, extract, and list ZIP files using the &lt;code&gt;zipfile&lt;/code&gt; module is a useful skill to have as a Python developer or a DevOps engineer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Read, write, and extract&lt;/strong&gt; files from ZIP files with Python’s &lt;code&gt;zipfile&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Read &lt;strong&gt;metadata&lt;/strong&gt; about the content of ZIP files using &lt;code&gt;zipfile&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;zipfile&lt;/code&gt; to &lt;strong&gt;manipulate member files&lt;/strong&gt; in existing ZIP files&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;new ZIP files&lt;/strong&gt; to archive and compress files&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you commonly deal with ZIP files, then this knowledge can help to streamline your workflow to process your files confidently.&lt;/p&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/working-with-files-in-python/&quot;&gt;working with files&lt;/a&gt;, using the &lt;a href=&quot;https://realpython.com/python-with-statement/&quot;&gt;&lt;code&gt;with&lt;/code&gt; statement&lt;/a&gt;, handling file system paths with &lt;a href=&quot;https://realpython.com/python-pathlib/&quot;&gt;&lt;code&gt;pathlib&lt;/code&gt;&lt;/a&gt;, and working with classes and &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To get the files and archives that you’ll use to code the examples in this tutorial, 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 Materials:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-zipfile-materials/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-zipfile-materials&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get a copy of the files and archives&lt;/a&gt; that you’ll use to run the examples in this zipfile tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;getting-started-with-zip-files&quot;&gt;Getting Started With ZIP Files&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-zip-files&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;ZIP files&lt;/strong&gt; are a well-known and popular tool in today’s digital world. These files are fairly popular and widely used for cross-platform data exchange over computer networks, notably the Internet.&lt;/p&gt;
&lt;p&gt;You can use ZIP files for bundling regular files together into a single archive, compressing your data to save some disk space, distributing your digital products, and more. In this tutorial, you’ll learn how to manipulate ZIP files using Python’s &lt;code&gt;zipfile&lt;/code&gt; module.&lt;/p&gt;
&lt;p&gt;Because the terminology around ZIP files can be confusing at times, this tutorial will stick to the following conventions regarding terminology:&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;Term&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ZIP file, ZIP archive, or archive&lt;/td&gt;
&lt;td&gt;A physical file that uses the &lt;a href=&quot;https://en.wikipedia.org/wiki/ZIP_(file_format)&quot;&gt;ZIP file format&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;File&lt;/td&gt;
&lt;td&gt;A regular &lt;a href=&quot;https://en.wikipedia.org/wiki/Computer_file&quot;&gt;computer file&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Member file&lt;/td&gt;
&lt;td&gt;A file that is part of an existing ZIP file&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Having these terms clear in your mind will help you avoid confusion while you read through the upcoming sections. Now you’re ready to continue learning how to manipulate ZIP files efficiently in your Python code!&lt;/p&gt;
&lt;h3 id=&quot;what-is-a-zip-file&quot;&gt;What Is a ZIP File?&lt;a class=&quot;headerlink&quot; href=&quot;#what-is-a-zip-file&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You’ve probably already encountered and worked with ZIP files. Yes, those with the &lt;code&gt;.zip&lt;/code&gt; file extension are everywhere! ZIP files, also known as &lt;strong&gt;ZIP archives&lt;/strong&gt;, are files that use the &lt;strong&gt;ZIP file format&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/PKWARE,_Inc.&quot;&gt;PKWARE&lt;/a&gt; is the company that created and first implemented this file format. The company put together and maintains the current &lt;a href=&quot;https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT&quot;&gt;format specification&lt;/a&gt;, which is publicly available and allows the creation of products, programs, and processes that read and write files using the ZIP file format.&lt;/p&gt;
&lt;p&gt;The ZIP file format is a cross-platform, interoperable file storage and transfer format. It combines &lt;a href=&quot;https://en.wikipedia.org/wiki/Lossless_compression&quot;&gt;lossless data compression&lt;/a&gt;, file management, and data &lt;a href=&quot;https://en.wikipedia.org/wiki/Encryption&quot;&gt;encryption&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Data compression isn’t a requirement for an archive to be considered a ZIP file. So you can have compressed or uncompressed member files in your ZIP archives. The ZIP file format supports several compression algorithms, though &lt;a href=&quot;https://en.wikipedia.org/wiki/Deflate&quot;&gt;Deflate&lt;/a&gt; is the most common. The format also supports information integrity checks with &lt;a href=&quot;https://en.wikipedia.org/wiki/Cyclic_redundancy_check&quot;&gt;CRC32&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Even though there are other similar archiving formats, such as &lt;a href=&quot;https://en.wikipedia.org/wiki/RAR_(file_format)&quot;&gt;RAR&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Tar_(computing)#File_format&quot;&gt;TAR&lt;/a&gt; files, the ZIP file format has quickly become a common standard for efficient data storage and for data exchange over computer networks.&lt;/p&gt;
&lt;p&gt;ZIP files are everywhere. For example, office suites such as &lt;a href=&quot;https://en.wikipedia.org/wiki/Microsoft_Office&quot;&gt;Microsoft Office&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/LibreOffice&quot;&gt;Libre Office&lt;/a&gt; rely on the ZIP file format as their &lt;a href=&quot;https://www.iso.org/standard/60101.html&quot;&gt;document container file&lt;/a&gt;. This means that &lt;code&gt;.docx&lt;/code&gt;, &lt;code&gt;.xlsx&lt;/code&gt;, &lt;code&gt;.pptx&lt;/code&gt;, &lt;code&gt;.odt&lt;/code&gt;, &lt;code&gt;.ods&lt;/code&gt;, &lt;code&gt;.odp&lt;/code&gt; files are actually ZIP archives containing several files and folders that make up each document. Other common files that use the ZIP format include &lt;a href=&quot;https://en.wikipedia.org/wiki/JAR_(file_format)&quot;&gt;&lt;code&gt;.jar&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/WAR_(file_format)&quot;&gt;&lt;code&gt;.war&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://en.wikipedia.org/wiki/EPUB&quot;&gt;&lt;code&gt;.epub&lt;/code&gt;&lt;/a&gt; files.&lt;/p&gt;
&lt;p&gt;You may be familiar with &lt;a href=&quot;https://realpython.com/python-git-github-intro/&quot;&gt;GitHub&lt;/a&gt;, which provides web hosting for software development and &lt;a href=&quot;https://en.wikipedia.org/wiki/Version_control&quot;&gt;version control&lt;/a&gt; using &lt;a href=&quot;https://realpython.com/advanced-git-for-pythonistas/&quot;&gt;Git&lt;/a&gt;. GitHub uses ZIP files to package software projects when you download them to your local computer. For example, you can download the &lt;a href=&quot;https://github.com/realpython/python-basics-exercises/archive/refs/heads/master.zip&quot;&gt;exercise solutions&lt;/a&gt; for &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt; book in a ZIP file, or you can download any other project of your choice.&lt;/p&gt;
&lt;p&gt;ZIP files allow you to aggregate, compress, and encrypt files into a single interoperable and portable container. You can stream ZIP files, split them into segments, make them self-extracting, and more.&lt;/p&gt;
&lt;h3 id=&quot;why-use-zip-files&quot;&gt;Why Use ZIP Files?&lt;a class=&quot;headerlink&quot; href=&quot;#why-use-zip-files&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Knowing how to create, read, write, and extract ZIP files can be a useful skill for developers and professionals who work with computers and digital information. Among other benefits, ZIP files allow you to:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-zipfile/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-zipfile/ »&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 #97: Improving Your Django and Python Developer Experience</title>
      <id>https://realpython.com/podcasts/rpp/97/</id>
      <link href="https://realpython.com/podcasts/rpp/97/"/>
      <updated>2022-02-11T12:00:00+00:00</updated>
      <summary>How often have you thought about your Developer Experience (DX)? How do you improve your workflow, find documentation, and simplify code formatting? This week on the show, Adam Johnson is here to talk about his new book, &quot;Boost Your Django DX.&quot;</summary>
      <content type="html">
        &lt;p&gt;How often have you thought about your Developer Experience (DX)? How do you improve your workflow, find documentation, and simplify code formatting? This week on the show, Adam Johnson is here to talk about his new book, &quot;Boost Your Django DX.&quot;&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s all(): Check Your Iterables for Truthiness</title>
      <id>https://realpython.com/python-all/</id>
      <link href="https://realpython.com/python-all/"/>
      <updated>2022-02-09T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how to use Python&#x27;s all() function to check if all the items in an iterable are truthy. You&#x27;ll also code various examples that showcase a few interesting use cases of all() and highlight how you can use this function in Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;When programming, you’ll often need to check if all the items in an iterable are truthy. Coding this functionality repeatedly can be annoying and inefficient. Luckily, Python provides the built-in &lt;code&gt;all()&lt;/code&gt; function to solve this problem. This function takes an iterable and checks all its items for truth value, which is handy for finding out if those items have a given property or meet a particular condition.&lt;/p&gt;
&lt;p&gt;Python’s &lt;code&gt;all()&lt;/code&gt; is a powerful tool that can help you write clean, readable, and efficient code in 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;Check if all the items in an iterable are truthy by using &lt;strong&gt;&lt;code&gt;all()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;all()&lt;/code&gt; with different &lt;strong&gt;iterable types&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Combine &lt;code&gt;all()&lt;/code&gt; with &lt;strong&gt;comprehensions&lt;/strong&gt; and &lt;strong&gt;generator expressions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Distinguish between &lt;code&gt;all()&lt;/code&gt; and the Boolean &lt;strong&gt;&lt;code&gt;and&lt;/code&gt; operator&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To complement this knowledge, you’ll code several examples that showcase exciting use cases of &lt;code&gt;all()&lt;/code&gt; and highlight the many ways to use this function in Python programming.&lt;/p&gt;
&lt;p&gt;To understand the topics in this tutorial, you should have basic knowledge of several Python concepts, such as iterable &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;data structures&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Boolean types&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-operators-expressions/&quot;&gt;expressions&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-boolean/#boolean-operators&quot;&gt;operators&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/list-comprehension-python/&quot;&gt;list comprehensions&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/introduction-to-python-generators/#building-generators-with-generator-expressions&quot;&gt;generator expressions&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free PDF Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-cheat-sheet-short/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-short&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Python 3 Cheat Sheet&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;evaluating-the-truth-value-of-items-in-iterables&quot;&gt;Evaluating the Truth Value of Items in Iterables&lt;a class=&quot;headerlink&quot; href=&quot;#evaluating-the-truth-value-of-items-in-iterables&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A pretty common problem in programming is determining if all the items in a list or array are truthy or not.  For example, you may have the following list of conditions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;5 &amp;gt; 2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;1 == 1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;42 &amp;lt; 50&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To figure out if these conditions are true, you need to iterate over them and test every condition for truthiness. In this example, you have that &lt;code&gt;5 &amp;gt; 2&lt;/code&gt; is true, &lt;code&gt;1 == 1&lt;/code&gt; is true, and &lt;code&gt;42 &amp;lt; 50&lt;/code&gt; is also true. As a result, you can say that &lt;em&gt;all&lt;/em&gt; these conditions are true. If at least one of the conditions were false, then you would say that &lt;em&gt;not all&lt;/em&gt; the conditions are true.&lt;/p&gt;
&lt;p&gt;Note that as soon as you find a falsy condition, you can stop evaluating conditions because, in that case, you already know the final result: &lt;em&gt;not all&lt;/em&gt; are true.&lt;/p&gt;
&lt;p&gt;To solve this problem by writing custom Python code, you can use a  &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/a&gt; to iterate over each condition and evaluate it for truthiness. Your loop will iterate until it finds a falsy item, at which point it’ll stop because you already have a 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;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;all_true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iterable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iterable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;not&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;item&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;kc&quot;&gt;False&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;kc&quot;&gt;True&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;function&lt;/a&gt; takes an &lt;strong&gt;iterable&lt;/strong&gt; as an argument. The loop iterates over the input argument while the &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional &lt;code&gt;if&lt;/code&gt; statement&lt;/a&gt; checks if any item is falsy using the &lt;a href=&quot;https://realpython.com/python-not-operator/&quot;&gt;&lt;code&gt;not&lt;/code&gt;&lt;/a&gt; operator. If an item is falsy, then the function immediately &lt;a href=&quot;https://realpython.com/python-return-statement/&quot;&gt;returns&lt;/a&gt; &lt;code&gt;False&lt;/code&gt;, signaling that not all the items are true. Otherwise, it returns &lt;code&gt;True&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This function is quite generic. It takes an iterable, which means you can pass in a &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;list, tuple&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt;, or any other iterable &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;data structure&lt;/a&gt;. To check if the current item is true or false, &lt;code&gt;all_true()&lt;/code&gt; uses the &lt;code&gt;not&lt;/code&gt; operator to invert the &lt;strong&gt;truth value&lt;/strong&gt; of its operand. In other words, it returns &lt;code&gt;True&lt;/code&gt; if its operand evaluates to false and vice versa.&lt;/p&gt;
&lt;p&gt;Python’s &lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Boolean&lt;/a&gt; operators can evaluate the truth value of expressions and objects, which guarantees that your function can take iterables containing objects, expressions, or both. For example, if you pass in an iterable of Boolean expressions, then &lt;code&gt;not&lt;/code&gt; just evaluates the expression and negates the result.&lt;/p&gt;
&lt;p&gt;Here’s &lt;code&gt;all_true()&lt;/code&gt; in action:&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;bool_exps&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;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;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;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;mi&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;50&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;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;all_true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bool_exps&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Because all the expressions in the input iterable are true, &lt;code&gt;not&lt;/code&gt; negates the result, and the &lt;code&gt;if&lt;/code&gt; code block never runs. In that case, &lt;code&gt;all_true()&lt;/code&gt; returns &lt;code&gt;True&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Something similar happens when the input iterable holds Python objects and non-Boolean expressions:&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;objects&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;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;all_true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;objects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;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;n&quot;&gt;general_expressions&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;**&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;o&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;gp&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;s2&quot;&gt;&quot;42&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;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;all_true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;general_expressions&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;empty&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;all_true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;empty&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;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the first example, the input list contains regular Python objects, including a string, a &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;number&lt;/a&gt;, and a dictionary. In this case, &lt;code&gt;all_true()&lt;/code&gt; returns &lt;code&gt;False&lt;/code&gt; because the dictionary is empty and evaluates to false in Python.&lt;/p&gt;
&lt;p&gt;To perform &lt;a href=&quot;https://docs.python.org/3/library/stdtypes.html#truth-value-testing&quot;&gt;truth value testing&lt;/a&gt; on objects, Python has an internal set of rules for objects that evaluate as false:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Inherently negative constants, like &lt;a href=&quot;https://realpython.com/null-in-python/&quot;&gt;&lt;code&gt;None&lt;/code&gt;&lt;/a&gt; and &lt;code&gt;False&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Numeric types with a zero value, like  &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;0.0&lt;/code&gt;, &lt;a href=&quot;https://realpython.com/python-complex-numbers/&quot;&gt;&lt;code&gt;0j&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://docs.python.org/3/library/decimal.html#decimal.Decimal&quot;&gt;&lt;code&gt;Decimal(&quot;0&quot;)&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-fractions/&quot;&gt;&lt;code&gt;Fraction(0, 1)&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Empty sequences and collections, like  &lt;code&gt;&quot;&quot;&lt;/code&gt;, &lt;code&gt;()&lt;/code&gt;, &lt;code&gt;[]&lt;/code&gt;, &lt;code&gt;{}&lt;/code&gt;, &lt;a href=&quot;https://realpython.com/python-sets/&quot;&gt;&lt;code&gt;set()&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-range/&quot;&gt;&lt;code&gt;range(0)&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Objects that implement &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__bool__&quot;&gt;&lt;code&gt;.__bool__()&lt;/code&gt;&lt;/a&gt; with a return value of &lt;code&gt;False&lt;/code&gt; or &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html#object.__len__&quot;&gt;&lt;code&gt;.__len__()&lt;/code&gt;&lt;/a&gt; with a return value of &lt;code&gt;0&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-all/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-all/ »&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>Defining Python Functions With Optional Arguments</title>
      <id>https://realpython.com/courses/defining-python-functions-with-optional-arguments/</id>
      <link href="https://realpython.com/courses/defining-python-functions-with-optional-arguments/"/>
      <updated>2022-02-08T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn about Python optional arguments and how to define functions with default values. You&#x27;ll also learn how to create functions that accept any number of arguments using args and kwargs.</summary>
      <content type="html">
        &lt;p&gt;Defining your own functions is an essential skill for writing clean and effective code. In this tutorial, you&amp;rsquo;ll explore the techniques you have available for defining Python functions that take optional arguments. When you master Python optional arguments, you&amp;rsquo;ll be able to define functions that are more powerful and more flexible.&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;Distinguish between &lt;strong&gt;parameters&lt;/strong&gt; and &lt;strong&gt;arguments&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Define functions with &lt;strong&gt;optional arguments&lt;/strong&gt; and &lt;strong&gt;default parameter values&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Define functions using &lt;strong&gt;&lt;code&gt;args&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;kwargs&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Deal with &lt;strong&gt;error messages&lt;/strong&gt; about optional arguments&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 January 2022?</title>
      <id>https://realpython.com/python-news-january-2022/</id>
      <link href="https://realpython.com/python-news-january-2022/"/>
      <updated>2022-02-07T14:00:00+00:00</updated>
      <summary>In January 2022, Black came out of Beta, IPython 8.0 was released, PEP 665 was rejected, and last but not least, a fifteen-year-old bug was fixed. In this article, you&#x27;ll get the details on these important happenings in the world of Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In &lt;strong&gt;January 2022&lt;/strong&gt;, the code formatter &lt;strong&gt;Black&lt;/strong&gt; saw its first non-beta release and published a new stability policy. &lt;strong&gt;IPython&lt;/strong&gt;, the powerful interactive Python shell, marked the release of &lt;strong&gt;version 8.0&lt;/strong&gt;, its first major version release in three years. Additionally, &lt;strong&gt;PEP 665&lt;/strong&gt;, aimed at making reproducible installs easier by specifying a format for lock files, was rejected. Last but not least, a fifteen-year-old &lt;strong&gt;memory leak&lt;/strong&gt; bug in Python was fixed.&lt;/p&gt;
&lt;p&gt;Let’s dive into the biggest &lt;strong&gt;Python news&lt;/strong&gt; stories 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;black-no-longer-beta&quot;&gt;Black No Longer Beta&lt;a class=&quot;headerlink&quot; href=&quot;#black-no-longer-beta&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The developers of &lt;a href=&quot;https://github.com/psf/black&quot;&gt;Black&lt;/a&gt;, an opinionated code formatter, are now confident enough to call the latest release stable. This announcement brings Black out of beta for the first time:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/black-stable-release-tweet.065a0058c46f.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-66&quot; src=&quot;https://files.realpython.com/media/black-stable-release-tweet.065a0058c46f.png&quot; width=&quot;746&quot; height=&quot;409&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/black-stable-release-tweet.065a0058c46f.png&amp;amp;w=186&amp;amp;sig=dc1ff66d10ed549ae5cdab28a389ccdd98f6324b 186w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/black-stable-release-tweet.065a0058c46f.png&amp;amp;w=373&amp;amp;sig=4a24ef02afe80e827ecfb79c733ecb0b5e8090fb 373w, https://files.realpython.com/media/black-stable-release-tweet.065a0058c46f.png 746w&quot; sizes=&quot;75vw&quot; alt=&quot;Screenshot of tweet announcing stable release of Black&quot; data-asset=&quot;4195&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;&lt;a href=&quot;https://twitter.com/llanga/status/1487530230512295940?t=OOt8LufaUk0ex6iRgcKk9Q&amp;amp;s=19&quot; target=&quot;_blank&quot;&gt;Image source&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Code formatting can be the source of a surprising amount of conflict among developers. This is why code formatters, or &lt;a href=&quot;https://en.wikipedia.org/wiki/Lint_(software)&quot;&gt;linters&lt;/a&gt;, help enforce style conventions to maintain consistency across a whole codebase. Linters suggest changes, while code formatters rewrite your code:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/ipython-demo-2.e79f3df9cb73.gif&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/ipython-demo-2.e79f3df9cb73.gif&quot; width=&quot;984&quot; height=&quot;382&quot; srcset=&quot;https://files.realpython.com/media/ipython-demo-2.e79f3df9cb73.gif 246w, https://files.realpython.com/media/ipython-demo-2.e79f3df9cb73.gif 492w, https://files.realpython.com/media/ipython-demo-2.e79f3df9cb73.gif 984w&quot; sizes=&quot;75vw&quot; alt=&quot;Demo of Black formatter executing&quot; data-asset=&quot;4194&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;This makes your codebase more consistent, helps catch errors early, and makes code easier to scan.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/google/yapf&quot;&gt;YAPF&lt;/a&gt; is an example of a formatter.  It comes with the &lt;a href=&quot;https://www.python.org/dev/peps/pep-0008/&quot;&gt;PEP 8&lt;/a&gt; style guide as a default, but it’s not strongly opinionated, giving you a lot of control over its configuration.&lt;/p&gt;
&lt;p&gt;Black goes further: it comes with a PEP 8 compliant style, but on the whole, it’s &lt;em&gt;not&lt;/em&gt; configurable. The idea behind disallowing configuration is that you free up your brain to focus on the actual code by relinquishing control over style. Many believe this restriction gives them much more freedom to be creative coders. But of course, not everyone likes to give up this control!&lt;/p&gt;
&lt;p&gt;One crucial feature of opinionated formatters like Black is that they make your &lt;a href=&quot;https://en.wikipedia.org/wiki/Diff&quot;&gt;diffs&lt;/a&gt; much more informative. If you’ve ever committed a &lt;em&gt;cleanup&lt;/em&gt; or &lt;em&gt;formatting&lt;/em&gt; commit to your version control system, you may have inadvertently polluted your diff.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-january-2022/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-january-2022/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #96: Manipulating and Analyzing Audio in Python</title>
      <id>https://realpython.com/podcasts/rpp/96/</id>
      <link href="https://realpython.com/podcasts/rpp/96/"/>
      <updated>2022-02-04T12:00:00+00:00</updated>
      <summary>Would you like to experiment with analyzing or manipulating audio with Python? This week on the show, we have Braden Riggs from DolbyIO to discuss extracting audio features and Python libraries for reshaping audio. Braden shares techniques from his recent talk at PyData Global, &quot;Unlocking More From Your Audio Data!&quot;</summary>
      <content type="html">
        &lt;p&gt;Would you like to experiment with analyzing or manipulating audio with Python? This week on the show, we have Braden Riggs from DolbyIO to discuss extracting audio features and Python libraries for reshaping audio. Braden shares techniques from his recent talk at PyData Global, &quot;Unlocking More From Your Audio Data!&quot;&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using Python&#x27;s pip to Manage Your Projects&#x27; Dependencies</title>
      <id>https://realpython.com/what-is-pip/</id>
      <link href="https://realpython.com/what-is-pip/"/>
      <updated>2022-02-02T14:00:00+00:00</updated>
      <summary>What is pip? In this beginner-friendly tutorial, you&#x27;ll learn how to use pip, the standard package manager for Python, so that you can install and manage packages that aren&#x27;t part of the Python standard library.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The standard package manager for &lt;a href=&quot;https://www.python.org/&quot;&gt;Python&lt;/a&gt; is &lt;a href=&quot;https://pip.pypa.io/en/stable/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;. It allows you to install and manage packages that aren’t part of the &lt;a href=&quot;https://docs.python.org/3/py-modindex.html&quot;&gt;Python standard library&lt;/a&gt;. If you’re looking for an introduction to &lt;code&gt;pip&lt;/code&gt;, then you’ve come to the right place!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Set up &lt;code&gt;pip&lt;/code&gt;&lt;/strong&gt; in your working environment&lt;/li&gt;
&lt;li&gt;Fix &lt;strong&gt;common errors&lt;/strong&gt; related to working with &lt;code&gt;pip&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Install and uninstall packages&lt;/strong&gt; with &lt;code&gt;pip&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Manage projects’ dependencies using &lt;strong&gt;requirements files&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can do a lot with &lt;code&gt;pip&lt;/code&gt;, but the Python community is very active and has created some neat alternatives to &lt;code&gt;pip&lt;/code&gt;. You’ll learn about those later in this tutorial.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;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;getting-started-with-pip&quot;&gt;Getting Started With &lt;code&gt;pip&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-pip&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;So, what exactly does &lt;code&gt;pip&lt;/code&gt; do? &lt;a href=&quot;https://pip.pypa.io/en/stable/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt; is a &lt;strong&gt;package manager&lt;/strong&gt; for Python. That means it’s a tool that allows you to install and manage libraries and dependencies that aren’t distributed as part of the standard library. The name &lt;strong&gt;pip&lt;/strong&gt; was introduced by Ian Bicking in 2008:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I’ve finished renaming pyinstall to its new name: pip. The name pip is [an] acronym and declaration: pip installs packages. (&lt;a href=&quot;https://www.ianbicking.org/blog/2008/10/pyinstall-is-dead-long-live-pip.html&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Package management is so important that Python’s installers have included &lt;code&gt;pip&lt;/code&gt; since versions 3.4 and 2.7.9, for Python 3 and Python 2, respectively. Many Python projects use &lt;code&gt;pip&lt;/code&gt;, which makes it an essential tool for every Pythonista.&lt;/p&gt;
&lt;p&gt;The concept of a package manager might be familiar to you if you’re coming from another programming language. &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript&quot;&gt;JavaScript&lt;/a&gt; uses &lt;a href=&quot;https://www.npmjs.com/&quot;&gt;npm&lt;/a&gt; for package management, &lt;a href=&quot;https://www.ruby-lang.org/en/&quot;&gt;Ruby&lt;/a&gt; uses &lt;a href=&quot;https://rubygems.org/&quot;&gt;gem&lt;/a&gt;, and the &lt;a href=&quot;https://dotnet.microsoft.com/languages&quot;&gt;.NET platform&lt;/a&gt; uses &lt;a href=&quot;https://www.nuget.org/&quot;&gt;NuGet&lt;/a&gt;. In Python, &lt;code&gt;pip&lt;/code&gt; has become the standard package manager.&lt;/p&gt;
&lt;h3 id=&quot;finding-pip-on-your-system&quot;&gt;Finding &lt;code&gt;pip&lt;/code&gt; on Your System&lt;a class=&quot;headerlink&quot; href=&quot;#finding-pip-on-your-system&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The Python 3 installer gives you the option to install &lt;code&gt;pip&lt;/code&gt; when installing Python on your system. In fact, the option to install &lt;code&gt;pip&lt;/code&gt; with Python is checked by default, so &lt;code&gt;pip&lt;/code&gt; should be ready for you to use after installing Python.&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; On some Linux (Unix) systems like Ubuntu, &lt;code&gt;pip&lt;/code&gt; comes in a separate package called &lt;code&gt;python3-pip&lt;/code&gt;, which you need to install with &lt;code&gt;sudo apt install python3-pip&lt;/code&gt;. It’s not installed by default with the interpreter.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can verify that &lt;code&gt;pip&lt;/code&gt; is available by looking for the &lt;code&gt;pip3&lt;/code&gt; executable on your system. Select your operating system below and use your platform-specific command accordingly:&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

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




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

&lt;/ul&gt;
&lt;div class=&quot;tab-content mt-2 mb-0 js-platform-widget-content&quot;&gt;
&lt;div aria-labelledby=&quot;windows-tab-1&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight 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; where pip3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;where&lt;/code&gt; command on Windows will show you where you can find the executable of &lt;code&gt;pip3&lt;/code&gt;. If Windows can’t find an executable named &lt;code&gt;pip3&lt;/code&gt;, then you can also try looking for &lt;code&gt;pip&lt;/code&gt; without the three (&lt;code&gt;3&lt;/code&gt;) at the end.&lt;/p&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;which pip3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;which&lt;/code&gt; command on Linux systems and macOS shows you where the &lt;code&gt;pip3&lt;/code&gt; binary file is located.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;On Windows and Unix systems, &lt;code&gt;pip3&lt;/code&gt; may be found in more than one location. This can happen when you have multiple Python versions installed. If you can’t find &lt;code&gt;pip&lt;/code&gt; in any location on your system, then you may consider &lt;a href=&quot;#reinstalling-pip-when-errors-occur&quot;&gt;reinstalling pip&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Instead of running your system &lt;code&gt;pip&lt;/code&gt; directly, you can also run it as a Python module. In the next section, you’ll learn how.&lt;/p&gt;
&lt;h3 id=&quot;running-pip-as-a-module&quot;&gt;Running &lt;code&gt;pip&lt;/code&gt; as a Module&lt;a class=&quot;headerlink&quot; href=&quot;#running-pip-as-a-module&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When you run your system &lt;code&gt;pip&lt;/code&gt; directly, the command itself doesn’t reveal which Python version &lt;code&gt;pip&lt;/code&gt; belongs to. This unfortunately means that you could use &lt;code&gt;pip&lt;/code&gt; to install a package into the site-packages of an old Python version without noticing. To prevent this from happening, you can run &lt;code&gt;pip&lt;/code&gt; as a Python module:&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;python3 -m pip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Notice that you use &lt;code&gt;python3 -m&lt;/code&gt; to run &lt;code&gt;pip&lt;/code&gt;. The &lt;code&gt;-m&lt;/code&gt; switch tells Python to run a module as an executable of the &lt;code&gt;python3&lt;/code&gt; interpreter. This way, you can ensure that your system default Python 3 version runs the &lt;code&gt;pip&lt;/code&gt; command. If you want to learn more about this way of running &lt;code&gt;pip&lt;/code&gt;, then you can read Brett Cannon’s insightful article about &lt;a href=&quot;https://snarky.ca/why-you-should-use-python-m-pip/&quot;&gt;the advantages of using &lt;code&gt;python3 -m pip&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Sometimes you may want to be more explicit and limit packages to a specific project. In situations like this, you should run &lt;code&gt;pip&lt;/code&gt; inside a &lt;strong&gt;virtual environment&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;using-pip-in-a-python-virtual-environment&quot;&gt;Using &lt;code&gt;pip&lt;/code&gt; in a Python Virtual Environment&lt;a class=&quot;headerlink&quot; href=&quot;#using-pip-in-a-python-virtual-environment&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To avoid installing packages directly into your system Python installation, you can use a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;. A virtual environment provides an isolated Python interpreter for your project. Any packages that you use inside this environment will be independent of your system interpreter. This means that you can keep your project’s dependencies separate from other projects and the system at large.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/what-is-pip/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/what-is-pip/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s len() Function</title>
      <id>https://realpython.com/courses/pythons-len-function/</id>
      <link href="https://realpython.com/courses/pythons-len-function/"/>
      <updated>2022-02-01T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how and when to use the len() Python function. You&#x27;ll also learn how to customize your class definitions so that objects of a user-defined class can be used as arguments in len().</summary>
      <content type="html">
        &lt;p&gt;In many situations, you&amp;rsquo;ll need to find the number of items stored in a data structure. Python&amp;rsquo;s built-in function &lt;code&gt;len()&lt;/code&gt; is the tool that will help you with this task.&lt;/p&gt;
&lt;p&gt;There are some cases in which the use of &lt;code&gt;len()&lt;/code&gt; is straightforward. However, there are other times when you&amp;rsquo;ll need to understand how this function works in more detail and how to apply it to different data types.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Find the length of  &lt;strong&gt;built-in data types&lt;/strong&gt; using &lt;code&gt;len()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;len()&lt;/code&gt; with &lt;strong&gt;third-party data types&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Provide support for &lt;code&gt;len()&lt;/code&gt; with &lt;strong&gt;user-defined classes&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;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>Draw the Mandelbrot Set in Python</title>
      <id>https://realpython.com/mandelbrot-set-python/</id>
      <link href="https://realpython.com/mandelbrot-set-python/"/>
      <updated>2022-01-31T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll visualize the famous Mandelbrot set using Python&#x27;s Matplotlib and Pillow libraries. You&#x27;ll learn how to draw the fractal in black and white, grayscale, and color.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;This tutorial will guide you through a fun project involving &lt;a href=&quot;https://realpython.com/python-complex-numbers/&quot;&gt;complex numbers in Python&lt;/a&gt;. You’re going to learn about fractals and create some truly stunning art by drawing the &lt;strong&gt;Mandelbrot set&lt;/strong&gt; using Python’s Matplotlib and Pillow libraries. Along the way, you’ll learn how this famous fractal was discovered, what it represents, and how it relates to other fractals.&lt;/p&gt;
&lt;p&gt;Knowing about &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; principles and &lt;a href=&quot;https://realpython.com/python-recursion/&quot;&gt;recursion&lt;/a&gt; will enable you to take full advantage of Python’s expressive syntax to write clean code that reads almost like math formulas. To understand the algorithmic details of making fractals, you should also be comfortable with &lt;a href=&quot;https://en.wikipedia.org/wiki/Complex_number&quot;&gt;complex numbers&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Logarithm&quot;&gt;logarithms&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Set_theory&quot;&gt;set theory&lt;/a&gt;, and &lt;a href=&quot;https://en.wikipedia.org/wiki/Iterated_function&quot;&gt;iterated functions&lt;/a&gt;. But don’t let these prerequisites scare you away, as you’ll be able to follow along and produce the art anyway!&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;Apply &lt;strong&gt;complex numbers&lt;/strong&gt; to a practical problem&lt;/li&gt;
&lt;li&gt;Find members of the &lt;strong&gt;Mandelbrot&lt;/strong&gt; and &lt;strong&gt;Julia&lt;/strong&gt; sets&lt;/li&gt;
&lt;li&gt;Draw these sets as &lt;strong&gt;fractals&lt;/strong&gt; using &lt;strong&gt;Matplotlib&lt;/strong&gt; and &lt;strong&gt;Pillow&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Make a &lt;strong&gt;colorful&lt;/strong&gt; artistic representation of the fractals&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To download the source code used in this tutorial, 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/mandelbrot-set-python-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-mandelbrot-set-python-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 draw the Mandelbrot set.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;understanding-the-mandelbrot-set&quot;&gt;Understanding the Mandelbrot Set&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-the-mandelbrot-set&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before you try to draw the fractal, it’ll help to understand what the corresponding Mandelbrot set represents and how to determine its members. If you’re already familiar with the underlying theory, then feel free to skip ahead to the &lt;a href=&quot;#plotting-the-mandelbrot-set-using-pythons-matplotlib&quot;&gt;plotting section&lt;/a&gt; below.&lt;/p&gt;
&lt;h3 id=&quot;the-icon-of-fractal-geometry&quot;&gt;The Icon of Fractal Geometry&lt;a class=&quot;headerlink&quot; href=&quot;#the-icon-of-fractal-geometry&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Even if the name is new to you, you might have seen some mesmerizing visualizations of the Mandelbrot set before. It’s a set of &lt;strong&gt;complex numbers&lt;/strong&gt;, whose boundary forms a distinctive and intricate pattern when depicted on the &lt;a href=&quot;https://en.wikipedia.org/wiki/Complex_plane&quot;&gt;complex plane&lt;/a&gt;. That pattern became arguably the most famous &lt;a href=&quot;https://en.wikipedia.org/wiki/Fractal&quot;&gt;fractal&lt;/a&gt;, giving birth to &lt;strong&gt;fractal geometry&lt;/strong&gt; in the late 20th century:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/wikimedia_Mandel_zoom_00_mandelbrot_set.54d99530ad68.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border &quot; src=&quot;https://files.realpython.com/media/wikimedia_Mandel_zoom_00_mandelbrot_set.54d99530ad68.jpg&quot; width=&quot;2560&quot; height=&quot;1920&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/wikimedia_Mandel_zoom_00_mandelbrot_set.54d99530ad68.jpg&amp;amp;w=640&amp;amp;sig=57269fdb9ff1cdea47d7308abbaa43981eb2cebd 640w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/wikimedia_Mandel_zoom_00_mandelbrot_set.54d99530ad68.jpg&amp;amp;w=1280&amp;amp;sig=2c78a0e4f66e60244225e76f5ff1793712e3bbc2 1280w, https://files.realpython.com/media/wikimedia_Mandel_zoom_00_mandelbrot_set.54d99530ad68.jpg 2560w&quot; sizes=&quot;75vw&quot; alt=&quot;Mandelbrot Set (Source: Wikimedia, Created by Wolfgang Beyer, CC BY-SA 3.0)&quot; data-asset=&quot;4050&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Mandelbrot Set (Source: Wikimedia, Created by Wolfgang Beyer, CC BY-SA 3.0)&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;The discovery of the Mandelbrot set was possible thanks to technological advancement. It’s attributed to a mathematician named &lt;a href=&quot;https://en.wikipedia.org/wiki/Benoit_Mandelbrot&quot;&gt;Benoît Mandelbrot&lt;/a&gt;. He worked at IBM and had access to a computer capable of what was, at the time, demanding number crunching. Today, you can explore fractals in the comfort of your home, using nothing more than Python!&lt;/p&gt;
&lt;p&gt;Fractals are &lt;strong&gt;infinitely repeating&lt;/strong&gt; patterns on &lt;strong&gt;different scales&lt;/strong&gt;. While philosophers have argued for centuries about the existence of infinity, fractals do have an analogy in the real world. It’s a fairly common phenomenon occurring in nature. For example, this Romanesco cauliflower is finite but has a &lt;a href=&quot;https://en.wikipedia.org/wiki/Self-similarity&quot;&gt;self-similar&lt;/a&gt; structure because each part of the vegetable looks like the whole, only smaller:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/cauliflower.422e79018866.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block border &quot; src=&quot;https://files.realpython.com/media/cauliflower.422e79018866.jpg&quot; width=&quot;1954&quot; height=&quot;1301&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/cauliflower.422e79018866.jpg&amp;amp;w=488&amp;amp;sig=5f5c2986c0edf851f31bc84f86e2b024215db413 488w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/cauliflower.422e79018866.jpg&amp;amp;w=977&amp;amp;sig=fafc845f08319b4c31d8f1defc7ac63815c86652 977w, https://files.realpython.com/media/cauliflower.422e79018866.jpg 1954w&quot; sizes=&quot;75vw&quot; alt=&quot;Fractal Structure of a Cauliflower&quot; data-asset=&quot;3661&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Fractal Structure of a Romanesco Cauliflower&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;Self-similarity can often be defined mathematically with &lt;a href=&quot;https://realpython.com/python-thinking-recursively/&quot;&gt;recursion&lt;/a&gt;. The Mandelbrot set isn’t perfectly self-similar as it contains slightly different copies of itself at smaller scales. Nevertheless, it can still be described by a recursive function in the complex domain.&lt;/p&gt;
&lt;h3 id=&quot;the-boundary-of-iterative-stability&quot;&gt;The Boundary of Iterative Stability&lt;a class=&quot;headerlink&quot; href=&quot;#the-boundary-of-iterative-stability&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Formally, the Mandelbrot set is the set of complex numbers, &lt;em&gt;c&lt;/em&gt;, for which an infinite sequence of numbers, &lt;em&gt;z&lt;sub&gt;0&lt;/sub&gt;&lt;/em&gt;, &lt;em&gt;z&lt;sub&gt;1&lt;/sub&gt;&lt;/em&gt;, …, &lt;em&gt;z&lt;sub&gt;n&lt;/sub&gt;&lt;/em&gt;, …, remains &lt;a href=&quot;https://en.wikipedia.org/wiki/Bounded_function&quot;&gt;bounded&lt;/a&gt;. In other words, there is a limit that the magnitude of each complex number in that sequence never exceeds. The Mandelbrot sequence is given by the following recursive formula:&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/latex_mandelbrot.95af84d59784.png&quot; width=&quot;1650&quot; height=&quot;350&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/latex_mandelbrot.95af84d59784.png&amp;amp;w=412&amp;amp;sig=49a86f0502657a027fe77e5ee6967a74074fd425 412w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/latex_mandelbrot.95af84d59784.png&amp;amp;w=825&amp;amp;sig=76fd043318d344bd0c1a04d1b4d08579192d8a8e 825w, https://files.realpython.com/media/latex_mandelbrot.95af84d59784.png 1650w&quot; sizes=&quot;75vw&quot; alt=&quot;Mandelbrot Set Formula&quot; data-asset=&quot;3662&quot;&gt;&lt;/figure&gt;

&lt;p&gt;In plain English, to decide whether some complex number, &lt;em&gt;c&lt;/em&gt;, belongs to the Mandelbrot set, you must feed that number to the formula above. From now on, the number &lt;em&gt;c&lt;/em&gt; will remain constant as you iterate the sequence. The first element of the sequence, &lt;em&gt;z&lt;sub&gt;0&lt;/sub&gt;&lt;/em&gt;, is always equal to zero. To calculate the next element, &lt;em&gt;z&lt;sub&gt;n+1&lt;/sub&gt;&lt;/em&gt;, you’ll keep &lt;strong&gt;squaring&lt;/strong&gt; the last element, &lt;em&gt;z&lt;sub&gt;n&lt;/sub&gt;&lt;/em&gt;, and &lt;strong&gt;adding&lt;/strong&gt; your initial number, &lt;em&gt;c&lt;/em&gt;, in a feedback loop.&lt;/p&gt;
&lt;p&gt;By observing how the resulting sequence of numbers behaves, you’ll be able to classify your complex number, &lt;em&gt;c&lt;/em&gt;, as either a Mandelbrot set member or not. The sequence is infinite, but you must stop calculating its elements at some point. Making that choice is somewhat arbitrary and depends on your accepted level of confidence, as more elements will provide a more accurate ruling on &lt;em&gt;c&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The entire Mandelbrot set fits in a circle with a radius of two when depicted on the complex plane. This is a handy fact that’ll let you skip many unnecessary calculations for points that certainly don’t belong to the set.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;With complex numbers, you can imagine this iterative process visually in two dimensions, but you can go ahead and consider only real numbers for the sake of simplicity now. If you were to implement the above equation in Python, then it could look something like this:&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;z&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&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;n&quot;&gt;n&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;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;z&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&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;n&quot;&gt;c&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;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;c&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Your &lt;code&gt;z()&lt;/code&gt; function returns the nth element of the sequence, which is why it expects an element’s index, &lt;code&gt;n&lt;/code&gt;, as the first argument. The second argument, &lt;code&gt;c&lt;/code&gt;, is a fixed number that you’re testing. This function would keep calling itself infinitely due to recursion. However, to break that chain of &lt;strong&gt;recursive&lt;/strong&gt; calls, a condition checks for the base case with an immediately known solution—zero.&lt;/p&gt;
&lt;p&gt;Try using your new function to find the first ten elements of the sequence for &lt;em&gt;c&lt;/em&gt; = 1, and see what happens:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/mandelbrot-set-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/mandelbrot-set-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 #95: What Is a JIT and How Can Pyjion Speed Up Your Python?</title>
      <id>https://realpython.com/podcasts/rpp/95/</id>
      <link href="https://realpython.com/podcasts/rpp/95/"/>
      <updated>2022-01-28T12:00:00+00:00</updated>
      <summary>How can you can speed up Python? Have you thought of using a JIT (Just-In-Time Compiler)? This week on the show, we have Real Python author and previous guest Anthony Shaw to talk about his project Pyjion, a drop-in JIT compiler for CPython 3.10.</summary>
      <content type="html">
        &lt;p&gt;How can you can speed up Python? Have you thought of using a JIT (Just-In-Time Compiler)? This week on the show, we have Real Python author and previous guest Anthony Shaw to talk about his project Pyjion, a drop-in JIT compiler for CPython 3.10.&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>Raining Outside? Build a Weather CLI App With Python</title>
      <id>https://realpython.com/build-a-python-weather-app-cli/</id>
      <link href="https://realpython.com/build-a-python-weather-app-cli/"/>
      <updated>2022-01-26T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll write a nicely formatted Python CLI app that displays information about the current weather in any city you provide the name for.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;You’re stuck inside because of torrential rains—again! You wonder what the weather’s like in that faraway city where your friends from the &lt;a href=&quot;https://realpython.com/community/&quot;&gt;Real Python community&lt;/a&gt; live. You’d rather stick around in your command-line interface (CLI) than look it up in your browser. If that sounds like a task you’d want to tackle by building a command-line weather app using only the Python standard library, then this tutorial is for you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Build a functional &lt;strong&gt;weather lookup tool&lt;/strong&gt; using only &lt;strong&gt;Python standard library&lt;/strong&gt; modules&lt;/li&gt;
&lt;li&gt;Build a &lt;strong&gt;Python CLI app&lt;/strong&gt; using &lt;strong&gt;&lt;code&gt;argparse&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;configparser&lt;/code&gt; to &lt;strong&gt;handle API secrets&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Make &lt;strong&gt;API calls&lt;/strong&gt; from your Python script&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;visually attractive CLI output&lt;/strong&gt; using ANSI escape codes, emojis, &lt;strong&gt;f-strings&lt;/strong&gt;, and Python’s string mini-language&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Looking out the window confirms your decision. With that rain, there’s no way to frolic in the meadows today. Time to write a Python weather app and dream of distant places right from your CLI! You might even discover a couple of surprising city names along the way.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/build-a-python-weather-app-cli-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-build-a-python-weather-app-cli-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 your weather app.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo&quot;&gt;Demo&lt;a class=&quot;headerlink&quot; href=&quot;#demo&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;While you wait for a rainbow to appear outside your window, you’ll add your own colors to your weather app. For that, you’ll use some formatting tricks that’ll make the CLI output snazzier than plain text:&lt;/p&gt;
&lt;figure&gt;
  &lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 &quot;&gt;
    &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/644506117?background=1&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;If you like the look of this command-line app and want to train your Python coding skills while using the standard library, then you’ve come to the right place!&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; This app was developed on &lt;strong&gt;macOS&lt;/strong&gt; for the &lt;a href=&quot;https://www.zsh.org&quot;&gt;Zsh&lt;/a&gt; shell. Your mileage with some of the color display and emojis may vary depending on your setup. On &lt;strong&gt;Windows&lt;/strong&gt;, &lt;a href=&quot;https://docs.microsoft.com/en-us/powershell/&quot;&gt;PowerShell&lt;/a&gt; displays the formatting reasonably well, and if you’re on a newer version of the operating system, you should see good results with the defaults in &lt;a href=&quot;https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701&quot;&gt;Windows Terminal&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;If you’d prefer another color scheme or want to use different emojis for your own app, you’ll be able to customize it while working along with 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;Before you start to write any code, it’s often a good idea to think about the specifications of the program you’re planning to build. First, take out a pen and paper and jot down your ideas for what a perfect weather app would look like. Once you’ve noted your ideas, you can click on the heading below to read what specifications you’ll consider when working through this tutorial:&lt;/p&gt;
&lt;div class=&quot;card mb-3&quot; id=&quot;collapse_card5b16b8&quot;&gt;
&lt;div class=&quot;card-header border-0&quot;&gt;
&lt;p class=&quot;m-0&quot;&gt;&lt;button class=&quot;btn w-100&quot; data-toggle=&quot;collapse&quot; data-target=&quot;#collapse5b16b8&quot; aria-expanded=&quot;false&quot; aria-controls=&quot;collapse5b16b8&quot; markdown=&quot;1&quot;&gt;&lt;span class=&quot;float-left&quot; markdown=&quot;1&quot;&gt;Weather App Specifications&lt;/span&gt;&lt;span class=&quot;float-right text-muted&quot;&gt;Show/Hide&lt;/span&gt;&lt;/button&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;collapse js-collapsible-section&quot; data-parent=&quot;#collapse_card5b16b8&quot; id=&quot;collapse5b16b8&quot;&gt;
&lt;div class=&quot;card-body&quot;&gt;
&lt;p&gt;The weather app you’ll build in this tutorial will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Take a city name as required input&lt;/li&gt;
&lt;li&gt;Take an optional flag to display the output in Fahrenheit instead of Celsius, if desired&lt;/li&gt;
&lt;li&gt;Call an online weather API to fetch the weather data&lt;/li&gt;
&lt;li&gt;Display the city name, the current weather conditions, and the current temperature&lt;/li&gt;
&lt;li&gt;Format the output visually using colors, spacing, and emojis&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With these quick notes, you have a rough plan of what you’ll build, and you’ve defined the scope of what the app will be able to do.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you have different or additional features in mind, then keep your notes around and implement them on top of your weather app once you’ve finished building this initial version.&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; Writing great command-line interfaces can be challenging. You want your app to be user-friendly and still provide all the functionality you need. Using higher-level libraries might make it easier for you to build out your applications.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In this tutorial, you’ll work with Python’s built-in &lt;strong&gt;&lt;code&gt;argparse&lt;/code&gt; module&lt;/strong&gt;, which assists you in creating user-friendly CLI apps, for example by providing a useful &lt;code&gt;--help&lt;/code&gt; option out of the box.&lt;/p&gt;
&lt;p&gt;You’ll get the &lt;a href=&quot;https://openweathermap.org/current#name&quot;&gt;current weather data by city name&lt;/a&gt; from different locations around the world, using the &lt;a href=&quot;https://openweathermap.org/api&quot;&gt;weather API&lt;/a&gt; from &lt;strong&gt;OpenWeather&lt;/strong&gt;. This &lt;a href=&quot;https://en.wikipedia.org/wiki/API&quot;&gt;application programming interface (API)&lt;/a&gt; is free to use, with a generous quota of API calls. However, you’ll need to create a personal API key to make requests, which you’ll do in just a moment.&lt;/p&gt;
&lt;p&gt;Before you start digging in, take another look at the expected prerequisites so that you know where you can brush up on your skills in case you get stuck somewhere along the way.&lt;/p&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To complete this tutorial, you should be comfortable with the following concepts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/&quot;&gt;Building command-line interfaces using &lt;code&gt;argparse&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-api/&quot;&gt;Reading public data from the Internet with APIs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/api-integration-in-python/&quot;&gt;Integrating APIs in Python code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-json/&quot;&gt;Working with JSON data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-import/#basic-python-import&quot;&gt;Importing modules and libraries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;Defining your own functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-exceptions/&quot;&gt;Handling errors with Python exceptions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-f-strings/&quot;&gt;Formatting your text using f-strings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-conditional-statements/#conditional-expressions-pythons-ternary-operator&quot;&gt;Using conditional expressions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll also need an &lt;a href=&quot;https://en.wikipedia.org/wiki/Application_programming_interface_key&quot;&gt;API key&lt;/a&gt; for the weather API from OpenWeather, and you’ll learn how to get access to one in the upcoming section.&lt;/p&gt;
&lt;p&gt;If you don’t have all of the prerequisite knowledge before starting this tutorial, that’s okay! In fact, you might learn more by going ahead and getting started. You can always stop and review the resources linked here if you get stuck.&lt;/p&gt;
&lt;h2 id=&quot;step-1-get-access-to-a-suitable-weather-api&quot;&gt;Step 1: Get Access to a Suitable Weather API&lt;a class=&quot;headerlink&quot; href=&quot;#step-1-get-access-to-a-suitable-weather-api&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/build-a-python-weather-app-cli/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/build-a-python-weather-app-cli/ »&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>Looping With Python enumerate()</title>
      <id>https://realpython.com/courses/looping-with-python-enumerate/</id>
      <link href="https://realpython.com/courses/looping-with-python-enumerate/"/>
      <updated>2022-01-25T14:00:00+00:00</updated>
      <summary>Once you learn about for loops in Python, you know that using an index to access items in a sequence isn&#x27;t very Pythonic. So what do you do when you need that index value? In this course, you&#x27;ll learn all about Python&#x27;s built-in enumerate(), where it&#x27;s used, and how you can emulate its behavior.</summary>
      <content type="html">
        &lt;p&gt;In Python, a &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/a&gt; is usually written as a loop over an iterable object. This means that you don&amp;rsquo;t need a counting variable to access items in the iterable. Sometimes, though, you do want to have a variable that changes on each loop iteration. Rather than creating and incrementing a variable yourself, you can use Python&amp;rsquo;s &lt;strong&gt;&lt;code&gt;enumerate()&lt;/code&gt;&lt;/strong&gt; to get a counter and the value from the iterable at the same time!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll see how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;&lt;code&gt;enumerate()&lt;/code&gt;&lt;/strong&gt; to get a counter in a loop&lt;/li&gt;
&lt;li&gt;Apply &lt;code&gt;enumerate()&lt;/code&gt; to &lt;strong&gt;display item counts&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Implement your own &lt;strong&gt;equivalent function&lt;/strong&gt; to &lt;code&gt;enumerate()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unpack values&lt;/strong&gt; returned by &lt;code&gt;enumerate()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Modulo String Formatting in Python</title>
      <id>https://realpython.com/python-modulo-string-formatting/</id>
      <link href="https://realpython.com/python-modulo-string-formatting/"/>
      <updated>2022-01-24T14:00:00+00:00</updated>
      <summary>You can use the modulo operator for string formatting in Python. It&#x27;s a commonly used technique in older Python versions, especially in Python 2. Therefore, you might see it when digging into existing code bases, and it can be helpful to understand how it works.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you’re writing modern Python code with Python 3, you’ll probably want to format your strings with &lt;a href=&quot;https://realpython.com/python-f-strings/&quot;&gt;Python f-strings&lt;/a&gt;. However, if you’re working with older Python codebases, you’re likely to encounter the &lt;strong&gt;string modulo operator&lt;/strong&gt; for string formatting.&lt;/p&gt;
&lt;p&gt;If you’re reading or writing Python 2 code, it’ll help if you’re familiar with this technique. Because the syntax still works in Python 3, you might even see developers use it in modern Python codebases.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use the &lt;strong&gt;modulo operator (&lt;code&gt;%&lt;/code&gt;)&lt;/strong&gt; for &lt;strong&gt;string formatting&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Convert values&lt;/strong&gt; into &lt;strong&gt;specific types&lt;/strong&gt; before inserting them into your string&lt;/li&gt;
&lt;li&gt;Specify the &lt;strong&gt;horizontal space&lt;/strong&gt; a formatted value occupies&lt;/li&gt;
&lt;li&gt;Fine-tune the display using &lt;strong&gt;conversion flags&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Specify values using &lt;strong&gt;dictionary mapping&lt;/strong&gt; instead of tuples&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you’re acquainted with the &lt;a href=&quot;https://en.wikipedia.org/wiki/Printf_format_string&quot;&gt;&lt;code&gt;printf()&lt;/code&gt;&lt;/a&gt; family of functions of &lt;a href=&quot;https://realpython.com/c-for-python-programmers/&quot;&gt;C&lt;/a&gt;, Perl, or &lt;a href=&quot;https://realpython.com/oop-in-python-vs-java/&quot;&gt;Java&lt;/a&gt;, then you’ll see that these don’t exist in Python. However, there’s quite a bit of similarity between &lt;code&gt;printf()&lt;/code&gt; and the string modulo operator, so if you’re familiar with &lt;code&gt;printf()&lt;/code&gt;, then a lot of the following will feel familiar.&lt;/p&gt;
&lt;p&gt;On the other hand, if you aren’t familiar with &lt;code&gt;printf()&lt;/code&gt;, don’t worry! You don’t need any prior knowledge of &lt;code&gt;printf()&lt;/code&gt; to master modulo string formatting in Python.&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-experiment&quot; data-focus=&quot;false&quot;&gt;Click here to get our free Python Cheat Sheet&lt;/a&gt; that shows you 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;use-the-modulo-operator-for-string-formatting-in-python&quot;&gt;Use the Modulo Operator for String Formatting in Python&lt;a class=&quot;headerlink&quot; href=&quot;#use-the-modulo-operator-for-string-formatting-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’ve probably used the &lt;a href=&quot;https://realpython.com/python-modulo-operator/&quot;&gt;modulo operator (&lt;code&gt;%&lt;/code&gt;)&lt;/a&gt; before with &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;numbers&lt;/a&gt;, in which case it computes the remainder from a division:&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;mi&quot;&gt;11&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;With string operands, the modulo operator has an entirely different function: &lt;strong&gt;string formatting&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; These two operations aren’t very much alike. They only share the same name because they are represented by the same symbol (&lt;code&gt;%&lt;/code&gt;).&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Here’s what the syntax of the string modulo operator looks like:&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;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;format_string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;On the left side of the &lt;code&gt;%&lt;/code&gt; operator, &lt;code&gt;&amp;lt;format_string&amp;gt;&lt;/code&gt; is a string containing one or more conversion specifiers. The &lt;code&gt;&amp;lt;values&amp;gt;&lt;/code&gt; on the right side get inserted into &lt;code&gt;&amp;lt;format_string&amp;gt;&lt;/code&gt; in place of the conversion specifiers. The resulting formatted string is the value of the expression.&lt;/p&gt;
&lt;p&gt;Get started with an example where you call &lt;code&gt;print()&lt;/code&gt; to display a formatted string using the string modulo operator:&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;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;%d&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;%s&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; cost $&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;%.2f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&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;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;bananas&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.74&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;6 bananas cost $1.74&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In addition to representing the string modulo operation itself, the &lt;code&gt;%&lt;/code&gt; character also denotes the beginning of a conversion specifier in the format string—in this case, there are three: &lt;code&gt;%d&lt;/code&gt;, &lt;code&gt;%s&lt;/code&gt;, and &lt;code&gt;%.2f&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;In the output, Python converted each item from the tuple of values to a string value and inserted it into the format string in place of the corresponding conversion specifier:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The first item in the tuple is &lt;code&gt;6&lt;/code&gt;, a numeric value that replaces &lt;code&gt;%d&lt;/code&gt; in the format string.&lt;/li&gt;
&lt;li&gt;The next item is the string value &lt;code&gt;&quot;bananas&quot;&lt;/code&gt;, which replaces &lt;code&gt;%s&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The last item is the float value &lt;code&gt;1.74&lt;/code&gt;, which replaces &lt;code&gt;%.2f&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The resulting string is &lt;code&gt;6 bananas cost $1.74&lt;/code&gt;, as demonstrated in the following diagram:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/t.176c482e3252.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-66&quot; src=&quot;https://files.realpython.com/media/t.176c482e3252.png&quot; width=&quot;1443&quot; height=&quot;684&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/t.176c482e3252.png&amp;amp;w=360&amp;amp;sig=68d5ec2944490b9930f4119d43ade440971876e7 360w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/t.176c482e3252.png&amp;amp;w=721&amp;amp;sig=1cb8f5e1d60bd3c6e132f2ce02e73f81cfd7d77f 721w, https://files.realpython.com/media/t.176c482e3252.png 1443w&quot; sizes=&quot;75vw&quot; alt=&quot;Illustration of Python string modulo operator usage&quot; data-asset=&quot;447&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;The String Modulo Operator&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;If there are multiple values to insert, then they must be enclosed in a tuple, as illustrated above. If there’s only one value, then you can write it by itself without the surrounding parentheses:&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;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, my name is &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;%s&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Graham&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello, my name is Graham.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Notice also that string modulo operation isn’t only for printing. You can also format values and assign them to another string &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variable&lt;/a&gt;:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-modulo-string-formatting/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-modulo-string-formatting/ »&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 #94: Designing for Users and Building a Social Network With Django</title>
      <id>https://realpython.com/podcasts/rpp/94/</id>
      <link href="https://realpython.com/podcasts/rpp/94/"/>
      <updated>2022-01-21T12:00:00+00:00</updated>
      <summary>Are you looking for a project to practice your Django skills? Designing the fundamental interactions of a social network is an instructive way to explore models and relationships while learning advanced Django skills. This week on the show, we talk with previous guest Martin Breuss about his new four-part series, &quot;Build a Social Network With Django&quot;.</summary>
      <content type="html">
        &lt;p&gt;Are you looking for a project to practice your Django skills? Designing the fundamental interactions of a social network is an instructive way to explore models and relationships while learning advanced Django skills. This week on the show, we talk with previous guest Martin Breuss about his new four-part series, &quot;Build a Social Network With Django&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 Dice-Rolling Application With Python</title>
      <id>https://realpython.com/python-dice-roll/</id>
      <link href="https://realpython.com/python-dice-roll/"/>
      <updated>2022-01-19T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll build a dice-rolling simulator app with a minimal text-based user interface using Python. The app will simulate the rolling of up to six dice. Each individual die will have six sides.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Building small projects, like a &lt;a href=&quot;https://en.wikipedia.org/wiki/Text-based_user_interface&quot;&gt;text-based user interface (TUI)&lt;/a&gt; dice-rolling application, will help you level up your Python programming skills. You’ll learn how to gather and validate the user’s input, import code from modules and packages, write functions, use &lt;code&gt;for&lt;/code&gt; loops and conditionals, and neatly display output by using strings and the &lt;a href=&quot;https://realpython.com/python-print/&quot;&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/a&gt; function.&lt;/p&gt;
&lt;p&gt;In this project, you’ll code an application that simulates dice-rolling events. To do so, you’ll use Python’s &lt;code&gt;random&lt;/code&gt; module.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;&lt;code&gt;random.randint()&lt;/code&gt;&lt;/strong&gt; to simulate &lt;strong&gt;dice-rolling&lt;/strong&gt; events&lt;/li&gt;
&lt;li&gt;Ask for the &lt;strong&gt;user’s input&lt;/strong&gt; using the built-in &lt;strong&gt;&lt;code&gt;input()&lt;/code&gt;&lt;/strong&gt; function&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Parse&lt;/strong&gt; and &lt;strong&gt;validate&lt;/strong&gt; the user’s input&lt;/li&gt;
&lt;li&gt;Manipulate &lt;strong&gt;strings&lt;/strong&gt; using methods, such as &lt;strong&gt;&lt;code&gt;.center()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;.join()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll also learn the basics of how to structure, organize, document, and run your Python programs and scripts.&lt;/p&gt;
&lt;p&gt;Click the link below to download the entire code for this dice-rolling application and follow along while you build the project yourself:&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/python-dice-roll-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-dice-roll-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 your Python dice-rolling app.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo&quot;&gt;Demo&lt;a class=&quot;headerlink&quot; href=&quot;#demo&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this step-by-step project, you’ll build an application that runs dice-rolling simulations. The app will be able to roll up to six dice, with each die having six faces. After every roll, the application will generate an ASCII diagram of dice faces and display it on the screen. The following video demonstrates how the app works:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/python-dice-roll-demo.93e6fe0d714a.gif&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/python-dice-roll-demo.93e6fe0d714a.gif&quot; width=&quot;1000&quot; height=&quot;562&quot; srcset=&quot;https://files.realpython.com/media/python-dice-roll-demo.93e6fe0d714a.gif 250w, https://files.realpython.com/media/python-dice-roll-demo.93e6fe0d714a.gif 500w, https://files.realpython.com/media/python-dice-roll-demo.93e6fe0d714a.gif 1000w&quot; sizes=&quot;75vw&quot; alt=&quot;Python Dice Roll App Demo Video&quot; data-asset=&quot;4027&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;When you run your dice-rolling simulator app, you get a prompt asking for the number of dice you want to roll. Once you provide a valid integer from 1 to 6, inclusive, then the application simulates the rolling event and displays a diagram of dice faces on the screen.&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Your dice-rolling simulator app will have a minimal yet user-friendly &lt;a href=&quot;https://en.wikipedia.org/wiki/Text-based_user_interface&quot;&gt;text-based user interface (TUI)&lt;/a&gt;, which will allow you to specify the number of six-sided dice that you’d like to roll. You’ll use this TUI to roll the dice at home without having to fly to Las Vegas.&lt;/p&gt;
&lt;p&gt;Here’s a description of how the app will work internally:&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;Tasks to Run&lt;/th&gt;
&lt;th&gt;Tools to Use&lt;/th&gt;
&lt;th&gt;Code to Write&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Prompt the user to choose how many six-sided dice to roll, then read the user’s input&lt;/td&gt;
&lt;td&gt;Python’s built-in &lt;a href=&quot;https://docs.python.org/3/library/functions.html#input&quot;&gt;&lt;code&gt;input()&lt;/code&gt;&lt;/a&gt; function&lt;/td&gt;
&lt;td&gt;A call to &lt;code&gt;input()&lt;/code&gt; with appropriate arguments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Parse and validate the user’s input&lt;/td&gt;
&lt;td&gt;String methods, comparison operators, and &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional statements&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;A user-defined function called &lt;code&gt;parse_input()&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Run the dice-rolling simulation&lt;/td&gt;
&lt;td&gt;Python’s &lt;a href=&quot;https://realpython.com/python-random/&quot;&gt;&lt;code&gt;random&lt;/code&gt;&lt;/a&gt; module, specifically the &lt;a href=&quot;https://docs.python.org/3/library/random.html#random.randint&quot;&gt;&lt;code&gt;randint()&lt;/code&gt;&lt;/a&gt; function&lt;/td&gt;
&lt;td&gt;A user-defined function called &lt;code&gt;roll_dice()&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generate an ASCII diagram with the resulting dice faces&lt;/td&gt;
&lt;td&gt;Loops, &lt;a href=&quot;https://realpython.com/python-append/&quot;&gt;&lt;code&gt;list.append()&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-string-split-concatenate-join/&quot;&gt;&lt;code&gt;str.join()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;A user-defined function called &lt;code&gt;generate_dice_faces_diagram()&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Display the diagram of dice faces on the screen&lt;/td&gt;
&lt;td&gt;Python’s built-in &lt;a href=&quot;https://realpython.com/python-print/&quot;&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/a&gt; function&lt;/td&gt;
&lt;td&gt;A call to &lt;code&gt;print()&lt;/code&gt; with appropriate arguments&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Keeping these internal workings in mind, you’ll code three custom functions to provide the app’s main features and functionalities. These functions will define your code’s public &lt;a href=&quot;https://en.wikipedia.org/wiki/API&quot;&gt;API&lt;/a&gt;, which you’ll call to bring the app to life.&lt;/p&gt;
&lt;p&gt;To organize the code of your dice-rolling simulator project, you’ll create a single file called &lt;code&gt;dice.py&lt;/code&gt; in a directory of your choice in your file system. Go ahead and create the file to get started!&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 should be comfortable with the following concepts and skills before you start building this dice-rolling simulation project:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ways to &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;run scripts&lt;/a&gt; in Python&lt;/li&gt;
&lt;li&gt;Python’s &lt;a href=&quot;https://realpython.com/python-import/&quot;&gt;&lt;code&gt;import&lt;/code&gt;&lt;/a&gt; mechanism&lt;/li&gt;
&lt;li&gt;The basics of &lt;a href=&quot;https://realpython.com/python-data-types/&quot;&gt;Python data types&lt;/a&gt;, mainly &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-numbers/#integers&quot;&gt;integer numbers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Basic &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;data structures&lt;/a&gt;, especially &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;lists&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Python &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt; and constants&lt;/li&gt;
&lt;li&gt;Python &lt;a href=&quot;https://realpython.com/python-operators-expressions/#comparison-operators&quot;&gt;comparison operators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-boolean/&quot;&gt;Boolean values&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-operators-expressions/#logical-operators&quot;&gt;logical expressions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;Conditional&lt;/a&gt; statements&lt;/li&gt;
&lt;li&gt;Python &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;The basics of &lt;a href=&quot;https://realpython.com/python-input-output/&quot;&gt;input, output&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-string-formatting/&quot;&gt;string formatting&lt;/a&gt; in Python&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you don’t have all of the prerequisite knowledge before starting this coding adventure, then that’s okay! You might learn more by going ahead and getting started! You can always stop and review the resources linked here if you get stuck.&lt;/p&gt;
&lt;h2 id=&quot;step-1-code-the-tui-of-your-python-dice-rolling-app&quot;&gt;Step 1: Code the TUI of Your Python Dice-Rolling App&lt;a class=&quot;headerlink&quot; href=&quot;#step-1-code-the-tui-of-your-python-dice-rolling-app&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this step, you’ll write the required code to ask for the user’s input of how many dice they want to roll in the simulation. You’ll also code a Python function that takes the user’s input, validates it, and returns it as an integer number if the validation was successful. Otherwise, the function will ask for the user’s input again.&lt;/p&gt;
&lt;p&gt;To download the code for this step, click the following link and navigate to the &lt;code&gt;source_code_step_1/&lt;/code&gt; folder:&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/python-dice-roll-project-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-dice-roll-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 your Python dice-rolling app.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-dice-roll/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-dice-roll/ »&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>Starting With Python IDLE</title>
      <id>https://realpython.com/courses/starting-python-idle/</id>
      <link href="https://realpython.com/courses/starting-python-idle/"/>
      <updated>2022-01-18T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to use the development environment included with your Python installation. Python IDLE is a small program that packs a big punch!  You&#x27;ll learn how to use Python IDLE to interact with Python directly, work with Python files, and improve your development workflow.</summary>
      <content type="html">
        &lt;p&gt;If you&amp;rsquo;ve recently downloaded Python onto your computer, then you may have noticed a new program on your machine called &lt;strong&gt;IDLE&lt;/strong&gt;. You might be wondering, &amp;ldquo;What is this program doing on my computer? I didn&amp;rsquo;t download that!&amp;rdquo; While you may not have downloaded this program on your own, IDLE comes bundled with every Python installation. It&amp;rsquo;s there to help you get started with the language right out of the box. In this course, you&amp;rsquo;ll learn how to work in Python IDLE and a few cool tricks you can use on your Python journey!&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 Python IDLE is&lt;/li&gt;
&lt;li&gt;How to interact with Python directly using IDLE&lt;/li&gt;
&lt;li&gt;How to edit, execute, and debug Python files with IDLE&lt;/li&gt;
&lt;li&gt;How to customize Python IDLE to your liking&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 December 2021?</title>
      <id>https://realpython.com/python-news-december-2021/</id>
      <link href="https://realpython.com/python-news-december-2021/"/>
      <updated>2022-01-17T14:00:00+00:00</updated>
      <summary>The Python community elected its fourth steering council in December 2021. In this article, you&#x27;ll catch up on the results of the election as well as news about new maintenance releases of Python and about end-of-life for Python 3.6.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In &lt;strong&gt;December 2021&lt;/strong&gt;, the fourth Python &lt;strong&gt;steering council&lt;/strong&gt; was elected, as usual with a mix of new and returning members. Python’s release-cycle circle of life kept spinning, with new iterations of both &lt;strong&gt;Python 3.10&lt;/strong&gt; and the upcoming &lt;strong&gt;Python 3.11&lt;/strong&gt; released. At the same time, the popular &lt;strong&gt;Python 3.6&lt;/strong&gt; reached end-of-life and will no longer be supported.&lt;/p&gt;
&lt;p&gt;Amid this flurry of activity, developers from all over had some fun over the holidays by solving the annual &lt;strong&gt;Advent of Code&lt;/strong&gt; puzzles. &lt;/p&gt;
&lt;p&gt;Let’s dive into the biggest &lt;strong&gt;Python news&lt;/strong&gt; 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-steering-council-elections&quot;&gt;Python Steering Council Elections&lt;a class=&quot;headerlink&quot; href=&quot;#python-steering-council-elections&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/gvanrossum&quot;&gt;Guido van Rossum&lt;/a&gt; is the creator of Python. For a long time, he was also the &lt;a href=&quot;https://en.wikipedia.org/wiki/Benevolent_dictator_for_life&quot;&gt;&lt;strong&gt;Benevolent Dictator For Life (BDFL)&lt;/strong&gt;&lt;/a&gt; of the language, in charge of overseeing all changes that were implemented.&lt;/p&gt;
&lt;p&gt;During the summer of 2018, Guido &lt;a href=&quot;https://mail.python.org/pipermail/python-committers/2018-July/005664.html&quot;&gt;resigned&lt;/a&gt; as BDFL and asked the community to come up with a new model for governance of the language. After some &lt;a href=&quot;https://www.python.org/dev/peps/pep-8000/&quot;&gt;discussion&lt;/a&gt;, the community decided that a &lt;a href=&quot;https://www.python.org/dev/peps/pep-0013/&quot;&gt;steering council&lt;/a&gt; should be elected to direct the development of Python.&lt;/p&gt;
&lt;p&gt;A new steering council is elected regularly, more or less coinciding with each release of Python. The terms are therefore often labeled by the corresponding version of Python that will be released during that term. The most recent election, for the Python 3.11 term, was held in the first half of December, with the final results announced on December 17.&lt;/p&gt;
&lt;p&gt;Since the first steering council was elected in January 2019, the following members have served:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Barry Warsaw&lt;/strong&gt; (3.8, 3.9, 3.10)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Brett Cannon&lt;/strong&gt; (3.8, 3.9, 3.10)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Carol Willing&lt;/strong&gt; (3.8, 3.9, 3.10)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Guido van Rossum&lt;/strong&gt; (3.8)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Nick Coghlan&lt;/strong&gt; (3.8)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pablo Galindo Salgado&lt;/strong&gt; (3.10)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Thomas Wouters&lt;/strong&gt; (3.9, 3.10)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Victor Stinner&lt;/strong&gt; (3.9)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-december-2021/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-december-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 #93: Launching Python, Virtual Environments, and Locking Dependencies With Brett Cannon</title>
      <id>https://realpython.com/podcasts/rpp/93/</id>
      <link href="https://realpython.com/podcasts/rpp/93/"/>
      <updated>2022-01-14T12:00:00+00:00</updated>
      <summary>Would you like a simple command to launch your Python programs using the newest version of the language installed on your machine? This week on the show, we continue our conversation with Brett Cannon. Brett discusses his project, the Python Launcher for Unix.</summary>
      <content type="html">
        &lt;p&gt;Would you like a simple command to launch your Python programs using the newest version of the language installed on your machine? This week on the show, we continue our conversation with Brett Cannon. Brett discusses his project, the Python Launcher for Unix.&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>Working With Pipenv</title>
      <id>https://realpython.com/courses/working-with-pipenv/</id>
      <link href="https://realpython.com/courses/working-with-pipenv/"/>
      <updated>2022-01-11T14:00:00+00:00</updated>
      <summary>Pipenv is a packaging tool for Python that solves some common problems associated with the typical workflow using pip, virtualenv, and requirements.txt. In this course, you&#x27;ll go over what problems Pipenv solves and how to manage your Python dependencies with it.</summary>
      <content type="html">
        &lt;p&gt;Managing multiple Python projects with their own third-party packages can get complicated. It is best practice to use a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt; to sandbox the requirements for each of your &lt;a href=&quot;https://realpython.com/intermediate-python-project-ideas/&quot;&gt;projects&lt;/a&gt;. Enter &lt;code&gt;pipenv&lt;/code&gt;, the &lt;a href=&quot;https://packaging.python.org/tutorials/managing-dependencies/#managing-dependencies&quot;&gt;official recommended package management tool for Python&lt;/a&gt;. It handles both installation and virtual environments to help you &lt;a href=&quot;https://realpython.com/courses/managing-python-dependencies/&quot;&gt;manage your Python dependencies&lt;/a&gt;.&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;How to use &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt; to &lt;strong&gt;install a package&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Where Python puts packages by &lt;strong&gt;default&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to use &lt;a href=&quot;https://docs.pipenv.org/&quot;&gt;&lt;code&gt;pipenv&lt;/code&gt;&lt;/a&gt; to create &lt;strong&gt;virtual environments&lt;/strong&gt; and install packages&lt;/li&gt;
&lt;li&gt;How &lt;code&gt;pipenv&lt;/code&gt; handles &lt;strong&gt;package conflicts&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 #92: Continuing to Unravel Python&#x27;s Syntactic Sugar With Brett Cannon</title>
      <id>https://realpython.com/podcasts/rpp/92/</id>
      <link href="https://realpython.com/podcasts/rpp/92/"/>
      <updated>2022-01-07T12:00:00+00:00</updated>
      <summary>A year ago, we had Brett Cannon on the show to discuss his blog series about unravelling Python&#x27;s syntactic sugar. Brett has written 15 more entries in the series, and he returns to the show this week to continue our conversation. We dive into unravelling &#x27;async&#x27; and &#x27;await&#x27; statements and their relationship with Python&#x27;s generators.</summary>
      <content type="html">
        &lt;p&gt;A year ago, we had Brett Cannon on the show to discuss his blog series about unravelling Python&#x27;s syntactic sugar. Brett has written 15 more entries in the series, and he returns to the show this week to continue our conversation. We dive into unravelling &#x27;async&#x27; and &#x27;await&#x27; statements and their relationship with Python&#x27;s generators.&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>Deploy Your Python Script on the Web With Flask</title>
      <id>https://realpython.com/courses/deploy-python-script-web-flask/</id>
      <link href="https://realpython.com/courses/deploy-python-script-web-flask/"/>
      <updated>2022-01-04T14:00:00+00:00</updated>
      <summary>In this course, you’ll learn how to go from a local Python script to a fully deployed Flask web application that you can share with the world.</summary>
      <content type="html">
        &lt;p&gt;You wrote a Python script that you&amp;rsquo;re proud of, and now you want to show it off to the world. But &lt;em&gt;how&lt;/em&gt;? Most people won&amp;rsquo;t know what to do with your &lt;code&gt;.py&lt;/code&gt; file. Converting your script into a &lt;strong&gt;Python web application&lt;/strong&gt; is a great solution to make your code usable for a broad audience.&lt;/p&gt;
&lt;p&gt;In this course, you&amp;rsquo;ll learn how to go from a local Python script to a fully deployed Flask web application that you can share with the world.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll know:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;strong&gt;web applications&lt;/strong&gt; are and how you can &lt;strong&gt;host&lt;/strong&gt; them online&lt;/li&gt;
&lt;li&gt;How to convert a Python script into a &lt;strong&gt;Flask web application&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to improve user experience by &lt;strong&gt;adding HTML&lt;/strong&gt; to your Python code&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;deploy&lt;/strong&gt; your Python web application to &lt;strong&gt;Google App Engine&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 #91: 2021 Real Python Articles Wrap Up</title>
      <id>https://realpython.com/podcasts/rpp/91/</id>
      <link href="https://realpython.com/podcasts/rpp/91/"/>
      <updated>2021-12-24T12:00:00+00:00</updated>
      <summary>It&#x27;s been a year of change at Real Python! The Real Python team has written, edited, curated, illustrated, and produced a mountain of Python articles this year. We also added many new members to the team, updated the site&#x27;s features, and created new styles of tutorials and projects.</summary>
      <content type="html">
        &lt;p&gt;It&#x27;s been a year of change at Real Python! The Real Python team has written, edited, curated, illustrated, and produced a mountain of Python articles this year. We also added many new members to the team, updated the site&#x27;s features, and created new styles of tutorials 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>Raising and Handling Python Exceptions</title>
      <id>https://realpython.com/courses/raising-handling-exceptions/</id>
      <link href="https://realpython.com/courses/raising-handling-exceptions/"/>
      <updated>2021-12-21T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn what an exception is and how it differs from a syntax error. You&#x27;ll learn about raising exceptions, making assertions, and catching exceptions to change the control flow of your program using the try, except, else, and finally keywords.</summary>
      <content type="html">
        &lt;p&gt;A Python program terminates as soon as it encounters an error. In Python, an error can be a syntax error or an exception.&lt;/p&gt;
&lt;p&gt;In this course, you&amp;rsquo;ll learn what an exception is and how it differs from a syntax error. After that, you&amp;rsquo;ll learn about raising exceptions and making assertions. Then, you&amp;rsquo;ll learn how to catch exceptions to prevent your program from unintentionally ending and to change the control flow of your program:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/try_except_else_finally.a7fac6c36c55.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/try_except_else_finally.a7fac6c36c55.png&quot; width=&quot;1394&quot; height=&quot;1000&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/try_except_else_finally.a7fac6c36c55.png&amp;amp;w=348&amp;amp;sig=e907487d269c5621117a71262eea6f12581c93de 348w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/try_except_else_finally.a7fac6c36c55.png&amp;amp;w=697&amp;amp;sig=6903754041189bdc1e28fbb3f1ab9b454c0214d1 697w, https://files.realpython.com/media/try_except_else_finally.a7fac6c36c55.png 1394w&quot; sizes=&quot;75vw&quot; alt=&quot;Diagram explaining try except else finally statements&quot; data-asset=&quot;398&quot;/&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;You&amp;rsquo;ll learn about the basic use of a &lt;code&gt;try&lt;/code&gt; &amp;hellip; &lt;code&gt;except&lt;/code&gt; block, as well as how to extend it using &lt;code&gt;else&lt;/code&gt; and &lt;code&gt;finally&lt;/code&gt;.&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;Differentiate exceptions from &lt;strong&gt;syntax errors&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use the &lt;strong&gt;&lt;code&gt;assert&lt;/code&gt;&lt;/strong&gt; keyword to check if a certain condition is met&lt;/li&gt;
&lt;li&gt;Write &lt;strong&gt;custom exceptions&lt;/strong&gt; that subclass &lt;code&gt;Exception&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Catch exceptions with a &lt;strong&gt;&lt;code&gt;try&lt;/code&gt;&lt;/strong&gt; &amp;hellip; &lt;strong&gt;&lt;code&gt;except&lt;/code&gt;&lt;/strong&gt; block&lt;/li&gt;
&lt;li&gt;Use the additional keywords &lt;strong&gt;&lt;code&gt;else&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;finally&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Catch &lt;strong&gt;built-in&lt;/strong&gt; exceptions&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 #90: A Python Journey: Cyber Security, Automating AWS, and TDD</title>
      <id>https://realpython.com/podcasts/rpp/90/</id>
      <link href="https://realpython.com/podcasts/rpp/90/"/>
      <updated>2021-12-17T12:00:00+00:00</updated>
      <summary>The Python community continually grows, with many users coming from different languages and backgrounds. This week on the show, we talk with developer Hugh Tipping about his Python journey. Hugh is also a member of the Real Python community.</summary>
      <content type="html">
        &lt;p&gt;The Python community continually grows, with many users coming from different languages and backgrounds. This week on the show, we talk with developer Hugh Tipping about his Python journey. Hugh is also a member of the Real Python community.&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>Host Your Django Project on Heroku</title>
      <id>https://realpython.com/courses/host-your-django-project-on-heroku/</id>
      <link href="https://realpython.com/courses/host-your-django-project-on-heroku/"/>
      <updated>2021-12-14T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to host your Django project in the cloud for free and with little hassle. You&#x27;ll use Heroku, which takes the burden of infrastructure management off your shoulders.</summary>
      <content type="html">
        &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&amp;rsquo;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&amp;rsquo;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&amp;rsquo;ll want a hosting service that&amp;rsquo;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&amp;rsquo;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&amp;rsquo;re going to explore &lt;a href=&quot;https://www.heroku.com/&quot;&gt;Heroku&lt;/a&gt; in this course. It ticks all the boxes&amp;mdash;it&amp;rsquo;s free, quick to set up, user-friendly, and well-integrated with Django&amp;mdash;and is the favorite cloud platform provider of many startups.&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;Sign up for a free &lt;strong&gt;Heroku account&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use the &lt;strong&gt;Heroku CLI&lt;/strong&gt; (command-line interface)&lt;/li&gt;
&lt;li&gt;Bootstrap a minimal &lt;strong&gt;Django project&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Integrate &lt;strong&gt;Git&lt;/strong&gt; with Heroku&lt;/li&gt;
&lt;li&gt;Connect to Heroku&amp;rsquo;s &lt;strong&gt;PostgreSQL&lt;/strong&gt; database&lt;/li&gt;
&lt;li&gt;Manage &lt;strong&gt;configuration&lt;/strong&gt;, make new &lt;strong&gt;releases&lt;/strong&gt; and &lt;strong&gt;rollbacks&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 #89: Solving Advent of Code Puzzles With Python</title>
      <id>https://realpython.com/podcasts/rpp/89/</id>
      <link href="https://realpython.com/podcasts/rpp/89/"/>
      <updated>2021-12-10T12:00:00+00:00</updated>
      <summary>Are you ready to break open the first days of puzzles from the annual Advent of Code challenge? Advent of Code is an advent calendar of twenty-five programming puzzles published each December. Practicing solving puzzles is a great way to build your Python skills. This week on the show, we have previous guest and Real Python author Geir Arne Hjelle to discuss his recent article titled, &quot;Advent of Code: Solving Your Puzzles With Python.&quot;</summary>
      <content type="html">
        &lt;p&gt;Are you ready to break open the first days of puzzles from the annual Advent of Code challenge? Advent of Code is an advent calendar of twenty-five programming puzzles published each December. Practicing solving puzzles is a great way to build your Python skills. This week on the show, we have previous guest and Real Python author Geir Arne Hjelle to discuss his recent article titled, &quot;Advent of Code: Solving Your Puzzles With 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>Binary, Bytes, and Bitwise Operators in Python</title>
      <id>https://realpython.com/courses/binary-bytes-bitwise-operators/</id>
      <link href="https://realpython.com/courses/binary-bytes-bitwise-operators/"/>
      <updated>2021-12-07T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to use Python&#x27;s bitwise operators to manipulate individual bits of data at the most granular level. With the help of hands-on examples, you&#x27;ll see how you can apply bitmasks and overload bitwise operators to control binary data in your code.</summary>
      <content type="html">
        &lt;p&gt;Computers store all kinds of information as a stream of binary digits called &lt;strong&gt;bits&lt;/strong&gt;. Whether you&amp;rsquo;re working with text, images, or videos, they all boil down to ones and zeros. Python&amp;rsquo;s &lt;strong&gt;bitwise operators&lt;/strong&gt; let you manipulate those individual bits of data at the most granular level.&lt;/p&gt;
&lt;p&gt;Python isolates you from the underlying bits with high-level abstractions. You&amp;rsquo;re more likely to find the &lt;a href=&quot;https://realpython.com/operator-function-overloading/&quot;&gt;overloaded&lt;/a&gt; flavors of bitwise operators in practice. But when you work with them in their original form, you&amp;rsquo;ll be surprised by their quirks!&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;Read &lt;strong&gt;binary&lt;/strong&gt; numbers &lt;/li&gt;
&lt;li&gt;Perform &lt;strong&gt;bitwise math&lt;/strong&gt; and read truth tables&lt;/li&gt;
&lt;li&gt;Represent &lt;strong&gt;fixed and arbitrary precision itegers&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Perform &lt;strong&gt;bitwise operations&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;bitmasks&lt;/strong&gt; to pack information on a single byte&lt;/li&gt;
&lt;li&gt;Differentiate &lt;strong&gt;Big-Endian and Little-Endian&lt;/strong&gt; byte orders&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Overload&lt;/strong&gt; Python bitwise operators in custom data types&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  

</feed>
