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

  
    <entry>
      <title>Serialize Your Data With Python</title>
      <id>https://realpython.com/python-serialize-data/</id>
      <link href="https://realpython.com/python-serialize-data/"/>
      <updated>2023-12-04T14:00:00+00:00</updated>
      <summary>In this in-depth tutorial, you&#x27;ll explore the world of data serialization in Python. You&#x27;ll compare and use different data serialization formats, serialize Python objects and executable code, and handle HTTP message payloads.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Whether you’re a data scientist crunching &lt;strong&gt;big data&lt;/strong&gt; in a distributed cluster, a back-end engineer building scalable &lt;strong&gt;microservices&lt;/strong&gt;, or a front-end developer consuming &lt;strong&gt;web APIs&lt;/strong&gt;, you should understand data serialization. In this comprehensive guide, you’ll move beyond XML and JSON to explore several data formats that you can use to serialize data in Python. You’ll explore them based on their use cases, learning about their distinct categories.&lt;/p&gt;
&lt;p&gt;By the end of this tutorial, you’ll have a deep understanding of the many data interchange formats available. You’ll master the ability to persist and transfer stateful objects, effectively making them immortal and transportable through time and space. Finally, you’ll learn to send executable code over the network, unlocking the potential of remote computation and distributed processing.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Choose a suitable &lt;strong&gt;data serialization format&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Take snapshots of &lt;strong&gt;stateful Python objects&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Send &lt;strong&gt;executable code&lt;/strong&gt; over the wire for &lt;strong&gt;distributed processing&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Adopt popular data formats for &lt;strong&gt;HTTP message payloads&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Serialize &lt;strong&gt;hierarchical&lt;/strong&gt;, &lt;strong&gt;tabular&lt;/strong&gt;, and other &lt;strong&gt;shapes of data&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Employ &lt;strong&gt;schemas&lt;/strong&gt; for validating and evolving the structure of data&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should have a good understanding of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt; principles, including &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-data-classes/&quot;&gt;data classes&lt;/a&gt;, as well as &lt;a href=&quot;https://realpython.com/python-type-checking/&quot;&gt;type hinting&lt;/a&gt; in Python. Additionally, familiarity with the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTTP&quot;&gt;HTTP protocol&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/learning-paths/become-python-web-developer/&quot;&gt;Python web frameworks&lt;/a&gt; would be a plus. This knowledge will make it easier for you to follow along with the tutorial.&lt;/p&gt;
&lt;p&gt;You can download all the code samples accompanying this tutorial by clicking the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-serialize-data-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-serialize-data-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to serialize your data with Python.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Feel free to skip ahead and focus on the part that interests you the most, or buckle up and get ready to catapult your data management skills to a whole new level!&lt;/p&gt;
&lt;h2 id=&quot;get-an-overview-of-data-serialization&quot;&gt;Get an Overview of Data Serialization&lt;a class=&quot;headerlink&quot; href=&quot;#get-an-overview-of-data-serialization&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Serialization&lt;/strong&gt;, also known as &lt;strong&gt;marshaling&lt;/strong&gt;, is the process of translating a piece of data into an interim representation that’s suitable for &lt;a href=&quot;https://en.wikipedia.org/wiki/Data_communication&quot;&gt;transmission&lt;/a&gt; through a network or &lt;a href=&quot;https://en.wikipedia.org/wiki/Persistence_(computer_science)&quot;&gt;persistent storage&lt;/a&gt; on a medium like an optical disk. Because the serialized form isn’t useful on its own, you’ll eventually want to restore the original data. The inverse operation, which can occur on a remote machine, is called &lt;strong&gt;deserialization&lt;/strong&gt; or &lt;strong&gt;unmarshaling&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; Although the terms &lt;a href=&quot;https://en.wikipedia.org/wiki/Serialization&quot;&gt;serialization&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Marshalling_(computer_science)&quot;&gt;marshaling&lt;/a&gt; are often used interchangeably, they can have slightly different meanings for different people. In some circles, serialization is only concerned with the translation part, while marshaling is also about moving data from one place to another.&lt;/p&gt;
&lt;p&gt;The precise meaning of each term depends on whom you ask. For example, Java programmers tend to use the word &lt;em&gt;marshaling&lt;/em&gt; in the context of &lt;a href=&quot;https://en.wikipedia.org/wiki/Java_remote_method_invocation&quot;&gt;remote method invocation (RMI)&lt;/a&gt;. In Python, marshaling refers almost exclusively to the format used for storing the compiled &lt;a href=&quot;https://en.wikipedia.org/wiki/Bytecode&quot;&gt;bytecode&lt;/a&gt; instructions.&lt;/p&gt;
&lt;p&gt;Check out the &lt;a href=&quot;https://en.wikipedia.org/wiki/Marshalling_(computer_science)#Comparison_with_serialization&quot;&gt;comparison of serialization and marshaling&lt;/a&gt; on Wikipedia for more details.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The name &lt;em&gt;serialization&lt;/em&gt; implies that your data, which may be structured as a dense graph of objects in the computer’s memory, becomes a linear sequence—or a &lt;strong&gt;series&lt;/strong&gt;—of &lt;a href=&quot;https://en.wikipedia.org/wiki/Byte&quot;&gt;bytes&lt;/a&gt;. Such a linear representation is perfect to transmit or store. Raw bytes are universally understood by various programming languages, operating systems, and hardware architectures, making it possible to exchange data between otherwise incompatible systems.&lt;/p&gt;
&lt;p&gt;When you visit an online store using your web browser, chances are it runs a piece of &lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt; code in the background to communicate with a back-end system. That back end might be implemented in &lt;a href=&quot;https://realpython.com/learning-paths/flask-by-example/&quot;&gt;Flask&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/learning-paths/django-web-development/&quot;&gt;Django&lt;/a&gt;, or &lt;a href=&quot;https://realpython.com/fastapi-python-web-apis/&quot;&gt;FastAPI&lt;/a&gt;, which are Python web frameworks. Because JavaScript and Python are two different languages with distinct syntax and data types, they must share information using an interchange format that both sides can understand.&lt;/p&gt;
&lt;p&gt;In other words, parties on opposite ends of a digital conversation may deserialize the same piece of information into wildly different internal representations due to their technical constraints and specifications. However, it would still be the same information from a semantic point of view.&lt;/p&gt;
&lt;p&gt;Tools like &lt;a href=&quot;https://nodejs.org/en&quot;&gt;Node.js&lt;/a&gt; make it possible to run JavaScript on the back end, including &lt;a href=&quot;https://en.wikipedia.org/wiki/Isomorphic_JavaScript&quot;&gt;isomorphic JavaScript&lt;/a&gt; that can run on both the client and the server in an unmodified form. This eliminates language discrepancies altogether but doesn’t address more subtle nuances, such as &lt;a href=&quot;https://realpython.com/python-bitwise-operators/#big-endian-vs-little-endian&quot;&gt;big-endian vs little-endian&lt;/a&gt; differences in hardware.&lt;/p&gt;
&lt;p&gt;Other than that, transporting data from one machine to another still requires converting it into a network-friendly format. Specifically, the format should allow the sender to partition and put the data into &lt;a href=&quot;https://en.wikipedia.org/wiki/Network_packet&quot;&gt;network packets&lt;/a&gt;, which the receiving machine can later correctly reassemble. Network protocols are fairly low-level, so they deal with streams of bytes rather than high-level data types.&lt;/p&gt;
&lt;p&gt;Depending on your use case, you’ll want to pick a &lt;strong&gt;data serialization format&lt;/strong&gt; that offers the best trade-off between its pros and cons. In the next section, you’ll learn about various categories of data formats used in serialization. If you already have prior knowledge about these formats and would like to explore their respective scenarios, then feel free to skip the basic introduction coming up next.&lt;/p&gt;
&lt;h2 id=&quot;compare-data-serialization-formats&quot;&gt;Compare Data Serialization Formats&lt;a class=&quot;headerlink&quot; href=&quot;#compare-data-serialization-formats&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are many ways to classify data serialization formats. Some of these categories aren’t mutually exclusive, making certain formats fall under a few of them simultaneously. In this section, you’ll find an overview of the different categories, their trade-offs, and use cases, as well as examples of popular data serialization formats.&lt;/p&gt;
&lt;p&gt;Later, you’ll get your hands on some practical applications of these data serialization formats under different programming scenarios. To follow along, download the sample code mentioned in the introduction and install the required dependencies from the included &lt;code&gt;requirements.txt&lt;/code&gt; file into an active &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt; by issuing the following command:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight sh highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-r&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;requirements.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will install several third-party libraries, frameworks, and tools that will allow you to navigate through the remaining part of this tutorial smoothly.&lt;/p&gt;
&lt;h3 id=&quot;textual-vs-binary&quot;&gt;Textual vs Binary&lt;a class=&quot;headerlink&quot; href=&quot;#textual-vs-binary&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;At the end of the day, all serialized data becomes a stream of bytes regardless of its original shape or form. But some byte values—or their specific arrangement—may correspond to &lt;a href=&quot;https://en.wikipedia.org/wiki/Code_point&quot;&gt;Unicode code points&lt;/a&gt; with a meaningful and human-readable representation. Data serialization formats whose syntax consists purely of characters visible to the naked eye are called &lt;strong&gt;textual data formats&lt;/strong&gt;, as opposed to &lt;strong&gt;binary data formats&lt;/strong&gt; meant for machines to read.&lt;/p&gt;
&lt;p&gt;The main benefit of a textual data format is that people like you can read serialized messages, make sense of them, and even edit them by hand when needed. In many cases, these data formats are self-explanatory, with descriptive element or attribute names. For example, take a look at this excerpt from the Real Python &lt;a href=&quot;https://en.wikipedia.org/wiki/Web_feed&quot;&gt;web feed&lt;/a&gt; with information about the latest tutorials and courses published:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-serialize-data/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-serialize-data/ »&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 #182: Building a Python JSON Parser &amp; Discussing Ideas for PEPs</title>
      <id>https://realpython.com/podcasts/rpp/182/</id>
      <link href="https://realpython.com/podcasts/rpp/182/"/>
      <updated>2023-12-01T12:00:00+00:00</updated>
      <summary>Have you thought of a way to improve the Python language? How do you share your idea with core developers and start a discussion in the Python community? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you thought of a way to improve the Python language? How do you share your idea with core developers and start a discussion in the Python community? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Single and Double Underscores in Python Names</title>
      <id>https://realpython.com/python-double-underscore/</id>
      <link href="https://realpython.com/python-double-underscore/"/>
      <updated>2023-11-29T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn a few Python naming conventions involving single and double underscores (_). You&#x27;ll learn how to use this character to differentiate between public and non-public names in APIs, write safe classes for subclassing purposes, avoid name clashes, and more.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python has a few important &lt;strong&gt;naming conventions&lt;/strong&gt; that are based on using either a single or double &lt;strong&gt;underscore&lt;/strong&gt; character (&lt;code&gt;_&lt;/code&gt;). These conventions allow you to differentiate between public and non-public names in APIs, write safe classes for subclassing purposes, avoid name clashes, and more.&lt;/p&gt;
&lt;p&gt;Following and respecting these conventions allows you to write code that looks Pythonic and consistent in the eyes of other Python developers. This skill is especially useful when you’re writing code that’s intended for other developers to work with.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learn about Python &lt;strong&gt;naming conventions&lt;/strong&gt; that rely on using &lt;strong&gt;underscores&lt;/strong&gt; (&lt;code&gt;_&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Differentiate &lt;strong&gt;public&lt;/strong&gt; and &lt;strong&gt;non-public&lt;/strong&gt; names by using a single leading underscore&lt;/li&gt;
&lt;li&gt;Use double leading underscores to leverage &lt;strong&gt;name mangling&lt;/strong&gt; in Python classes&lt;/li&gt;
&lt;li&gt;Explore other &lt;strong&gt;common uses&lt;/strong&gt; of underscores in Python names&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should be familiar with Python &lt;a href=&quot;https://realpython.com/python-use-global-variable-in-function/&quot;&gt;variables&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-constants/&quot;&gt;constants&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-modules-packages/&quot;&gt;modules&lt;/a&gt;, and especially &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&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;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-double-underscore-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-double-underscore-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to use single and double underscores in Python names.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;public-interfaces-and-naming-conventions-in-python&quot;&gt;Public Interfaces and Naming Conventions in Python&lt;a class=&quot;headerlink&quot; href=&quot;#public-interfaces-and-naming-conventions-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;As a Python programmer, you’ll frequently work with &lt;strong&gt;public interfaces&lt;/strong&gt;, or &lt;a href=&quot;https://en.wikipedia.org/wiki/API&quot;&gt;application programming interfaces (API)&lt;/a&gt;. An API is a type of programming interface that offers a service to other parts of a program or other programs.&lt;/p&gt;
&lt;p&gt;For example, the Python &lt;a href=&quot;https://docs.python.org/3/library/index.html&quot;&gt;standard library&lt;/a&gt; has many &lt;a href=&quot;https://realpython.com/python-modules-packages/&quot;&gt;modules and packages&lt;/a&gt; that provide certain services. To use these modules and packages, you need to access their &lt;em&gt;public&lt;/em&gt; components, such as classes, functions, variables, constants, and modules. All these objects are part of the module or package’s public interface. They’re available for you to use directly in your code.&lt;/p&gt;
&lt;p&gt;However, many of these packages and modules define objects that aren’t intended for direct access. These objects are for the internal use of the specific package or module only. They’re not part of its public interface.&lt;/p&gt;
&lt;p&gt;In the context of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;, languages like &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; have the notion of &lt;strong&gt;public&lt;/strong&gt; and &lt;strong&gt;private&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/python-classes/#providing-behavior-with-methods&quot;&gt;methods&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-classes/#attaching-data-to-classes-and-instances&quot;&gt;attributes&lt;/a&gt;. In these languages, you can use these types of class members as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Public&lt;/strong&gt;: You can use them in your own code or client code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Private&lt;/strong&gt;: You can use them only from inside the defining class and its subclasses.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These languages have specific keywords and syntax to define public and private members in their classes. Once you declare a member as private, you can’t use it outside the class because the language restricts access. So, private members aren’t part of the class’s public interface, and there’s no way to access them.&lt;/p&gt;
&lt;p&gt;In contrast, Python doesn’t have the notion of public and private members. It has neither dedicated &lt;a href=&quot;https://realpython.com/python-keywords/&quot;&gt;keywords&lt;/a&gt; nor syntax for defining them. So, you can always access the members of a Python class.&lt;/p&gt;
&lt;p&gt;If Python doesn’t have a specific syntax to define when an object is part of a public interface, then how do you tell your users that they &lt;em&gt;can&lt;/em&gt; or &lt;em&gt;can’t&lt;/em&gt; use a given class, method, function, variable, constant, or even module in their code?&lt;/p&gt;
&lt;p&gt;To approach this question, the Python community has well-established &lt;strong&gt;naming conventions&lt;/strong&gt;. You should observe these naming conventions to explicitly indicate whether other developers should directly use your variables, constants, functions, methods, and modules in external code.&lt;/p&gt;
&lt;p&gt;Note that the naming conventions don’t restrict access to objects. They’re just a warning to other developers using your code. Because of this, Python doesn’t use the terms public and private. Instead, it uses the terms &lt;strong&gt;public&lt;/strong&gt; and &lt;strong&gt;non-public&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In Python, if a name starts with a letter in uppercase or lowercase, then you should consider that name public and, therefore, part of the code’s API. In contrast, if a name starts with an underscore character (&lt;code&gt;_&lt;/code&gt;), then you should consider that name non-public, meaning it’s not a part of the code’s API.&lt;/p&gt;
&lt;p&gt;The Python community uses the underscore character (&lt;code&gt;_&lt;/code&gt;) as part of other naming conventions. Here’s a summary of what &lt;a href=&quot;https://peps.python.org/pep-0008/&quot;&gt;PEP 8&lt;/a&gt; says about using this character in names:&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;Convention&lt;/th&gt;
&lt;th&gt;Example&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;Single leading underscore&lt;/td&gt;
&lt;td&gt;&lt;code&gt;_variable&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Indicates that the name is meant for internal use only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Single trailing underscore&lt;/td&gt;
&lt;td&gt;&lt;code&gt;class_&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Avoids naming conflicts with Python keywords and built-in names&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Double leading underscore&lt;/td&gt;
&lt;td&gt;&lt;code&gt;__attribute&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Triggers name mangling in the context of Python classes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Double leading and trailing underscore&lt;/td&gt;
&lt;td&gt;&lt;code&gt;__name__&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Indicates special attributes and methods that Python provides&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Single underscore&lt;/td&gt;
&lt;td&gt;&lt;code&gt;_&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Indicates a temporary or throwaway variable&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Note that only two of these conventions enforce specific Python behaviors. Using double leading underscores triggers &lt;a href=&quot;https://realpython.com/python-pep8/#naming-conventions&quot;&gt;name mangling&lt;/a&gt; in Python classes. You’ll learn more about this behavior in the section on &lt;a href=&quot;#double-leading-underscore-in-classes-pythons-name-mangling&quot;&gt;name mangling&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Additionally, those names with double leading and trailing underscores that are listed in the Python &lt;a href=&quot;https://docs.python.org/3/reference/datamodel.html&quot;&gt;data model&lt;/a&gt; trigger internal behaviors in specific contexts. You’ll also learn more about this topic in the section on &lt;a href=&quot;#dunder-names-in-python&quot;&gt;dunder names in Python&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; Python gives special treatment to the single underscore (&lt;code&gt;_&lt;/code&gt;), but only within &lt;code&gt;match&lt;/code&gt; … &lt;code&gt;case&lt;/code&gt; statements. You’ll learn more about this &lt;a href=&quot;#other-usages-of-underscores-in-python&quot;&gt;later&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In the following section, you’ll learn more about using a single leading underscore when naming your Python objects.&lt;/p&gt;
&lt;h2 id=&quot;single-leading-underscore-in-python-names&quot;&gt;Single Leading Underscore in Python Names&lt;a class=&quot;headerlink&quot; href=&quot;#single-leading-underscore-in-python-names&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/python-double-underscore/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-double-underscore/ »&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>Advent of Code: Solving Puzzles With Python</title>
      <id>https://realpython.com/courses/python-advent-of-code/</id>
      <link href="https://realpython.com/courses/python-advent-of-code/"/>
      <updated>2023-11-28T14:00:00+00:00</updated>
      <summary>Advent of Code is an online advent calendar that shares new programming puzzles each day from December 1 to the 25. In this Code Conversation, you&#x27;ll learn why solving programming puzzles can be beneficial and how you can get started with Advent of Code using Python.</summary>
      <content type="html">
        &lt;p&gt;Advent of Code is an online Advent calendar where you&amp;rsquo;ll find new programming puzzles offered each day from December 1 to 25. While you can solve the puzzles at any time, the excitement when new puzzles unlock is really something special. You can participate in Advent of Code in any programming language&amp;mdash;including Python!&lt;/p&gt;
&lt;p&gt;With the help of this Code Conversation, you&amp;rsquo;ll be ready to start solving puzzles and earning your first gold stars.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What an &lt;strong&gt;online Advent calendar&lt;/strong&gt; is&lt;/li&gt;
&lt;li&gt;How solving puzzles can &lt;strong&gt;advance your programming skills&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How you can &lt;strong&gt;participate&lt;/strong&gt; in Advent of Code&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Advent of Code puzzles are designed to be approachable by anyone with an interest in problem-solving. You don&amp;rsquo;t need a heavy computer science background to participate. Instead, Advent of Code is a great arena for learning new skills and testing out new features of Python.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Python Rich Package: Unleash the Power of Console Text</title>
      <id>https://realpython.com/python-rich-package/</id>
      <link href="https://realpython.com/python-rich-package/"/>
      <updated>2023-11-27T14:00:00+00:00</updated>
      <summary>Rich is a powerful library for constructing text-based user interfaces (TUIs) using Python. With it, you can make your code more readable by pretty-printing complex data structures, and you can make your app more attractive for your user with colored and formatted text, tables, animations, and more.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s Rich package is a tool kit that helps you generate beautifully formatted and highlighted text in the console.
More broadly, it allows you to build an attractive text-based user interface (TUI).&lt;/p&gt;
&lt;p&gt;Why would you choose a TUI over a graphical user interface, or GUI?
Sometimes a text display feels more appropriate. Why use a full-blown GUI for a simple application, when an elegant text interface will do? 
It can be refreshing to work with plain text. Text works in almost any hardware environment, even on an &lt;a href=&quot;https://en.wikipedia.org/wiki/Secure_Shell&quot;&gt;SSH&lt;/a&gt; terminal or a single-board computer display. And many applications don’t need the complexity of a full graphical windowing system.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how Rich can help you:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Enhance the &lt;strong&gt;user interface&lt;/strong&gt; of &lt;strong&gt;command-line tools&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Improve the readability of &lt;strong&gt;console output&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create attractive &lt;strong&gt;dashboard displays&lt;/strong&gt; for real-time tabular data&lt;/li&gt;
&lt;li&gt;Generate &lt;strong&gt;well-formatted reports&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&quot;https://realpython.com/interview-will-mcgugan/&quot;&gt;Will McGugan&lt;/a&gt;, the author of Rich, has also developed the &lt;a href=&quot;https://textual.textualize.io/&quot;&gt;Textual&lt;/a&gt; package. Whereas Rich is a rich-text tool kit, Textual is a full application framework built on Rich. It provides application base classes, an event-driven architecture, and more.&lt;/p&gt;
&lt;p&gt;There’s a lot you can do with Rich on its own, and its support for engaging, dynamic displays may well be sufficient for your app.
By following this tutorial, you’ll experiment with many of the cool features of Rich, and you’ll finish up by using your skills to build a dynamically scrolling tabular display of crypto prices:&lt;/p&gt;
&lt;figure&gt;
  &lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 border&quot;&gt;
    &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/877425433?background=1&quot; frameborder=&quot;0&quot; allow=&quot;fullscreen&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;To fully understand Rich’s syntax for animations, you should have a good grasp of &lt;a href=&quot;https://realpython.com/python-with-statement/&quot;&gt;context managers&lt;/a&gt;. But if you’re a bit rusty, don’t worry! You’ll get a quick refresher in this tutorial.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-rich-package-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-rich-package-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download free sample code&lt;/a&gt; that shows you how to use Rich for more beautiful Python code and apps.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;installing-rich&quot;&gt;Installing Rich&lt;a class=&quot;headerlink&quot; href=&quot;#installing-rich&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can start using Rich very quickly. As always when starting a new project or investigation, it’s best to create a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt; first, to avoid polluting your system’s Python installation.&lt;/p&gt;
&lt;p&gt;It’s quite possible to install Rich and use it with the built-in Python REPL, but for a better developer experience, you may want to include support for &lt;a href=&quot;https://realpython.com/jupyter-notebook-introduction/&quot;&gt;Jupyter notebooks&lt;/a&gt;. Here’s how you can install Rich so that it’ll work with either the REPL or Jupyter:&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;span class=&quot;icon baseline text-muted mr-1&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&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;span class=&quot;icon baseline text-muted&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#v4--apple&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&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;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Windows PowerShell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight pscon highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Scripts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;activate&lt;/span&gt;
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pip&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;rich&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;[jupyter]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/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;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight sh highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv/bin/activate
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;rich[jupyter]&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now that you’ve installed Rich in your new virtual environment, you can test it and also get a nice overview of its capabilities:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight sh highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;rich
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Running this command will make lots of magic happen. Your terminal will fill with color, and you’ll see several options for customizing your text-based user interface:&lt;/p&gt;
&lt;figure&gt;
  &lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 border&quot;&gt;
    &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/877425502?background=1&quot; frameborder=&quot;0&quot; allow=&quot;fullscreen&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;Apart from displaying colorful text in a variety of styles, this demo also illustrates a few more of Rich’s exciting features.&lt;/p&gt;
&lt;p&gt;You can wrap and justify text. You can easily display any Unicode characters, as well as a wide choice of emojis. 
Rich renders Markdown and offers a syntax for creating elegantly formatted tables.&lt;/p&gt;
&lt;p&gt;There’s much more that you can do with Rich, as you’ll discover throughout this tutorial. You can also try some of the command-line demos that Rich has thoughtfully provided for its subpackages, so you can get a flavor of what each one can do without writing any code.&lt;/p&gt;
&lt;p&gt;Here are a few that you can try from your OS console. Execute them one by one to get a feel for the power of Rich:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight sh highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;rich.table
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;rich.progress
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;rich.status
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Most of these demos are very short, but if necessary, you can always interrupt them with &lt;span class=&quot;keys&quot;&gt;&lt;kbd class=&quot;key-control&quot;&gt;Ctrl&lt;/kbd&gt;&lt;span&gt;+&lt;/span&gt;&lt;kbd class=&quot;key-c&quot;&gt;C&lt;/kbd&gt;&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;With the installation done, you’re ready to start exploring Rich.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-rich-package/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-rich-package/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Build Conway&#x27;s Game of Life With Python</title>
      <id>https://realpython.com/conway-game-of-life-python/</id>
      <link href="https://realpython.com/conway-game-of-life-python/"/>
      <updated>2023-11-22T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll implement Conway&#x27;s Game of Life in Python. To make the game usable, you&#x27;ll create a user-friendly command-line interface (CLI) with several options that will allow you to run the game using different life patterns and configurations.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Wouldn’t it be cool to build a Python game that only requires initial user input and then seems to take on a mind of its own, creating mesmerizing patterns along the way? You can do exactly that with &lt;a href=&quot;https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life&quot;&gt;Conway’s Game of Life&lt;/a&gt;, which is about the evolution of cells in a life grid.&lt;/p&gt;
&lt;p&gt;Implementing the Game of Life algorithm is a good exercise with many interesting challenges that you’ll have to figure out. Specifically, you’ll need to build the life grid and find a way to apply the game’s rules to all the cells on the grid so that they evolve through several generations.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Implement Conway’s &lt;strong&gt;Game of Life algorithm&lt;/strong&gt; with Python&lt;/li&gt;
&lt;li&gt;Build a &lt;strong&gt;&lt;code&gt;curses&lt;/code&gt; view&lt;/strong&gt; to display the Game of Life grid&lt;/li&gt;
&lt;li&gt;Create an &lt;strong&gt;&lt;code&gt;argparse&lt;/code&gt; command-line interface&lt;/strong&gt; for the game&lt;/li&gt;
&lt;li&gt;Set up the game app for &lt;strong&gt;installation&lt;/strong&gt; and &lt;strong&gt;execution&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should know the basics of writing &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented code&lt;/a&gt; in Python, creating command-line interface (CLI) apps with &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/&quot;&gt;&lt;code&gt;argparse&lt;/code&gt;&lt;/a&gt;, and setting up a Python project.&lt;/p&gt;
&lt;p&gt;You can download the complete source code and other resources for this project by clicking the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/conway-game-of-life-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-conway-game-of-life-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the source code&lt;/a&gt; to build Conway’s Game of Life with Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo-conways-game-of-life-with-python&quot;&gt;Demo: Conway’s Game of Life With Python&lt;a class=&quot;headerlink&quot; href=&quot;#demo-conways-game-of-life-with-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll implement &lt;strong&gt;Conway’s Game of Life&lt;/strong&gt; for your command line using Python. Once you’ve run all the steps to build the game, then you’ll end up with a fully working command-line app. &lt;/p&gt;
&lt;p&gt;The demo shows how the app works and walks you through the evolution of multiple life patterns or seeds, which define the game’s initial state and work as starting points for evolving the cells in the life grid:&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/875948923?background=1&quot; frameborder=&quot;0&quot; allow=&quot;fullscreen&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;Throughout this tutorial, you’ll run through several challenges related to the game’s algorithm and also to writing and setting up a command-line application in Python. At the end, you’ll have a Game of Life app that will work like the demo above.&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Game of Life&lt;/strong&gt; by the British mathematician &lt;a href=&quot;https://en.wikipedia.org/wiki/John_Horton_Conway&quot;&gt;John Horton Conway&lt;/a&gt; isn’t a game in the traditional sense. In technical terms, it’s a &lt;a href=&quot;https://en.wikipedia.org/wiki/Cellular_automaton&quot;&gt;cellular automaton&lt;/a&gt;, but you can think of Game of Life as a &lt;strong&gt;simulation&lt;/strong&gt; whose evolution depends on its initial state and doesn’t require further input from any players.&lt;/p&gt;
&lt;p&gt;The game’s board is an infinite, two-dimensional &lt;strong&gt;grid&lt;/strong&gt; of &lt;strong&gt;cells&lt;/strong&gt;. Each cell can be in one of two possible states:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Alive&lt;/li&gt;
&lt;li&gt;Dead&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Each cell evolves to the next &lt;strong&gt;generation&lt;/strong&gt; depending on the state of itself and its neighbor cells. Here’s a summary of the evolution &lt;a href=&quot;https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life#Rules&quot;&gt;rules&lt;/a&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Alive cells die if they have &lt;strong&gt;fewer than two&lt;/strong&gt; (underpopulation) or &lt;strong&gt;more than three&lt;/strong&gt; living neighbors (overpopulation).&lt;/li&gt;
&lt;li&gt;Alive cells stay alive if they have &lt;strong&gt;two or three&lt;/strong&gt; living neighbors.&lt;/li&gt;
&lt;li&gt;Dead cells with &lt;strong&gt;exactly three&lt;/strong&gt; living neighbors become alive (reproduction).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The game’s initial state is the &lt;strong&gt;seed&lt;/strong&gt;, or initial &lt;strong&gt;life pattern&lt;/strong&gt;. In this implementation, the life pattern will be a set of alive cells. The first generation results from applying the above rules to every cell in the seed. The second generation results from applying the rules to the first generation, and so on. So, each generation is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Pure_function&quot;&gt;pure function&lt;/a&gt; of the preceding one.&lt;/p&gt;
&lt;p&gt;The challenge in this project is to program the evolution algorithm in Python and then provide a &lt;a href=&quot;https://en.wikipedia.org/wiki/Command-line_interface&quot;&gt;command-line interface (CLI)&lt;/a&gt; to run the game with different life patterns.&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;The project that you’ll build in this tutorial will require familiarity with general Python programming and especially with object-oriented programming. So, you should have basic knowledge of the following topics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Working with &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;conditional statements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Writing &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt;&lt;/a&gt; loops and &lt;a href=&quot;https://realpython.com/list-comprehension-python/&quot;&gt;comprehensions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Working with Python &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-tuple/&quot;&gt;tuples&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;lists&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-sets/&quot;&gt;sets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Creating regular &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-data-classes/&quot;&gt;data classes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Building command-line interfaces with &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/&quot;&gt;&lt;code&gt;argparse&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Working with &lt;a href=&quot;https://realpython.com/python-toml/&quot;&gt;TOML&lt;/a&gt; files in Python&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;However, if you don’t have all this knowledge yet, then that’s okay! You might learn more by going ahead and giving the project a shot. You can always stop and review the resources linked here if you get stuck.&lt;/p&gt;
&lt;p&gt;With this short overview of your Game of Life project and its prerequisites, you’re ready to start Pythoning. Have fun while coding!&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/conway-game-of-life-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/conway-game-of-life-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>Python Basics Exercises: Modules and Packages</title>
      <id>https://realpython.com/courses/python-modules-packages-exercises/</id>
      <link href="https://realpython.com/courses/python-modules-packages-exercises/"/>
      <updated>2023-11-21T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll practice separating your code into modules, using the import statement to access another module&#x27;s namespace, and creating Python packages.</summary>
      <content type="html">
        &lt;p&gt;In &lt;a href=&quot;https://realpython.com/courses/python-basics-modules-packages/&quot;&gt;Python Basics: Modules and Packages&lt;/a&gt;, you learned how to build an application by putting related code into separate files called &lt;strong&gt;modules&lt;/strong&gt;. You also used the &lt;strong&gt;&lt;code&gt;import&lt;/code&gt; statement&lt;/strong&gt; to use modules in another file.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll practice:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Creating&lt;/strong&gt; your own modules&lt;/li&gt;
&lt;li&gt;Using modules in another file through the &lt;strong&gt;&lt;code&gt;import&lt;/code&gt; statement&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Organizing several modules into a &lt;strong&gt;package&lt;/strong&gt; with &lt;code&gt;__init__.py&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Along the way, you&amp;rsquo;ll also get some insight into how to tackle coding challenges in general, which can be a great way to level up as a developer.&lt;/p&gt;
&lt;p&gt;This video course is part of the Python Basics series, which accompanies &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. You can also check out the other &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics courses&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Note that you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt; throughout this course. If you&amp;rsquo;re just getting started, then you might want to check out &lt;a href=&quot;https://realpython.com/courses/setting-up-python/&quot;&gt;Python Basics: Setting Up Python&lt;/a&gt; before diving into this course.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>How to Render Markdown in a Django Application</title>
      <id>https://realpython.com/django-markdown/</id>
      <link href="https://realpython.com/django-markdown/"/>
      <updated>2023-11-20T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to create and render web content in Django with the simplicity and flexibility of the Markdown text formatting language.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;One of Django’s most popular features is the &lt;a href=&quot;https://docs.djangoproject.com/en/4.2/ref/contrib/admin/&quot;&gt;admin interface&lt;/a&gt;. For developers, it provides an out-of-the-box tool kit to work with your project’s data models. And it gives non-technical administrators an intuitive user interface (UI) for interacting with the database and creating website content. However, the Django admin doesn’t provide a way to format text-based content. Using Markdown with Django is a great solution. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Markdown&lt;/strong&gt; is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Plain_text&quot;&gt;plain text&lt;/a&gt; formatting language that can automatically convert to HTML for publishing on the Web. Due to its accessible syntax and widespread use in static site generators, productivity apps, and content management tools, it’s become a popular alternative to rich-text editors for both technical and non-technical content creators. &lt;/p&gt;
&lt;p&gt;There are also several third-party &lt;em&gt;What You See is What You Get&lt;/em&gt; (&lt;a href=&quot;https://en.wikipedia.org/wiki/WYSIWYG&quot;&gt;WYSIWYG&lt;/a&gt;) editors available for Django. These provide an interface for formatting text by using buttons on a menu bar while writing, similar to a word processor program. Other options include using a content management system such as &lt;a href=&quot;https://wagtail.org&quot;&gt;Wagtail CMS&lt;/a&gt;, or working directly in HTML template files. &lt;/p&gt;
&lt;p&gt;But when used in combination with the Django admin, &lt;a href=&quot;https://daringfireball.net/projects/markdown/&quot;&gt;Markdown&lt;/a&gt; provides a simpler alternative to a full-blown CMS and a friendlier user experience than working with HTML templates for both developers and content authors. &lt;/p&gt;
&lt;p&gt;Many writers find it faster and more straightforward to work with Markdown than a WYSIWYG interface. Plus, there are additional benefits to separating the text and presentation layers of your web content, including increased security, less risk of syntax errors, and the ability to publish across multiple formats, such as email or PDF documents. &lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn how to render Markdown content with Django so that your website’s content creators can take advantage of the simplicity and convenience that have made Markdown such a popular choice for formatting text-based content. This tutorial assumes that you have some prior Django experience, so if you’re totally new to the framework, then you can learn to build your first Django app &lt;a href=&quot;https://realpython.com/get-started-with-django-1/&quot;&gt;here&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;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/django-markdown-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-django-markdown-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to render Markdown in your Django apps.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;how-to-use-markdown-for-content-in-a-django-application&quot;&gt;How to Use Markdown for Content in a Django Application&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-use-markdown-for-content-in-a-django-application&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In a Django application, incorporating Markdown can enhance the content management workflow for users who prefer to format their writing in plain text over a WYSIWYG editor. In this section of the tutorial, you’ll learn how to extend a Django application to allow the creation, management, and rendering of Markdown content. &lt;/p&gt;
&lt;p&gt;You’ll walk through setting up a Django project and app, defining a model to store Markdown content, and creating Django templates to render that content as HTML. Additionally, you’ll explore using Python-Markdown to convert Markdown to HTML within your Django views. &lt;/p&gt;
&lt;p&gt;By the end of this section, you’ll have a fully functional Markdown content management system within your Django application.&lt;/p&gt;
&lt;h3 id=&quot;create-a-django-app-to-display-content&quot;&gt;Create a Django App to Display Content&lt;a class=&quot;headerlink&quot; href=&quot;#create-a-django-app-to-display-content&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To render HTML content written as Markdown with Django, begin by &lt;a href=&quot;https://realpython.com/django-setup/&quot;&gt;creating a new Django project&lt;/a&gt; named &lt;code&gt;dmd_project&lt;/code&gt; inside a Python &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;. You use &lt;code&gt;dmd&lt;/code&gt; as a shorthand for Django Markdown:&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;span class=&quot;icon baseline text-muted mr-1&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&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;span class=&quot;icon baseline text-muted&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#v4--apple&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&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;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Windows PowerShell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight pscon highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;django-markdown&lt;/span&gt;
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;django-admin&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;startproject&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dmd_project&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;django-markdown&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/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;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight sh highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;mkdir&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;django-markdown/
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;django-admin&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;startproject&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;dmd_project&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;django-markdown/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The only dependencies that you’ll need for this tutorial are Django and the &lt;a href=&quot;https://python-markdown.github.io&quot;&gt;Python-Markdown&lt;/a&gt; package, which provides an API for working with Markdown in Python. &lt;a href=&quot;https://python-markdown.github.io/install/&quot;&gt;Install &lt;code&gt;markdown&lt;/code&gt;&lt;/a&gt; into your virtual environment with &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-windows&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body active small&quot; id=&quot;windows-tab-2&quot; data-toggle=&quot;tab&quot; href=&quot;#windows-2&quot; role=&quot;tab&quot; aria-controls=&quot;windows-2&quot; aria-selected=&quot;true&quot;&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&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-2&quot; data-toggle=&quot;tab&quot; href=&quot;#linux-macos-2&quot; role=&quot;tab&quot; aria-controls=&quot;linux-macos-2&quot; aria-selected=&quot;false&quot;&gt;&lt;span class=&quot;icon baseline text-muted&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#v4--apple&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&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-2&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-2&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Windows PowerShell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight pscon highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pip&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;markdown&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-2&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-2&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight sh highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;markdown
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now create a new Django app with the &lt;code&gt;manage.py startapp&lt;/code&gt; command:&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-3&quot; data-toggle=&quot;tab&quot; href=&quot;#windows-3&quot; role=&quot;tab&quot; aria-controls=&quot;windows-3&quot; aria-selected=&quot;true&quot;&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&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-3&quot; data-toggle=&quot;tab&quot; href=&quot;#linux-macos-3&quot; role=&quot;tab&quot; aria-controls=&quot;linux-macos-3&quot; aria-selected=&quot;false&quot;&gt;&lt;span class=&quot;icon baseline text-muted&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#v4--apple&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&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-3&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-3&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Windows PowerShell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight pscon highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;django-markdown&lt;/span&gt;
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;manage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;py&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;startapp&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dmd_app&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-3&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-3&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight sh highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;django-markdown/
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;manage.py&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;startapp&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;dmd_app
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You’ve used the &lt;code&gt;startapp&lt;/code&gt; command to create the &lt;code&gt;dmd_app/&lt;/code&gt; folder, which contains the necessary files for composing that content through the Django admin interface, storing it in your project’s database, and displaying it to users as HTML. Add your new app to the &lt;code&gt;INSTALLED_APPS&lt;/code&gt; setting in your project’s &lt;code&gt;settings.py&lt;/code&gt; file:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit;&quot;&gt;dmd_project/settings.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight python highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;INSTALLED_APPS&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.admin&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.auth&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.contenttypes&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.sessions&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.messages&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.staticfiles&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;dmd_app&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To create a new database table for storing your project’s content, define a &lt;code&gt;MarkdownContent&lt;/code&gt; model in the &lt;code&gt;models.py&lt;/code&gt; file inside your &lt;code&gt;dmd_app/&lt;/code&gt; directory:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit;&quot;&gt;dmd_app/models.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight python highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;django.db&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;MarkdownContent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CharField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;max_length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;models&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TextField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Meta&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;verbose_name_plural&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Markdown content&quot;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fm&quot;&gt;__str__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/django-markdown/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/django-markdown/ »&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 #181: Computational Thinking &amp; Learning Python During an AI Revolution</title>
      <id>https://realpython.com/podcasts/rpp/181/</id>
      <link href="https://realpython.com/podcasts/rpp/181/"/>
      <updated>2023-11-17T12:00:00+00:00</updated>
      <summary>Has the current growth of artificial intelligence (AI) systems made you wonder what the future holds for Python developers? What are the hidden benefits of learning to program in Python and practicing computational thinking? This week on the show, we speak with author Lawrence Gray about his upcoming book &quot;Mastering Python: A Problem Solving Approach.&quot;</summary>
      <content type="html">
        &lt;p&gt;Has the current growth of artificial intelligence (AI) systems made you wonder what the future holds for Python developers? What are the hidden benefits of learning to program in Python and practicing computational thinking? This week on the show, we speak with author Lawrence Gray about his upcoming book &quot;Mastering Python: A Problem Solving Approach.&quot;&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Embeddings and Vector Databases With ChromaDB</title>
      <id>https://realpython.com/chromadb-vector-database/</id>
      <link href="https://realpython.com/chromadb-vector-database/"/>
      <updated>2023-11-15T14:00:00+00:00</updated>
      <summary>Vector databases are a crucial component of many NLP applications. This tutorial will give you hands-on experience with ChromaDB, an open-source vector database that&#x27;s quickly gaining traction. Along the way, you&#x27;ll learn what&#x27;s needed to understand vector databases with practical examples.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The era of &lt;a href=&quot;https://en.wikipedia.org/wiki/Large_language_model&quot;&gt;large language models&lt;/a&gt; (LLMs) is here, bringing with it rapidly evolving libraries like &lt;a href=&quot;https://docs.trychroma.com/&quot;&gt;ChromaDB&lt;/a&gt; that help augment LLM applications. You’ve most likely heard of chatbots like OpenAI’s &lt;a href=&quot;https://realpython.com/chatgpt-coding-mentor-python/&quot;&gt;ChatGPT&lt;/a&gt;, and perhaps you’ve even experienced their remarkable ability to reason about &lt;a href=&quot;https://en.wikipedia.org/wiki/Natural_language_processing&quot;&gt;natural language processing (NLP)&lt;/a&gt; problems.&lt;/p&gt;
&lt;p&gt;Modern LLMs, while imperfect, can accurately solve a wide range of problems and provide correct answers to many questions. But, due to the limits of their training and the number of text tokens they can process, LLMs aren’t a silver bullet for all tasks.&lt;/p&gt;
&lt;p&gt;You wouldn’t expect an LLM to provide relevant responses about topics that don’t appear in their training data. For example, if you asked ChatGPT to summarize information in confidential company documents, then you’d be out of luck. You could show some of these documents to ChatGPT, but there’s a limited number of documents that you can upload before you exceed ChatGPT’s maximum number of tokens. How would you select documents to show ChatGPT?&lt;/p&gt;
&lt;p&gt;To address these shortcomings and scale your LLM applications, one great option is to use a vector database like ChromaDB. A &lt;strong&gt;vector database&lt;/strong&gt; allows you to store encoded unstructured objects, like text, as lists of numbers that you can compare to one another. You can, for example, find a collection of documents relevant to a question that you want an LLM to answer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Representing &lt;strong&gt;unstructured objects&lt;/strong&gt; with &lt;strong&gt;vectors&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Using &lt;strong&gt;word&lt;/strong&gt; and &lt;strong&gt;text embeddings&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Harnessing the power of &lt;strong&gt;vector databases&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Encoding&lt;/strong&gt; and &lt;strong&gt;querying&lt;/strong&gt; over documents with ChromaDB&lt;/li&gt;
&lt;li&gt;Providing &lt;strong&gt;context&lt;/strong&gt; to &lt;strong&gt;LLMs&lt;/strong&gt; like ChatGPT with ChromaDB &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After reading, you’ll have the foundational knowledge to use ChromaDB in your NLP or LLM applications. Before reading, you should be comfortable with the &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;basics of Python&lt;/a&gt; and high school math.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/embeddings-and-vector-databases-with-chromadb-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-embeddings-and-vector-databases-with-chromadb-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download free sample code&lt;/a&gt; that shows you how to use ChromaDB to add context to an LLM.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;represent-data-as-vectors&quot;&gt;Represent Data as Vectors&lt;a class=&quot;headerlink&quot; href=&quot;#represent-data-as-vectors&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Before diving into embeddings and vector databases, you should understand what vectors are and what they represent. Feel free to skip ahead to the next section if you’re already comfortable with vector concepts. If you’re not or if you could use a refresher, then keep reading!&lt;/p&gt;
&lt;h3 id=&quot;vector-basics&quot;&gt;Vector Basics&lt;a class=&quot;headerlink&quot; href=&quot;#vector-basics&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can describe vectors with variable levels of complexity, but one great starting place is to think of a vector as an &lt;a href=&quot;https://realpython.com/numpy-array-programming/#getting-into-shape-intro-to-numpy-arrays&quot;&gt;array&lt;/a&gt; of numbers. For example, you could represent vectors using &lt;a href=&quot;https://realpython.com/numpy-tutorial/&quot;&gt;NumPy&lt;/a&gt; arrays as follows:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight python repl highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;np&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;vector1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&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;vector2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&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;vector1&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;array([1, 0])&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;vector2&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;array([0, 1])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this code block, you import &lt;code&gt;numpy&lt;/code&gt; and create two arrays, &lt;code&gt;vector1&lt;/code&gt; and &lt;code&gt;vector2&lt;/code&gt;, representing vectors. This is one of the most common and useful ways to work with vectors in Python, and &lt;code&gt;NumPy&lt;/code&gt; offers a variety of functionality to manipulate vectors. There are also several other libraries that you can use to work with vector data, such as &lt;a href=&quot;https://realpython.com/pytorch-vs-tensorflow/&quot;&gt;PyTorch&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/pytorch-vs-tensorflow/&quot;&gt;TensorFlow&lt;/a&gt;, &lt;a href=&quot;https://jax.readthedocs.io/en/latest/notebooks/quickstart.html&quot;&gt;JAX&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/polars-python/&quot;&gt;Polars&lt;/a&gt;. You’ll stick with NumPy for this overview.   &lt;/p&gt;
&lt;p&gt;You’ve created two NumPy arrays that represent vectors. Now what? It turns out you can do a lot of cool things with vectors, but before continuing on, you’ll need to understand some key definitions and properties:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dimension&lt;/strong&gt;: The dimension of a vector is the number of elements that it contains. In the example above, &lt;code&gt;vector1&lt;/code&gt; and &lt;code&gt;vector2&lt;/code&gt; are both two-dimensional since they each have two elements. You can only visualize vectors with three dimensions or less, but generally, vectors can have any number of dimensions. In fact, as you’ll see later, vectors that encode words and text tend to have hundreds or thousands of dimensions. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Magnitude&lt;/strong&gt;: The magnitude of a vector is a non-negative number that represents the vector’s size or length. You can also refer to the magnitude of a vector as the &lt;strong&gt;norm&lt;/strong&gt;, and you can denote it with &lt;em&gt;||v||&lt;/em&gt; or &lt;em&gt;|v|&lt;/em&gt;. There are many different definitions of magnitude or norm, but the most common is the &lt;a href=&quot;https://en.wikipedia.org/wiki/Norm_(mathematics)#Euclidean_norm&quot;&gt;Euclidean norm&lt;/a&gt; or 2-norm. You’ll learn how to compute this later.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unit vector&lt;/strong&gt;: A unit vector is a vector with a magnitude of one. In the example above, &lt;code&gt;vector1&lt;/code&gt; and &lt;code&gt;vector2&lt;/code&gt; are unit vectors.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Direction&lt;/strong&gt;: The direction of a vector specifies the line along which the vector points. You can represent direction using angles, unit vectors, or coordinates in different coordinate systems. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dot product (scalar product)&lt;/strong&gt;: The dot product of two vectors, &lt;em&gt;u&lt;/em&gt; and &lt;em&gt;v&lt;/em&gt;, is a number given by &lt;em&gt;u ⋅ v = ||u|| ||v|| cos(θ)&lt;/em&gt;, where &lt;em&gt;θ&lt;/em&gt; is the angle between the two vectors. Another way to compute the dot product is to do an element-wise multiplication of &lt;em&gt;u&lt;/em&gt; and &lt;em&gt;v&lt;/em&gt; and sum the results. The dot product is one of the most important and widely used vector operations because it measures the &lt;strong&gt;similarity&lt;/strong&gt; between two vectors. You’ll see more of this later on.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Orthogonal vectors&lt;/strong&gt;: Vectors are orthogonal if their dot product is zero, meaning that they’re at a 90 degree angle to each other. You can think of orthogonal vectors as being completely unrelated to each other. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dense vector&lt;/strong&gt;: A vector is considered dense if most of its elements are non-zero. Later on, you’ll see that words and text are most usefully represented with dense vectors because each dimension encodes meaningful information. &lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;While there are many more definitions and properties to learn, these six are most important for this tutorial. To solidify these ideas with code, check out the following block. Note that for the rest of this tutorial, you’ll use &lt;code&gt;v1&lt;/code&gt;, &lt;code&gt;v2&lt;/code&gt;, and &lt;code&gt;v3&lt;/code&gt; to name your vectors:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight python repl highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;np&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;v1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&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;v2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&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;v3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sqrt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sqrt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)])&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Dimension&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;v1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(2,)&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Magnitude&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;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sqrt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v1&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;go&quot;&gt;1.0&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;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linalg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;norm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1.0&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;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linalg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;norm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2.0&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Dot product&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;np&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;v1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;@&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;v3&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1.4142135623730951&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You first import &lt;code&gt;numpy&lt;/code&gt; and create the arrays &lt;code&gt;v1&lt;/code&gt;, &lt;code&gt;v2&lt;/code&gt;, and &lt;code&gt;v3&lt;/code&gt;. Calling &lt;code&gt;v1.shape&lt;/code&gt; shows you the &lt;strong&gt;dimension&lt;/strong&gt; of &lt;code&gt;v1&lt;/code&gt;. You then see two different ways to compute the &lt;strong&gt;magnitude&lt;/strong&gt; of a NumPy array. The first, &lt;code&gt;np.sqrt(np.sum(v1**2))&lt;/code&gt;, uses the &lt;strong&gt;Euclidean norm&lt;/strong&gt; that you learned about above. The second computation uses &lt;code&gt;np.linalg.norm()&lt;/code&gt;, a NumPy function that computes the Euclidean norm of an array by default but can also compute &lt;a href=&quot;https://numpy.org/doc/stable/reference/generated/numpy.linalg.norm.html&quot;&gt;other matrix and vector norms&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Lastly, you see two ways to calculate the &lt;strong&gt;dot product&lt;/strong&gt; between two vectors. Using &lt;code&gt;np.sum(v1 * v2)&lt;/code&gt; first computes the element-wise multiplication between &lt;code&gt;v1&lt;/code&gt; and &lt;code&gt;v2&lt;/code&gt; in a &lt;a href=&quot;https://realpython.com/numpy-array-programming/#what-is-vectorization&quot;&gt;vectorized&lt;/a&gt; fashion, and you sum the results to produce a single number. A better way to compute the dot product is to use the at-operator (&lt;code&gt;@&lt;/code&gt;), as you see with &lt;code&gt;v1 @ v3&lt;/code&gt;. This is because &lt;code&gt;@&lt;/code&gt; can perform both vector and matrix multiplications, and the syntax is cleaner.&lt;/p&gt;
&lt;p&gt;While all of these vector definitions and properties may seem straightforward to compute, you might still be wondering what they actually mean and why they’re important to understand. One way to better understand vectors is to visualize them in two dimensions. In this context, you can represent vectors as arrows, like in the following plot:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/Screenshot_2023-08-25_at_3.28.16_PM.d90eaabd67be.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/Screenshot_2023-08-25_at_3.28.16_PM.d90eaabd67be.png&quot; width=&quot;1014&quot; height=&quot;600&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Screenshot_2023-08-25_at_3.28.16_PM.d90eaabd67be.png&amp;amp;w=253&amp;amp;sig=f7bd22ba574be87ab5e6d8f5d8ee4f1c5af86e78 253w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Screenshot_2023-08-25_at_3.28.16_PM.d90eaabd67be.png&amp;amp;w=338&amp;amp;sig=e415dfeac2dd6392c0e20f71dd49af3a9245edfa 338w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Screenshot_2023-08-25_at_3.28.16_PM.d90eaabd67be.png&amp;amp;w=507&amp;amp;sig=9327e05d01492a491768a10c0bd6ca9827af1b79 507w, https://files.realpython.com/media/Screenshot_2023-08-25_at_3.28.16_PM.d90eaabd67be.png 1014w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Vectors are often thought of as arrows in two dimensions&quot; data-asset=&quot;5326&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;Representing vectors as arrows in two dimensions&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;The above plot shows the visual representation of the vectors &lt;code&gt;v1&lt;/code&gt;, &lt;code&gt;v2&lt;/code&gt;, and &lt;code&gt;v3&lt;/code&gt; that you worked with in the last example. The tail of each vector arrow always starts at the origin, and the tip is located at the coordinates specified by the vector. As an example, the tip of &lt;code&gt;v1&lt;/code&gt; lies at &lt;code&gt;(1, 0)&lt;/code&gt;, and the tip of &lt;code&gt;v3&lt;/code&gt; lies at roughly &lt;code&gt;(1.414, 1.414)&lt;/code&gt;. The length of each vector arrow corresponds to the magnitude that you calculated earlier.&lt;/p&gt;
&lt;p&gt;From this visual, you can make the following key inferences:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;v1&lt;/code&gt; and &lt;code&gt;v2&lt;/code&gt; are unit vectors because their magnitude, given by the arrow length, is one. &lt;code&gt;v3&lt;/code&gt; isn’t a unit vector, and its magnitude is two, twice the size of &lt;code&gt;v1&lt;/code&gt; and &lt;code&gt;v2&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;v1&lt;/code&gt; and &lt;code&gt;v2&lt;/code&gt; are &lt;strong&gt;orthogonal&lt;/strong&gt; because their tails meet at a 90 degree angle. You see this visually but can also verify it computationally by computing the dot product between &lt;code&gt;v1&lt;/code&gt; and &lt;code&gt;v2&lt;/code&gt;. By using the dot product definition, &lt;em&gt;v1 ⋅ v2 = ||v1|| ||v2|| cos(θ)&lt;/em&gt;, you can see that when &lt;em&gt;θ = 90&lt;/em&gt;, &lt;em&gt;cos(θ) = 0&lt;/em&gt; and &lt;em&gt;v1 ⋅ v2 = 0&lt;/em&gt;. Intuitively, you can think of &lt;code&gt;v1&lt;/code&gt; and &lt;code&gt;v2&lt;/code&gt; as being totally unrelated or having nothing to do with each other. This will become important later.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;v3&lt;/code&gt; makes a 45 degree angle with both &lt;code&gt;v1&lt;/code&gt; and &lt;code&gt;v2&lt;/code&gt;. This means that &lt;code&gt;v3&lt;/code&gt; will have a non-zero dot product with &lt;code&gt;v1&lt;/code&gt; and &lt;code&gt;v2&lt;/code&gt;. This also means that &lt;code&gt;v3&lt;/code&gt; is equally related to both &lt;code&gt;v1&lt;/code&gt; and &lt;code&gt;v2&lt;/code&gt;. In general, the smaller the angle between two vectors, the more they point toward a common direction. &lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/chromadb-vector-database/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/chromadb-vector-database/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Basics: Modules and Packages</title>
      <id>https://realpython.com/courses/python-basics-modules-packages/</id>
      <link href="https://realpython.com/courses/python-basics-modules-packages/"/>
      <updated>2023-11-14T14:00:00+00:00</updated>
      <summary>In this Python Basics video course, you&#x27;ll learn how to build an application by putting related code into separate files called modules. You&#x27;ll also use the import statement to use modules in another file.</summary>
      <content type="html">
        &lt;p&gt;As you gain experience writing code, you&amp;rsquo;ll eventually work on
projects that are so large that keeping all the code in a single file
becomes cumbersome.&lt;/p&gt;
&lt;p&gt;Instead of writing a single file, you can put related code into separate
files called &lt;strong&gt;modules&lt;/strong&gt;. You can put individual modules together like
building blocks to create a larger application.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Create&lt;/strong&gt; your own modules&lt;/li&gt;
&lt;li&gt;Use modules in another file through the &lt;strong&gt;&lt;code&gt;import&lt;/code&gt; statement&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Organize several modules into a &lt;strong&gt;package&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This video course is part of the Python Basics series, which accompanies &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. You can also check out the other &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics courses&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Note that you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt; throughout this course.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>JupyterLab for an Enhanced Notebook Experience</title>
      <id>https://realpython.com/using-jupyterlab/</id>
      <link href="https://realpython.com/using-jupyterlab/"/>
      <updated>2023-11-13T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to use the JupyterLab authoring environment and what it brings to the popular computational notebook Jupyter Notebook. You&#x27;ll learn about its different tools and discover how they can work together to enhance your notebook experience.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Maybe you’ve already worked with Jupyter Notebooks from &lt;a href=&quot;https://docs.jupyter.org/en/latest/&quot;&gt;Project Jupyter&lt;/a&gt; to create documents containing runnable code. You can achieve even more with &lt;strong&gt;JupyterLab&lt;/strong&gt;, a tool kit that you can use to document and share your research, teaching, and learning activities. It’s useful in a wide range of disciplines, from data analysis and data visualization to scientific study.&lt;/p&gt;
&lt;p&gt;JupyterLab enhances your notebooks by providing a &lt;strong&gt;browser-based interface&lt;/strong&gt; that allows you to use &lt;strong&gt;multiple notebooks&lt;/strong&gt; together effectively. In addition, it offers you a comprehensive Markdown editor, file manager, file viewer, and an infrastructure that enables you to run code from a wide range of files.&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;Share code&lt;/strong&gt; between multiple Jupyter Notebooks&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debug&lt;/strong&gt; a Jupyter Notebook&lt;/li&gt;
&lt;li&gt;Create and manage &lt;strong&gt;Markdown&lt;/strong&gt; files&lt;/li&gt;
&lt;li&gt;Run &lt;strong&gt;embedded code&lt;/strong&gt; from a range of different files&lt;/li&gt;
&lt;li&gt;Manage and view &lt;strong&gt;different file types&lt;/strong&gt; from a single interface&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Access&lt;/strong&gt; your operating system from within JupyterLab&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;Jupyter&lt;/em&gt; is a &lt;a href=&quot;https://www.britannica.com/topic/portmanteau-word&quot;&gt;portmanteau&lt;/a&gt; word blended from the three programming languages &lt;strong&gt;Ju&lt;/strong&gt;lia, &lt;strong&gt;Py&lt;/strong&gt;thon, and &lt;strong&gt;R&lt;/strong&gt;. Although you’ll focus on Python in this tutorial, you can use Jupyter with the other languages as well. Plus, this free application works on macOS, Linux, and Windows environments.&lt;/p&gt;
&lt;p&gt;JupyterLab takes &lt;a href=&quot;https://realpython.com/jupyter-notebook-introduction/&quot;&gt;Jupyter Notebook&lt;/a&gt; usage to a different level, so you’ll get the most out of this tutorial if you’re already familiar with Jupyter Notebook.&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/using-jupyterlab-materials/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-using-jupyterlab-materials&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download notebooks and files&lt;/a&gt; that you can play with in JupyterLab.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;installing-and-starting-jupyterlab&quot;&gt;Installing and Starting JupyterLab&lt;a class=&quot;headerlink&quot; href=&quot;#installing-and-starting-jupyterlab&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The cleanest way of installing JupyterLab on a computer is to use a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;. This will ensure that your JupyterLab work doesn’t interfere with any other Python projects or environments that you may already have. For this tutorial, you’ll create a new virtual environment named &lt;code&gt;jl_venv&lt;/code&gt;. Select your operating system to get JupyterLab up and running: &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;span class=&quot;icon baseline text-muted mr-1&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Windows&lt;/a&gt;
  &lt;/li&gt;


  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-linux&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body small &quot; id=&quot;linux-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#linux-1&quot; role=&quot;tab&quot; aria-controls=&quot;linux-1&quot; aria-selected=&quot;false&quot;&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Linux&lt;/a&gt;
  &lt;/li&gt;


  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-macos&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;#macos-1&quot; role=&quot;tab&quot; aria-controls=&quot;macos-1&quot; aria-selected=&quot;false&quot;&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#v4--apple&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;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;p&gt;If you haven’t already done so, download and &lt;a href=&quot;https://realpython.com/installing-python/&quot;&gt;install Python&lt;/a&gt; on your Windows computer. Then fire up a &lt;code&gt;Windows PowerShell(Admin)&lt;/code&gt; or &lt;code&gt;Terminal(Admin)&lt;/code&gt; prompt depending on the version of Windows that you’re using. Now type in the following commands:   &lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Windows PowerShell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight pscon highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;jupyterlab_projects&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;jupyterlab_projects&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;jl_venv&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;jl_venv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Scripts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;activate&lt;/span&gt;
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(jl_venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pip&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;jupyterlab&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To keep things neat, you first create a new &lt;code&gt;jupyterlab_projects&lt;/code&gt; folder for all of your JupyterLab work. Later you’ll create individual subfolders for each of your projects to keep everything organized.&lt;/p&gt;
&lt;p&gt;Next, you create a virtual environment named &lt;code&gt;jl_venv&lt;/code&gt; within this folder, which you then activate. If the activation is successful, then the virtual environment’s name will precede your Powershell prompt. If not, see the alert box below. Finally, you install JupyterLab into this virtual environment.&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 run the activation script, you may receive an error stating that your system can’t run the script. Modern versions of Windows don’t allow you to run scripts downloaded from the Internet. This is a security feature.&lt;/p&gt;
&lt;p&gt;To fix this, you need to type the command &lt;code&gt;Set-ExecutionPolicy RemoteSigned&lt;/code&gt;, then answer &lt;code&gt;Y&lt;/code&gt; to the question. Your computer will now run scripts that Microsoft has verified. Once you’ve done this, retry the &lt;code&gt;jl_venv\Scripts\activate&lt;/code&gt; command, which should now work.  &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;As you can see above, you have a PowerShell prompt that’s preceded by &lt;code&gt;(jl_venv)&lt;/code&gt;. This means anything you do from this point forward will stay in this environment and remain separate from any other Python work that you may have elsewhere. &lt;/p&gt;
&lt;p&gt;Finally, for neatness, you’ll create a new folder named &lt;code&gt;tutorial_project&lt;/code&gt;. This will serve as a working area for this tutorial. Then you start up JupyterLab from within it:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Windows PowerShell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight pscon highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(jl_venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tutorial_project&lt;/span&gt;
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(jl_venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tutorial_project&lt;/span&gt;
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(jl_venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;jupyter&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lab&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;p&gt;To install JupyterLab, fire up a terminal and run the following commands:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight sh highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;mkdir&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;jupyterlab_projects
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;jupyterlab_projects
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python3&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;jl_venv
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;jl_venv/bin/activate
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(jl_venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;jupyterlab
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To keep things neat, you first create a new &lt;code&gt;jupyterlab_projects&lt;/code&gt; directory for all of your JupyterLab work. Later you can create individual subdirectories for each of your projects to keep things organized.&lt;/p&gt;
&lt;p&gt;Next, you create a virtual environment named &lt;code&gt;jl_venv&lt;/code&gt;. If this command fails, see the alert box below. You then activate your virtual environment by running its activation script. Once the virtual environment is activated, its name precedes your terminal prompt. You install JupyterLab into this virtual environment.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; To create a virtual environment on Linux, you need to have the &lt;code&gt;python3-venv&lt;/code&gt; package installed on your computer. If you don’t have this, then run the command &lt;code&gt;sudo apt-get install python3-venv&lt;/code&gt; before running the &lt;code&gt;python3 -m venv jl_venv&lt;/code&gt; command once more. &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Your terminal prompt now shows that &lt;code&gt;(jl_venv)&lt;/code&gt; is the active environment. This means anything you do from this point forward will happen in this environment and remain separate from any other Python work that you may have elsewhere. &lt;/p&gt;
&lt;p&gt;Finally, for neatness, you’ll create a new directory named &lt;code&gt;tutorial_project&lt;/code&gt; and then start up JupyterLab from within it:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight sh highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(jl_venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;mkdir&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;tutorial_project
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(jl_venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;tutorial_project
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(jl_venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;jupyter&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;lab
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;p&gt;To install JupyterLab, fire up a terminal and run the following commands:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight sh highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;mkdir&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;jupyterlab_projects
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;jupyterlab_projects
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;jl_venv
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;jl_venv/bin/activate
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(jl_venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;jupyterlab
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To keep things neat, you first create a new &lt;code&gt;jupyterlab_projects&lt;/code&gt; folder for all of your JupyterLab work. Later you can create individual subfolders for each of your projects to keep things organized.&lt;/p&gt;
&lt;p&gt;Next, you create a virtual environment named &lt;code&gt;jl_venv&lt;/code&gt;. You then activate your virtual environment by running its activation script. Once the virtual environment is activated, its name precedes your terminal prompt. You install JupyterLab into this virtual environment.&lt;/p&gt;
&lt;p&gt;Finally, for neatness, you’ll create a new folder named &lt;code&gt;tutorial_project&lt;/code&gt; and then start up JupyterLab from within it:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight sh highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(jl_venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;mkdir&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;tutorial_project
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(jl_venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;tutorial_project
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(jl_venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;jupyter&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;lab
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Of course, once you’ve finished this tutorial, you can delete &lt;code&gt;tutorial_project&lt;/code&gt; and add in your own project-specific folders instead.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you wish, you could create a &lt;code&gt;Samples&lt;/code&gt; subfolder within &lt;code&gt;tutorial_project&lt;/code&gt; and save this tutorial’s downloadable files into it. These include completed versions of the notebooks that you’ll create later on, as well as some other files. This will also give you some files to play around with and will allow you to fully participate in the tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;JupyterLab will start in your web browser, all ready for you to use. But before you dive in, you might want to know how to end your session:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;To shut JupyterLab down, make sure everything is saved, and then use &lt;em&gt;File&lt;/em&gt; → &lt;em&gt;Shut Down&lt;/em&gt; to close the application before closing your browser. This will close everything down cleanly. Closing the browser alone doesn’t close the server, while crashing the server may cause data loss.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To restart, open either Powershell or your terminal, navigate to your &lt;code&gt;jupyterlab_projects&lt;/code&gt; folder, then activate &lt;code&gt;jl_venv&lt;/code&gt;. Finally, create or enter your specific project’s folder then start JupyterLab as before.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To deactivate your virtual environment, use the &lt;code&gt;deactivate&lt;/code&gt; command. Your command prompt will return to normal. &lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once you’ve installed and started JupyterLab, its server will start, along with a web browser connection to it. It may take a moment, but soon you’ll be looking at its main interface:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/ie-main-interfaceCR.2c7f9ea4195d.png&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/ie-main-interfaceCR.2c7f9ea4195d.png&quot; width=&quot;1923&quot; height=&quot;1031&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ie-main-interfaceCR.2c7f9ea4195d.png&amp;amp;w=480&amp;amp;sig=3452a881dea2823ee27ad54fe1ebf1184d0556eb 480w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ie-main-interfaceCR.2c7f9ea4195d.png&amp;amp;w=641&amp;amp;sig=56e4816fee9e3a560d7236c05b323f66454b9fc0 641w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ie-main-interfaceCR.2c7f9ea4195d.png&amp;amp;w=961&amp;amp;sig=47eb4a04a7c18f4969570873a28125abc104357a 961w, https://files.realpython.com/media/ie-main-interfaceCR.2c7f9ea4195d.png 1923w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;main jupyterlab interface&quot; data-asset=&quot;5383&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;Because this is your first time running JupyterLab, the front screen shown above contains only a single Launcher window. This is where you can access everything else that’s on offer. &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; Before you start using JupyterLab, you may like to change its appearance to make it easier for you to use. There are several options available to you:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;You can hide or display various screen regions using &lt;em&gt;View&lt;/em&gt; → &lt;em&gt;Appearance&lt;/em&gt;. This is useful if you have a small monitor. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can change the overall theme of the interface by opening &lt;em&gt;Settings&lt;/em&gt; → &lt;em&gt;Theme&lt;/em&gt;. Themes may help you see more clearly. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can also increase and decrease various font sizes using the options under &lt;em&gt;Settings&lt;/em&gt; and &lt;em&gt;Settings&lt;/em&gt; → &lt;em&gt;Theme&lt;/em&gt;. These may help clarify text.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can even use your favorite &lt;a href=&quot;https://realpython.com/coding-font/&quot;&gt;coding font&lt;/a&gt; by accessing &lt;em&gt;Settings&lt;/em&gt; → &lt;em&gt;Settings Editor&lt;/em&gt; and then scrolling down the list of settings on the left until you reach &lt;em&gt;Notebook&lt;/em&gt;. Once you’re there, fill out the font family and font size according to your preferences. Then close the &lt;em&gt;Settings&lt;/em&gt; tab:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/ie-change-font-family.d646192e919e.png&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/ie-change-font-family.d646192e919e.png&quot; width=&quot;855&quot; height=&quot;709&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ie-change-font-family.d646192e919e.png&amp;amp;w=213&amp;amp;sig=9eb891efaa440a1757b82a45cb5a2c9a9ad5ebf8 213w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ie-change-font-family.d646192e919e.png&amp;amp;w=285&amp;amp;sig=02d038362a48335f0f180c09f0f0690282bf076b 285w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ie-change-font-family.d646192e919e.png&amp;amp;w=427&amp;amp;sig=a9fee23b2d145af1ee9a7316076e000de28d816e 427w, https://files.realpython.com/media/ie-change-font-family.d646192e919e.png 855w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;changing font size and family&quot; data-asset=&quot;5505&quot;&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;As you can see from the screenshot, you’ve updated the font within your notebooks. If you don’t like your adjustments, then click the big red &lt;em&gt;Restore to Defaults&lt;/em&gt; button that appears at the top-right of the &lt;em&gt;Settings&lt;/em&gt; screen, and no harm done.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In the upcoming sections, you’ll perform a range of tasks highlighting how JupyterLab’s tools enhance the capability of notebooks. You’ll also see some other interesting features as well.&lt;/p&gt;
&lt;h2 id=&quot;understanding-jupyterlab-kernels&quot;&gt;Understanding JupyterLab Kernels&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-jupyterlab-kernels&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;JupyterLab’s tools support you in your work. Although the tools are self-contained, by using some of them together, you get more out of them. This integration is probably JupyterLab’s most powerful feature. &lt;/p&gt;
&lt;p&gt;A good starting point when learning JupyterLab is for you to know what its basic components are and how to make them work together. The diagram below shows an overview of these: &lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/ie-jupyterlab-components.e624b41714b7.png&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/ie-jupyterlab-components.e624b41714b7.png&quot; width=&quot;1500&quot; height=&quot;1085&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ie-jupyterlab-components.e624b41714b7.png&amp;amp;w=375&amp;amp;sig=4535936eefeb2d2f578396ce6ed7d2717abdbc4d 375w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ie-jupyterlab-components.e624b41714b7.png&amp;amp;w=500&amp;amp;sig=a27dc9aea52c58a1d69f136374bea1e3ee9541c6 500w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/ie-jupyterlab-components.e624b41714b7.png&amp;amp;w=750&amp;amp;sig=bc78cb26a8bdd7d352ce673c15880cf35aff05b1 750w, https://files.realpython.com/media/ie-jupyterlab-components.e624b41714b7.png 1500w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Diagram showing the components of JupyterLab&quot; data-asset=&quot;5362&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;This diagram may look overwhelming at first because there are several parts. Don’t worry, you’ll soon see their relevance. The arrows show how various components interact. These interactions are one of the great benefits of JupyterLab. You’ll start with the central part of the application and the diagram: the kernel.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/using-jupyterlab/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/using-jupyterlab/ »&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 #180: Studying Python Software Architecture &amp; Creating Lambda Expressions</title>
      <id>https://realpython.com/podcasts/rpp/180/</id>
      <link href="https://realpython.com/podcasts/rpp/180/"/>
      <updated>2023-11-10T12:00:00+00:00</updated>
      <summary>Have you moved through the fundamentals of Python, and are you now considering building a more extensive project or complete application? Where can you study the architecture of existing Python projects and learn best practices? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you moved through the fundamentals of Python, and are you now considering building a more extensive project or complete application? Where can you study the architecture of existing Python projects and learn best practices? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Document Your Python Code and Projects With ChatGPT</title>
      <id>https://realpython.com/document-python-code-with-chatgpt/</id>
      <link href="https://realpython.com/document-python-code-with-chatgpt/"/>
      <updated>2023-11-08T14:00:00+00:00</updated>
      <summary>Good documentation is a critical feature of any successful Python project. In practice, writing documentation is hard and can take a lot of time and effort. Nowadays, with tools like ChatGPT, you can quickly document your Python code and projects.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Having good &lt;strong&gt;documentation&lt;/strong&gt; is a critical feature of any successful Python project. In practice, writing documentation is hard and can take a lot of time and effort, so some developers don’t like to do it. Luckily, with &lt;strong&gt;large language models&lt;/strong&gt; (LLMs) and tools like &lt;strong&gt;ChatGPT&lt;/strong&gt;, you can quickly document your Python code and projects.&lt;/p&gt;
&lt;p&gt;In Python, you can document your code using &lt;strong&gt;docstrings&lt;/strong&gt; and then take advantage of them to enrich the project’s &lt;strong&gt;external documentation&lt;/strong&gt;. ChatGPT can be of great help in writing both docstrings and external documentation.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Build different ChatGPT prompts to generate Python &lt;strong&gt;docstrings&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use different &lt;strong&gt;styles&lt;/strong&gt; while generating docstrings with ChatGPT&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;doctest&lt;/code&gt; &lt;strong&gt;tests&lt;/strong&gt; and &lt;strong&gt;usage examples&lt;/strong&gt; to Python docstrings&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;external documentation&lt;/strong&gt;, such as &lt;code&gt;README&lt;/code&gt; files and tutorials, with ChatGPT&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should have a &lt;a href=&quot;https://realpython.com/chatgpt-coding-mentor-python/#set-up-your-chatgpt-coding-mentor&quot;&gt;ChatGPT account&lt;/a&gt; and know the basics of interacting with this tool using &lt;a href=&quot;https://realpython.com/practical-prompt-engineering/&quot;&gt;prompt engineering&lt;/a&gt;. You should also know the basics of how to &lt;a href=&quot;https://realpython.com/documenting-python-code/&quot;&gt;document Python code&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;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/document-python-code-with-chatgpt-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-document-python-code-with-chatgpt-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download free sample code&lt;/a&gt; for documenting Python code with ChatGPT.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;benefits-of-using-chatgpt-for-documenting-python-code&quot;&gt;Benefits of Using ChatGPT for Documenting Python Code&lt;a class=&quot;headerlink&quot; href=&quot;#benefits-of-using-chatgpt-for-documenting-python-code&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Having high-quality, up-to-date documentation is critical for any software project. Poor documentation can cause a project to fail or go unnoticed even if the codebase is well written and the project’s main idea is innovative and useful.&lt;/p&gt;
&lt;p&gt;Writing good documentation takes considerable time and effort. That’s why using &lt;a href=&quot;https://en.wikipedia.org/wiki/Large_language_model&quot;&gt;large language models (LLMs)&lt;/a&gt; like &lt;a href=&quot;https://realpython.com/chatgpt-coding-mentor-python/&quot;&gt;ChatGPT&lt;/a&gt; can be a viable alternative for providing your projects and code with proper documentation.&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; Check out &lt;a href=&quot;https://realpython.com/podcasts/rpp/174/&quot;&gt;Episode 174: Considering ChatGPT’s Technical Review of a Programming Book&lt;/a&gt; of The Real Python Podcast for an interesting conversation about using ChatGPT to run a technical review on existing resources, such as books.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Some of the benefits of ChatGPT for documenting Python code include the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Increased productivity&lt;/strong&gt;: It allows automation of tasks related to code documentation and its maintenance, which saves you considerable time and effort.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Improved quality&lt;/strong&gt;: It helps ensure that your documentation is accurate, up-to-date, and comprehensive.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Enhanced user experience&lt;/strong&gt;: It can produce engaging and user-friendly documentation, leading to a better user experience.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reduced costs&lt;/strong&gt;: It helps reduce the costs of creating and maintaining documentation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Improved compliance&lt;/strong&gt;: It can help ensure that the documentation complies with standards and regulations, making it more consistent and professional.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With ChatGPT, you can generate cool documentation for your Python code in almost no time. In the following sections, you’ll learn the basics of using ChatGPT as an assistant for creating coherent docstrings and user-friendly external documentation for your Python projects.&lt;/p&gt;
&lt;h2 id=&quot;effective-chatgpt-prompts-for-writing-docstrings&quot;&gt;Effective ChatGPT Prompts for Writing Docstrings&lt;a class=&quot;headerlink&quot; href=&quot;#effective-chatgpt-prompts-for-writing-docstrings&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The primary way to document Python code is through &lt;a href=&quot;https://realpython.com/documenting-python-code/#docstrings-background&quot;&gt;docstrings&lt;/a&gt;. In Python, a &lt;strong&gt;docstring&lt;/strong&gt; is typically a triple-quoted string that occupies the first line of &lt;a href=&quot;https://realpython.com/python-modules-packages/&quot;&gt;modules&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-classes/#providing-behavior-with-methods&quot;&gt;methods&lt;/a&gt;. This string has a special meaning for Python, which stores it in an attribute called &lt;code&gt;.__doc__&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Many Python tools, including &lt;a href=&quot;https://realpython.com/python-ides-code-editors-guide/&quot;&gt;code editors and IDEs&lt;/a&gt;, take advantage of docstrings to provide real-time help when you’re writing your code. Docstrings are also part of Python’s &lt;strong&gt;built-in help system&lt;/strong&gt;, which you can access with the &lt;a href=&quot;https://docs.python.org/3/library/functions.html#help&quot;&gt;&lt;code&gt;help()&lt;/code&gt;&lt;/a&gt; function:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight python repl highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;help&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;Help on class str in module builtins:&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;class str(object)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |  str(object=&#x27;&#x27;) -&amp;gt; str&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |  str(bytes_or_buffer[, encoding[, errors]]) -&amp;gt; str&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |  Create a new string object from the given object. If encoding or&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |  errors is specified, then the object must expose a data buffer&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |  that will be decoded using the given encoding and error handler.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |  Otherwise, returns the result of object.__str__() (if defined)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |  or repr(object).&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |  encoding defaults to sys.getdefaultencoding().&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |  errors defaults to &#x27;strict&#x27;.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |  Methods defined here:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |  __add__(self, value, /)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |      Return self+value.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |  __contains__(self, key, /)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt; |      Return key in self.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this example, you call &lt;code&gt;help()&lt;/code&gt; with the &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;&lt;code&gt;str&lt;/code&gt;&lt;/a&gt; class as an argument, and you get the class’s documentation page, which includes the class’s docstring:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight python repl highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;vm&quot;&gt;__doc__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;str(object=&#x27;&#x27;) -&amp;gt; str&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;str(bytes_or_buffer[, encoding[, errors]]) -&amp;gt; str&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;Create a new string object from the given object. If encoding or&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;errors is specified, then the object must expose a data buffer&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;that will be decoded using the given encoding and error handler.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Otherwise, returns the result of object.__str__() (if defined)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;or repr(object).&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;encoding defaults to sys.getdefaultencoding().&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;errors defaults to &#x27;strict&#x27;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot;&gt;&lt;svg&gt;&lt;use href=&quot;/static/icons.2074e80512da.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this case, you get the class’s docstring by accessing the &lt;code&gt;.__doc__&lt;/code&gt; attribute directly on the &lt;code&gt;str&lt;/code&gt; class. As you can conclude, docstrings add a lot of value to your code. They’re the primary documentation that you and other Python developers will use to learn about any Python object.&lt;/p&gt;
&lt;p&gt;You can also take advantage of your code’s docstrings when you’re building project documentation with a tool like &lt;a href=&quot;https://realpython.com/courses/python-sphinx/&quot;&gt;Sphinx&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/python-project-documentation-with-mkdocs/&quot;&gt;MkDocs&lt;/a&gt;. These tools have plugins and features that allow you to extract the docstrings and make them part of your project’s external documentation, which can save you a lot of time.&lt;/p&gt;
&lt;p&gt;Python has well-established conventions for writing good docstrings. Package, module, class, method, and function docstrings all have specific goals and should follow specific guidelines. You can find these guidelines and conventions in &lt;a href=&quot;https://peps.python.org/pep-0257/&quot;&gt;PEP 257&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; To dive deeper into documenting Python projects, check out &lt;a href=&quot;https://realpython.com/documenting-python-code/&quot;&gt;Documenting Python Code: A Complete Guide&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Although PEP 257 provides a standard, you’ll actually find a healthy variety of docstring styles across the Python ecosystem. Here are a few common alternatives:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/document-python-code-with-chatgpt/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/document-python-code-with-chatgpt/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Basics Exercises: Numbers and Math</title>
      <id>https://realpython.com/courses/numbers-and-math-exercises/</id>
      <link href="https://realpython.com/courses/numbers-and-math-exercises/"/>
      <updated>2023-11-07T14:00:00+00:00</updated>
      <summary>In this Python Basics Exercises course, you&#x27;ll practice the math that you need for your Python programming journey. This includes integers and floating-point numbers, arithmetic operators, and string formatting for numbers.</summary>
      <content type="html">
        &lt;p&gt;In &lt;a href=&quot;https://realpython.com/courses/python-basics-numbers-and-math/&quot;&gt;Python Basics: Numbers and Math&lt;/a&gt;, you learned the mathematical skills that you&amp;rsquo;ll need as a Python programmer. Now, you&amp;rsquo;ll take those skills to the next level by actively practicing and applying what you&amp;rsquo;ve learned.&lt;/p&gt;
&lt;p&gt;In this hands-on course, you&amp;rsquo;ll have the opportunity to reinforce your understanding of numbers and math in Python programming through a series of exercises and coding challenges. By actively engaging with the material, you&amp;rsquo;ll gain the confidence you need to apply your learning in real-world scenarios.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll practice:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Creating &lt;strong&gt;integers&lt;/strong&gt; and &lt;strong&gt;floating-point numbers&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Using &lt;strong&gt;arithmetic expressions&lt;/strong&gt;, &lt;strong&gt;math functions&lt;/strong&gt;, and &lt;strong&gt;number methods&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Formatting and displaying numbers in &lt;strong&gt;strings&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Taking numbers as &lt;strong&gt;user input&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In working through these exercises, you&amp;rsquo;ll deepen your knowledge and solidify your understanding of the Python language. You&amp;rsquo;ll not only gain confidence in your programming abilities but also enhance your problem-solving skills.&lt;/p&gt;
&lt;p&gt;This course is part of the Python Basics series, which accompanies &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. You can also check out other &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics courses&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Note that you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt; throughout this course. If you&amp;rsquo;re just getting started, then you might want to check out &lt;a href=&quot;https://realpython.com/courses/setting-up-python/&quot;&gt;Python Basics: Setting Up Python&lt;/a&gt; before diving into this course.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python News: What&#x27;s New From October 2023</title>
      <id>https://realpython.com/python-news-october-2023/</id>
      <link href="https://realpython.com/python-news-october-2023/"/>
      <updated>2023-11-06T14:00:00+00:00</updated>
      <summary>A natural highlight in October 2023 is the release of Python 3.12. However, the community doesn&#x27;t rest, and nominations for a new Python Steering Council are underway, while a Documentation Editorial Board and a Typing Council are about to be established.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;October 2023 saw the release of the new &lt;strong&gt;Python 3.12&lt;/strong&gt;. At the same time, focus has shifted to new developments in the language. The acceptance of the long-discussed &lt;strong&gt;PEP 703&lt;/strong&gt; means that developers can ramp up their work on a free-threading version of Python.&lt;/p&gt;
&lt;p&gt;The steering council does an important job governing Python and its development. Nominations for the next steering council are now open. Currently, groups are being established that’ll support the steering council by specifically focusing on &lt;strong&gt;typing&lt;/strong&gt; and &lt;strong&gt;documentation&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Dive in to learn more about the most important Python news from the last month. &lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Join Now:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-newsletter&quot; data-focus=&quot;false&quot;&gt;Click here to join the Real Python Newsletter&lt;/a&gt; and you&#x27;ll never miss another Python tutorial, course update, or post.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;python-312-released&quot;&gt;Python 3.12 Released&lt;a class=&quot;headerlink&quot; href=&quot;#python-312-released&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The latest version of Python, &lt;a href=&quot;https://realpython.com/python312-new-features/&quot;&gt;Python 3.12&lt;/a&gt;, came out on October 2. You can read more about the release in &lt;a href=&quot;https://realpython.com/python-news-september-2023/#python-312-arrives-in-october-2023&quot;&gt;last month’s newsletter&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you haven’t tried Python 3.12 for yourself yet, then you should give it a quick spin! Especially if you’re working on a library or an application, it’s good to check that it works on the latest version of Python. You can &lt;a href=&quot;https://realpython.com/installing-python/&quot;&gt;install&lt;/a&gt; several versions of Python on your computer to try them side by side.&lt;/p&gt;
&lt;p&gt;The biggest challenge with upgrading a project to a brand-new version of Python is that some of your dependencies may &lt;a href=&quot;https://pyreadiness.org/3.12/&quot;&gt;not be ready&lt;/a&gt; yet. In general, pure Python libraries should continue to work well, while you may experience issues with extension modules that need to be compiled especially for Python 3.12. However, most of the popular libraries are on the ball and are providing compatible &lt;a href=&quot;https://realpython.com/python-wheels/&quot;&gt;wheels&lt;/a&gt; already.&lt;/p&gt;
&lt;h2 id=&quot;python-enjoys-new-developments&quot;&gt;Python Enjoys New Developments&lt;a class=&quot;headerlink&quot; href=&quot;#python-enjoys-new-developments&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Even though Python 3.12 has just been released, the core developers have been working on Python 3.13 for several months already. You can expect the next version of Python to be &lt;a href=&quot;https://peps.python.org/pep-0719/&quot;&gt;released&lt;/a&gt; in October 2024.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.python.org/downloads/release/python-3130a1/&quot;&gt;first alpha version of Python 3.13&lt;/a&gt; is now available. As it’s still early in development, you won’t find many &lt;a href=&quot;https://docs.python.org/3.13/whatsnew/3.13.html&quot;&gt;new features&lt;/a&gt; yet.&lt;/p&gt;
&lt;p&gt;Instead, the main differences between Python 3.12 and 3.13 so far are &lt;a href=&quot;https://docs.python.org/3.13/whatsnew/3.13.html#deprecated&quot;&gt;deprecations&lt;/a&gt; and &lt;a href=&quot;https://docs.python.org/3.13/whatsnew/3.13.html#removed&quot;&gt;removals&lt;/a&gt; of old functionality. In particular, the &lt;a href=&quot;https://realpython.com/python311-new-features/#dead-batteries&quot;&gt;dead batteries&lt;/a&gt; identified in Python 3.11 have now been removed, and many private functions in Python’s C API have been &lt;a href=&quot;https://discuss.python.org/t/c-api-my-plan-to-clarify-private-vs-public-functions-in-python-3-13/30131&quot;&gt;removed&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There are several places where you can follow the discussions and work that goes into developing and maintaining Python, including GitHub, discussion forums, and &lt;a href=&quot;https://peps.python.org/&quot;&gt;PEP&lt;/a&gt; documents. Last month, core developers &lt;a href=&quot;https://realpython.com/podcasts/rpp/130/&quot;&gt;Pablo Galindo Salgado&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/podcasts/rpp/82/&quot;&gt;Łukasz Langa&lt;/a&gt; unveiled a new platform for Python news: a podcast named &lt;a href=&quot;https://podcasters.spotify.com/pod/show/corepy&quot;&gt;core.py&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In the &lt;a href=&quot;https://open.spotify.com/episode/2BvTXdt0IP9XG6pjiopR2K&quot;&gt;first episode&lt;/a&gt;, Pablo and Łukasz discuss some of the features that are in development for Python 3.13. These include an &lt;a href=&quot;https://twitter.com/pyblogsal/status/1715473916536234441&quot;&gt;improved editing experience&lt;/a&gt; in the &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;REPL&lt;/a&gt; and the &lt;a href=&quot;https://github.com/faster-cpython/ideas/tree/main/3.13&quot;&gt;Faster CPython&lt;/a&gt; project’s just-in-time (JIT) compiler prototype.&lt;/p&gt;
&lt;p&gt;In the &lt;a href=&quot;https://open.spotify.com/episode/6K9BLLnjuYQZAeejeseY3c&quot;&gt;second episode&lt;/a&gt;, they cover PEP 703 and the road toward a version of Python without the &lt;a href=&quot;https://realpython.com/python-gil/&quot;&gt;GIL&lt;/a&gt;. The GIL—or global interpreter lock—is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Lock_(computer_science)&quot;&gt;mutex&lt;/a&gt; that ensures that only one thread accesses the Python interpreter at a time. A GIL has several advantages in single-threaded programs. However, it also makes &lt;a href=&quot;https://realpython.com/python-parallel-processing/&quot;&gt;parallel processing&lt;/a&gt; harder.&lt;/p&gt;
&lt;p&gt;If you’re interested in everything that happens under the hood in Python, then you won’t find better guides than Pablo and Łukasz. They’ve both been instrumental in several of the &lt;a href=&quot;https://realpython.com/search?q=new+features&quot;&gt;recent new features&lt;/a&gt; of the language. Additionally, Pablo was the release manager for Python &lt;a href=&quot;https://realpython.com/python310-new-features/&quot;&gt;3.10&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python311-new-features/&quot;&gt;3.11&lt;/a&gt;, while Łukasz had the same role for Python &lt;a href=&quot;https://realpython.com/python38-new-features/&quot;&gt;3.8&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python39-new-features/&quot;&gt;3.9&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;steering-council-accepting-nominations&quot;&gt;Steering Council Accepting Nominations&lt;a class=&quot;headerlink&quot; href=&quot;#steering-council-accepting-nominations&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/python-news-october-2023/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-october-2023/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #179: Improving Your Git Developer Experience in Python</title>
      <id>https://realpython.com/podcasts/rpp/179/</id>
      <link href="https://realpython.com/podcasts/rpp/179/"/>
      <updated>2023-11-03T12:00:00+00:00</updated>
      <summary>Are you getting by with a few fundamental commands for Git when building your Python projects? Would you like to improve your version control techniques and become more efficient with the Git command line? This week on the show, Adam Johnson is back to talk about his new book, &quot;Boost Your Git DX.&quot;</summary>
      <content type="html">
        &lt;p&gt;Are you getting by with a few fundamental commands for Git when building your Python projects? Would you like to improve your version control techniques and become more efficient with the Git command line? This week on the show, Adam Johnson is back to talk about his new book, &quot;Boost Your Git 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>Build a Hangman Game for the Command Line in Python</title>
      <id>https://realpython.com/python-hangman/</id>
      <link href="https://realpython.com/python-hangman/"/>
      <updated>2023-11-01T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll learn how to write the game of hangman in Python for the command line. You&#x27;ll learn how to structure the game as a text-based interface (TUI) application.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Many people learn basic language and word skills by playing the game of &lt;a href=&quot;https://en.wikipedia.org/wiki/Hangman_(game)&quot;&gt;hangman&lt;/a&gt;. First mentioned in print in the late nineteenth century and popularized in international media as the game show &lt;a href=&quot;https://en.wikipedia.org/wiki/Wheel_of_Fortune_(U.S._game_show)&quot;&gt;&lt;em&gt;Wheel of Fortune&lt;/em&gt;&lt;/a&gt;, hangman appeals to many people. For beginning programmers who want a challenge or for more experienced coders looking for a bit of fun, writing hangman in Python is a rewarding endeavor.&lt;/p&gt;
&lt;p&gt;Throughout this tutorial, you’ll build the hangman game in Python in a series of steps. The game will work as a command-line application. Throughout the process, you’ll also learn the basics of building computer games.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learn the &lt;strong&gt;common elements&lt;/strong&gt; of a computer game&lt;/li&gt;
&lt;li&gt;Track the &lt;strong&gt;state&lt;/strong&gt; of a computer game&lt;/li&gt;
&lt;li&gt;Get and validate the &lt;strong&gt;user’s input&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create a &lt;strong&gt;text-based user interface (TUI)&lt;/strong&gt; for your game&lt;/li&gt;
&lt;li&gt;Figure out when the &lt;strong&gt;game is over&lt;/strong&gt; and who the &lt;strong&gt;winner&lt;/strong&gt; is&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most from this tutorial, you should be comfortable working with Python &lt;a href=&quot;https://realpython.com/python-sets/&quot;&gt;sets&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;lists&lt;/a&gt;. You don’t need to have any previous knowledge about &lt;a href=&quot;https://realpython.com/pygame-a-primer/&quot;&gt;game&lt;/a&gt; writing.&lt;/p&gt;
&lt;p&gt;All the code that you’ll write in this tutorial is available for download at the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Game:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-hangman-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-hangman-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free code&lt;/a&gt; that you’ll write to create a hangman game with Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo-command-line-hangman-game-in-python&quot;&gt;Demo: Command-Line Hangman Game in Python&lt;a class=&quot;headerlink&quot; href=&quot;#demo-command-line-hangman-game-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll write a hangman game for your &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/#getting-to-know-command-line-interfaces&quot;&gt;command line&lt;/a&gt; using Python. Once you’ve run all the steps to build the game, then you’ll end up with a &lt;a href=&quot;https://en.wikipedia.org/wiki/Text-based_user_interface&quot;&gt;text-based user interface (TUI)&lt;/a&gt; that will work something like the following:&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/867102099?background=1&quot; frameborder=&quot;0&quot; allow=&quot;fullscreen&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;Throughout this tutorial, you’ll run through several challenges designed to help you solve specific game-related problems. At the end, you’ll have a hangman game that works like the demo above.&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The first step to building a good computer game is to come up with a good design. So, the design for your hangman game should begin with a good description of the game itself. You also need to have a general understanding of the common elements that make up a computer game. These two points are crucial for you to come up with a good design.&lt;/p&gt;
&lt;h3 id=&quot;description-of-the-hangman-game&quot;&gt;Description of the Hangman Game&lt;a class=&quot;headerlink&quot; href=&quot;#description-of-the-hangman-game&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;While many people know the game well, it’s helpful to have a formal description of the game. You can use this description to resolve programming issues later during development. As with many things in life, the exact description of a hangman game could vary from person to person. Here’s a possible description of the game:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Game setup&lt;/strong&gt;: The game of hangman is for two or more players, comprising a &lt;strong&gt;selecting player&lt;/strong&gt; and one or more &lt;strong&gt;guessing players&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Word selection&lt;/strong&gt;: The selecting player selects a word that the guessing players will try to guess.&lt;ul&gt;
&lt;li&gt;The selected word is traditionally represented as a series of underscores for each letter in the word.&lt;/li&gt;
&lt;li&gt;The selecting player also draws a scaffold to hold the hangman illustration.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Guessing&lt;/strong&gt;: The guessing players attempt to guess the word by selecting letters one at a time.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Feedback&lt;/strong&gt;: The selecting player indicates whether each guessed letter appears in the word.&lt;ul&gt;
&lt;li&gt;If the letter appears, then the selecting player replaces each underscore with the letter as it appears in the word.&lt;/li&gt;
&lt;li&gt;If the letter doesn’t appear, then the selecting player writes the letter in a list of guessed letters. Then, they draw the next piece of the hanged man. To draw the hanged man, they begin with the head, then the torso, the arms, and the legs for a total of six parts.  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Winning conditions&lt;/strong&gt;: The selecting player wins if the hanged man drawing is complete after six incorrect guesses, in which case the game is over. The guessing players win if they guess the word.&lt;ul&gt;
&lt;li&gt;If the guess is right, the game is over, and the guessing players win.&lt;/li&gt;
&lt;li&gt;If the guess is wrong, the game continues.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A game in progress is shown below. In this game, the word to be guessed is &lt;em&gt;hangman&lt;/em&gt;:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/Hangman_CLI_-_page_22.2b446e354404.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/Hangman_CLI_-_page_22.2b446e354404.png&quot; width=&quot;1000&quot; height=&quot;1350&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Hangman_CLI_-_page_22.2b446e354404.png&amp;amp;w=250&amp;amp;sig=430e659223daa02cf6f239f44419e96f90890bd8 250w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Hangman_CLI_-_page_22.2b446e354404.png&amp;amp;w=333&amp;amp;sig=6f84d2eb1a83d96259ffe306bef461078240815b 333w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/Hangman_CLI_-_page_22.2b446e354404.png&amp;amp;w=500&amp;amp;sig=0cbbe4bcb2a612d2833bc4106cf8e9cc8eaf4e9f 500w, https://files.realpython.com/media/Hangman_CLI_-_page_22.2b446e354404.png 1000w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;A game of hangman in progress&quot; data-asset=&quot;2977&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;In this tutorial, to write the hangman game in Python, you’ll make a few additional design decisions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The game will be between the &lt;strong&gt;computer&lt;/strong&gt; and &lt;strong&gt;one human player&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;computer&lt;/strong&gt; will act as the selecting player and will &lt;strong&gt;select&lt;/strong&gt; the word to guess, &lt;strong&gt;process&lt;/strong&gt; human input, and &lt;strong&gt;handle&lt;/strong&gt; all output.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;human&lt;/strong&gt; player is the &lt;strong&gt;guessing player&lt;/strong&gt;, hereafter simply referred to as the &lt;em&gt;player&lt;/em&gt;. When the player knows the word, they continue to guess correct letters until the word is complete.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With this basic understanding of the game and some design decisions for the computer version, you can begin creating the game. First, however, you need to know the common elements of computer games and understand how they interact to produce the desired result.&lt;/p&gt;
&lt;h3 id=&quot;common-elements-of-a-computer-game&quot;&gt;Common Elements of a Computer Game&lt;a class=&quot;headerlink&quot; href=&quot;#common-elements-of-a-computer-game&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Every game, whether it’s a computer game or not, has a set of elements that make it a game. Without these elements, there’s no game:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Initial setup&lt;/strong&gt;: You get the game ready to play. This might mean setting the pieces on a chess board, dealing out cards, or rolling dice to see who goes first.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Gameplay&lt;/strong&gt;: When people think of the game, this is what they normally think of. The flow of gameplay is controlled by a &lt;strong&gt;game loop&lt;/strong&gt;, which keeps the game moving and doesn’t end until the game is over. The game loop ensures the following happens:&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;user input&lt;/strong&gt; is gathered and processed.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;game state&lt;/strong&gt; is updated based on reactions to the user input. This may include checking for &lt;strong&gt;end-of-game conditions&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Any required &lt;strong&gt;output&lt;/strong&gt; changes are made to reflect the new game state.&lt;/li&gt;
&lt;li&gt;The game loop repeats.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Game ending&lt;/strong&gt;: How the game ends depends on the game itself. Whether capturing the enemy king in checkmate, achieving a certain score in a card game, or having your piece cross the line in a board game, certain conditions determine the end of the game and the winner.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All games have a game loop. For example, in a chess game, you first set the pieces on the board and declare the current player. Then the game loop begins:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-hangman/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-hangman/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using the bpython Enhanced REPL</title>
      <id>https://realpython.com/courses/using-bpython-enhanced-repl/</id>
      <link href="https://realpython.com/courses/using-bpython-enhanced-repl/"/>
      <updated>2023-10-31T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn about bpython, an alternative Python REPL that brings code suggestions and many other IDE-like features to the terminal. Once you discover how much bpython can improve your productivity, you&#x27;ll never want to return to using the vanilla Python REPL again.</summary>
      <content type="html">
        &lt;p&gt;The standard Python interpreter lets you &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;run scripts&lt;/a&gt; from files or &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interactively execute code&lt;/a&gt; on the fly in a so-called &lt;strong&gt;read-evaluate-print loop (REPL)&lt;/strong&gt;. While this is a powerful tool for exploring the language and discovering its libraries through instant feedback on your code inputs, the default REPL shipped with Python has several limitations. Luckily, alternatives like &lt;strong&gt;bpython&lt;/strong&gt; offer a much more programmer-friendly and convenient experience.&lt;/p&gt;
&lt;p&gt;You can use bpython to experiment with your code or quickly test an idea without switching contexts between different programs, just like in an &lt;strong&gt;integrated development environment (IDE)&lt;/strong&gt;. In addition, bpython may be a valuable teaching tool in either a virtual or physical classroom.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install and use bpython as your &lt;strong&gt;alternative Python REPL&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Boost your &lt;strong&gt;productivity&lt;/strong&gt; thanks to bpython&amp;rsquo;s unique features&lt;/li&gt;
&lt;li&gt;Tweak bpython&amp;rsquo;s &lt;strong&gt;configuration&lt;/strong&gt; and its &lt;strong&gt;color theme&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use common &lt;strong&gt;keyboard shortcuts&lt;/strong&gt; to code more quickly&lt;/li&gt;
&lt;li&gt;Contribute to bpython&amp;rsquo;s &lt;strong&gt;open-source&lt;/strong&gt; project on GitHub&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Before starting this course, make sure you&amp;rsquo;re already familiar with &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;Python basics&lt;/a&gt; and know how to start the &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;standard Python REPL&lt;/a&gt; in the command line. In addition, you should be able to &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;install packages with &lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;, ideally into a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #178: Guiding Scientific Python Library Development</title>
      <id>https://realpython.com/podcasts/rpp/178/</id>
      <link href="https://realpython.com/podcasts/rpp/178/"/>
      <updated>2023-10-27T12:00:00+00:00</updated>
      <summary>How do you prepare a scientific Python project for sharing with others? Could you use some best practices and guidance for packaging, documentation, and testing? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;How do you prepare a scientific Python project for sharing with others? Could you use some best practices and guidance for packaging, documentation, and testing? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Basics Exercises: Building Systems With Classes</title>
      <id>https://realpython.com/courses/building-systems-classes-exercises/</id>
      <link href="https://realpython.com/courses/building-systems-classes-exercises/"/>
      <updated>2023-10-24T14:00:00+00:00</updated>
      <summary>In this Python Basics Exercises course, you&#x27;ll review how to work with classes to build complex systems in Python. By practicing composing classes, inheriting from other classes, and overriding class behavior, you&#x27;ll harness the power of object-oriented programming (OOP).</summary>
      <content type="html">
        &lt;p&gt;In &lt;a href=&quot;https://realpython.com/courses/python-basics-class/&quot;&gt;Python Basics: Building Systems With Classes&lt;/a&gt;, you moved beyond the basics of object-oriented programming (OOP), and started to put those classes to work. In this exercise course you will employ these capabilities to build more complex systems and write readable, reusable code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll practice the following:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Compose&lt;/strong&gt; classes together to create layers of functionality&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Inherit&lt;/strong&gt; and &lt;strong&gt;override&lt;/strong&gt; behavior from other classes to create variations&lt;/li&gt;
&lt;li&gt;Creatively &lt;strong&gt;mix&lt;/strong&gt; and &lt;strong&gt;match&lt;/strong&gt; these approaches&lt;/li&gt;
&lt;li&gt;Instantiate classes with &lt;strong&gt;attributes&lt;/strong&gt; and &lt;strong&gt;methods&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Override&lt;/strong&gt; methods from a parent class&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This video course is part of the Python Basics series, which accompanies &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Note that you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt; throughout this course. If you&amp;rsquo;re just getting started, then you might want to check out &lt;a href=&quot;https://realpython.com/courses/setting-up-python/&quot;&gt;Python Basics: Setting Up Python&lt;/a&gt; before diving into this course.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #177: Welcoming PyPI&#x27;s Safety &amp; Security Engineer Mike Fiedler</title>
      <id>https://realpython.com/podcasts/rpp/177/</id>
      <link href="https://realpython.com/podcasts/rpp/177/"/>
      <updated>2023-10-20T12:00:00+00:00</updated>
      <summary>You may remember a recent Python Package Index (PyPI) announcement about hiring a full-time security engineer. We&#x27;ve also mentioned several current security initiatives from PyPI. This week on the show, we talk with Mike Fiedler about accepting this new role and securing accounts on PyPI.</summary>
      <content type="html">
        &lt;p&gt;You may remember a recent Python Package Index (PyPI) announcement about hiring a full-time security engineer. We&#x27;ve also mentioned several current security initiatives from PyPI. This week on the show, we talk with Mike Fiedler about accepting this new role and securing accounts on PyPI.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Basics Exercises: Object-Oriented Programming</title>
      <id>https://realpython.com/courses/object-oriented-programming-exercises/</id>
      <link href="https://realpython.com/courses/object-oriented-programming-exercises/"/>
      <updated>2023-10-17T14:00:00+00:00</updated>
      <summary>In this Python Basics Exercises course, you&#x27;ll review OOP, or object-oriented programming. You&#x27;ll practice creating classes, using classes to create new objects, and instantiating classes with attributes.</summary>
      <content type="html">
        &lt;p&gt;In &lt;a href=&quot;https://realpython.com/courses/python-basics-oop/&quot;&gt;Python Basics: Object-Oriented Programming&lt;/a&gt;, you learned how OOP, or object-oriented programming, is a method of structuring a program by bundling related properties and behaviors into individual objects.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll practice the following:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a &lt;strong&gt;&lt;code&gt;class&lt;/code&gt;&lt;/strong&gt;, which is like a blueprint for creating an object&lt;/li&gt;
&lt;li&gt;Use classes to create new &lt;strong&gt;objects&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Instantiate classes with &lt;strong&gt;attributes&lt;/strong&gt; and &lt;strong&gt;methods&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use dunder methods like &lt;strong&gt;init&lt;/strong&gt;() and &lt;strong&gt;str&lt;/strong&gt;()&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This video course is part of the Python Basics series, which accompanies &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. You can also check out the other &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics courses&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Note that you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt; throughout this course.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #176: Building Python Best Practices and Fundamental Skills</title>
      <id>https://realpython.com/podcasts/rpp/176/</id>
      <link href="https://realpython.com/podcasts/rpp/176/"/>
      <updated>2023-10-13T12:00:00+00:00</updated>
      <summary>What fundamental developer skills are new Python users missing? What best practices might developers without a computer science background be lacking? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What fundamental developer skills are new Python users missing? What best practices might developers without a computer science background be lacking? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using Python&#x27;s min() and max()</title>
      <id>https://realpython.com/courses/python-min-max/</id>
      <link href="https://realpython.com/courses/python-min-max/"/>
      <updated>2023-10-10T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to use Python&#x27;s built-in min() and max() functions to find the smallest and largest values. You&#x27;ll also learn how to modify their standard behavior by providing a suitable key function. Finally, you&#x27;ll code a few practical examples of using min() and max().</summary>
      <content type="html">
        &lt;p&gt;Python&amp;rsquo;s built-in &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; functions come in handy when you need to find the &lt;strong&gt;smallest&lt;/strong&gt; and &lt;strong&gt;largest&lt;/strong&gt; values in an &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-iterable&quot;&gt;iterable&lt;/a&gt; or in a series of &lt;strong&gt;regular arguments&lt;/strong&gt;. Even though these might seem like fairly basic computations, they turn out to have many interesting use cases in real-world programing. You&amp;rsquo;ll try out some of those use cases here.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use Python&amp;rsquo;s &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; to find &lt;strong&gt;smallest&lt;/strong&gt; and &lt;strong&gt;largest&lt;/strong&gt; values in your data&lt;/li&gt;
&lt;li&gt;Call &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; with a single &lt;strong&gt;iterable&lt;/strong&gt; or with any number of &lt;strong&gt;regular arguments&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; with &lt;strong&gt;strings&lt;/strong&gt; and &lt;strong&gt;dictionaries&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Tweak the behavior of &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; with the &lt;strong&gt;&lt;code&gt;key&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;default&lt;/code&gt;&lt;/strong&gt; arguments&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;comprehensions&lt;/strong&gt; and &lt;strong&gt;generator expressions&lt;/strong&gt; as arguments to &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once you have this knowledge under your belt, then you&amp;rsquo;ll be prepared to write a bunch of practical examples that will showcase the usefulness of &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt;. Finally, you&amp;rsquo;ll code your own versions of &lt;code&gt;min()&lt;/code&gt; and &lt;code&gt;max()&lt;/code&gt; in pure Python, which can help you understand how these functions work internally.&lt;/p&gt;
&lt;p&gt;To get the most out of this video course, you should have some previous knowledge of Python programming, including topics like &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/list-comprehension-python/&quot;&gt;list comprehensions&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/introduction-to-python-generators/#building-generators-with-generator-expressions&quot;&gt;generator expressions&lt;/a&gt;.&lt;/p&gt;
        &lt;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 #175: Exploring the New Features of Python 3.12</title>
      <id>https://realpython.com/podcasts/rpp/175/</id>
      <link href="https://realpython.com/podcasts/rpp/175/"/>
      <updated>2023-10-06T12:00:00+00:00</updated>
      <summary>Python 3.12 is here! Our regular guests, Geir Arne Hjelle and Christopher Trudeau, return to discuss the new version. Geir Arne coordinated a series of preview articles with several members of the Real Python team this year, and his showcase tutorial, &quot;Python 3.12: Cool New Features for You to Try,&quot; came out on October 2. Christopher&#x27;s video course was posted the next day, covering the topics from the article with visual examples of Python 3.12 in action.</summary>
      <content type="html">
        &lt;p&gt;Python 3.12 is here! Our regular guests, Geir Arne Hjelle and Christopher Trudeau, return to discuss the new version. Geir Arne coordinated a series of preview articles with several members of the Real Python team this year, and his showcase tutorial, &quot;Python 3.12: Cool New Features for You to Try,&quot; came out on October 2. Christopher&#x27;s video course was posted the next day, covering the topics from the article with visual examples of Python 3.12 in action.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>What&#x27;s New in Python 3.12</title>
      <id>https://realpython.com/courses/new-features-python-312/</id>
      <link href="https://realpython.com/courses/new-features-python-312/"/>
      <updated>2023-10-03T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll explore the new features that Python 3.12 brings to the table. These include improved f-strings, better error messages, changes to CPython internals, additions to static typing, and more.</summary>
      <content type="html">
        &lt;p&gt;It&amp;rsquo;s that time of year again, time for a new release of Python. Although &lt;strong&gt;Python 3.12&lt;/strong&gt;
mostly focuses on internal improvements, there&amp;rsquo;s a little something for
everyone. You can read up on all the new features by checking out the &lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html&quot;&gt;changelog&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn about the following changes:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Improvements to &lt;strong&gt;f-strings&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;More &lt;strong&gt;did-you-mean error messages&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;New features&lt;/strong&gt; in the standard library&lt;/li&gt;
&lt;li&gt;Additions to &lt;strong&gt;static typing&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Changes to the &lt;strong&gt;CPython interpreter&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this video course, you&amp;rsquo;ll explore these changes and see how this new version of
Python can work for you.&lt;/p&gt;
&lt;p&gt;If you want to try any of the examples in this video course, then you&amp;rsquo;ll need to use Python 3.12. The &lt;a href=&quot;https://realpython.com/installing-python/&quot;&gt;Python 3 Installation &amp;amp; Setup Guide&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-pre-release/&quot;&gt;How Can You Install a Pre-Release Version of Python?&lt;/a&gt; walk you through several options for adding a new version of Python to your system.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #174: Considering ChatGPT&#x27;s Technical Review of a Programming Book</title>
      <id>https://realpython.com/podcasts/rpp/174/</id>
      <link href="https://realpython.com/podcasts/rpp/174/"/>
      <updated>2023-09-29T12:00:00+00:00</updated>
      <summary>What can you learn from feeding an entire book on Python programming into ChatGPT-4 and asking it to provide a technical review? What are the potential pitfalls of using an LLM as a learning tool? This week on the show, author Al Sweigart talks about his recent experiments using ChatGPT and Python.</summary>
      <content type="html">
        &lt;p&gt;What can you learn from feeding an entire book on Python programming into ChatGPT-4 and asking it to provide a technical review? What are the potential pitfalls of using an LLM as a learning tool? This week on the show, author Al Sweigart talks about his recent experiments using ChatGPT and Python.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Basics Exercises: Conditional Logic and Control Flow</title>
      <id>https://realpython.com/courses/conditional-logic-control-flow-exercises/</id>
      <link href="https://realpython.com/courses/conditional-logic-control-flow-exercises/"/>
      <updated>2023-09-26T14:00:00+00:00</updated>
      <summary>In this Python Basics Exercises course, you&#x27;ll review how to use conditional logic to write programs that perform different actions based on different conditions. Paired with functions and loops, conditional logic allows you to write complex programs that can handle many different situations.</summary>
      <content type="html">
        &lt;p&gt;In &lt;a href=&quot;https://realpython.com/courses/basics-conditional-logic-control-flow/&quot;&gt;Python Basics: Conditional Logic and Control Flow&lt;/a&gt;, you learned that much of the Python code you&amp;rsquo;ll write is unconditional. That is, the code doesn&amp;rsquo;t make any choices. Every line of code is executed in the order that it&amp;rsquo;s written or in the order that functions are called, with possible repetitions inside loops.&lt;/p&gt;
&lt;p&gt;In this course, you&amp;rsquo;ll revisit how to use conditional logic to write programs that perform different actions based on different conditions. Paired with functions and loops, conditional logic allows you to write complex programs that can handle many different situations.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll use the following:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Boolean comparators&lt;/strong&gt;: &lt;code&gt;==&lt;/code&gt;, &lt;code&gt;!=&lt;/code&gt;, &lt;code&gt;&amp;lt;&lt;/code&gt;, &lt;code&gt;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;=&lt;/code&gt;, &lt;code&gt;&amp;gt;=&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Logical operators&lt;/strong&gt;: &lt;code&gt;and&lt;/code&gt;, &lt;code&gt;or&lt;/code&gt;, &lt;code&gt;not&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Conditional logic&lt;/strong&gt;: &lt;code&gt;if&lt;/code&gt; &amp;hellip; &lt;code&gt;elif&lt;/code&gt; &amp;hellip; &lt;code&gt;else&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Exception handling&lt;/strong&gt;: &lt;code&gt;try&lt;/code&gt; &amp;hellip; &lt;code&gt;except&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Loops&lt;/strong&gt;: &lt;code&gt;for&lt;/code&gt;, &lt;code&gt;while&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Control flow statements&lt;/strong&gt;: &lt;code&gt;break&lt;/code&gt;, &lt;code&gt;continue&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ultimately, you&amp;rsquo;ll bring all of your knowledge together to build a &lt;strong&gt;text-based role-playing game&lt;/strong&gt;. Along the way, you&amp;rsquo;ll also get some insight into how to tackle coding challenges in general, which can be a great way to level up as a developer.&lt;/p&gt;
&lt;p&gt;This video course is part of the Python Basics series, which accompanies &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;. You can also check out the other &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics courses&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Note that you&amp;rsquo;ll be using &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt; throughout this course.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #173: Getting Involved in Open Source &amp; Generating QR Codes With Python</title>
      <id>https://realpython.com/podcasts/rpp/173/</id>
      <link href="https://realpython.com/podcasts/rpp/173/"/>
      <updated>2023-09-22T12:00:00+00:00</updated>
      <summary>Have you thought about contributing to an open-source Python project? What are possible entry points for intermediate developers? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you thought about contributing to an open-source Python project? What are possible entry points for intermediate developers? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  

</feed>
