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

  
    <entry>
      <title>Iterators and Iterables in Python: Run Efficient Iterations</title>
      <id>https://realpython.com/python-iterators-iterables/</id>
      <link href="https://realpython.com/python-iterators-iterables/"/>
      <updated>2023-03-01T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn what iterators and iterables are in Python. You&#x27;ll learn how they differ and when to use them in your code. You&#x27;ll also learn how to create your own iterators and iterables to make data processing more efficient.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;strong&gt;iterators&lt;/strong&gt; and &lt;strong&gt;iterables&lt;/strong&gt; are two different but related tools that come in handy when you need to iterate over a data stream or container. Iterators power and control the iteration process, while iterables typically hold data that you want to iterate over one value at a time.&lt;/p&gt;
&lt;p&gt;Iterators and iterables are fundamental components of Python programming, and you’ll have to deal with them in almost all your programs. Learning how they work and how to create them is key for you as a Python developer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create &lt;strong&gt;iterators&lt;/strong&gt; using the &lt;strong&gt;iterator protocol&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;Understand the &lt;strong&gt;differences&lt;/strong&gt; between iterators and iterables&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Work&lt;/strong&gt; with iterators and iterables in your Python code&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;generator functions&lt;/strong&gt; and the &lt;strong&gt;&lt;code&gt;yield&lt;/code&gt; statement&lt;/strong&gt; to create &lt;strong&gt;generator iterators&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Build your own &lt;strong&gt;iterables&lt;/strong&gt; using different techniques, such as the &lt;strong&gt;iterable protocol&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;asyncio&lt;/code&gt; module and the &lt;code&gt;await&lt;/code&gt; and &lt;code&gt;async&lt;/code&gt; keywords to create &lt;strong&gt;asynchronous iterators&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Before diving deeper into these topics, you should be familiar with some core concepts like &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;loops and iteration&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/inheritance-composition-python/&quot;&gt;inheritance&lt;/a&gt;, &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-special-method&quot;&gt;special methods&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/async-io-python/&quot;&gt;asynchronous programming&lt;/a&gt; in Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Sample Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-iterators-iterables-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-iterators-iterables-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 and create iterators and iterables for more efficient data processing.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;understanding-iteration-in-python&quot;&gt;Understanding Iteration in Python&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-iteration-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When writing computer programs, you often need to repeat a given piece of code multiple times. To do this, you can follow one of the following approaches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Repeating the target code as many times as you need in a sequence&lt;/li&gt;
&lt;li&gt;Putting the target code in a loop that runs as many times as you need&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The first approach has a few drawbacks. The most troublesome issue is the repetitive code itself, which is hard to maintain and not scalable. For example, the following code will print a greeting message on your screen three times:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# greeting.py&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;run this script&lt;/a&gt;, then you’ll get &lt;code&gt;&#x27;Hello!&#x27;&lt;/code&gt; printed on your screen three times. This code works. However, what if you decide to update your code to print &lt;code&gt;&#x27;Hello, World!&#x27;&lt;/code&gt; instead of just &lt;code&gt;&#x27;Hello!&#x27;&lt;/code&gt;? In that case, you’ll have to update the greeting message three times, which is a maintenance burden.&lt;/p&gt;
&lt;p&gt;Now imagine a similar situation but with a larger and more complex piece of code. It can become a nightmare for maintainers.&lt;/p&gt;
&lt;p&gt;Using a loop will be a much better way to solve the problem and avoid the maintainability issue. Loops allow you to run a piece of code as often as you need. Consider how you’d write the above example using a &lt;code&gt;while&lt;/code&gt; loop:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This &lt;code&gt;while&lt;/code&gt; loop runs as long as the loop-continuation condition (&lt;code&gt;times &amp;lt; 3&lt;/code&gt;) remains true. In each iteration, the loop prints your greeting message and increments the control variable, &lt;code&gt;times&lt;/code&gt;. Now, if you decide to update your message, then you just have to modify one line, which makes your code way more maintainable.&lt;/p&gt;
&lt;p&gt;Python’s &lt;code&gt;while&lt;/code&gt; loop supports what’s known as &lt;a href=&quot;https://realpython.com/python-while-loop/&quot;&gt;indefinite iteration&lt;/a&gt;, which means executing the same block of code over and over again, a potentially undefined number of times.&lt;/p&gt;
&lt;p&gt;You’ll also find a different but similar type of iteration known as &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;definite iteration&lt;/a&gt;, which means going through the same code a predefined number of times. This kind of iteration is especially useful when you need to iterate over the items of a data stream one by one in a loop.&lt;/p&gt;
&lt;p&gt;To run an iteration like this, you typically use a &lt;code&gt;for&lt;/code&gt; loop in Python:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this example, the &lt;code&gt;numbers&lt;/code&gt; &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;list&lt;/a&gt; represents your stream of data, which you’ll generically refer to as an &lt;a href=&quot;#getting-to-know-python-iterables&quot;&gt;iterable&lt;/a&gt; because you can iterate over it, as you’ll learn later in this tutorial. The loop goes over each value in &lt;code&gt;numbers&lt;/code&gt; and prints it to your screen.&lt;/p&gt;
&lt;p&gt;When you use a &lt;code&gt;while&lt;/code&gt; or &lt;code&gt;for&lt;/code&gt; loop to repeat a piece of code several times, you’re actually running an &lt;strong&gt;iteration&lt;/strong&gt;. That’s the name given to the process itself.&lt;/p&gt;
&lt;p&gt;In Python, if your iteration process requires going through the values or items in a data collection one item at a time, then you’ll need another piece to complete the puzzle. You’ll need an &lt;strong&gt;iterator&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&quot;getting-to-know-python-iterators&quot;&gt;Getting to Know Python Iterators&lt;a class=&quot;headerlink&quot; href=&quot;#getting-to-know-python-iterators&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Iterators were added to Python &lt;a href=&quot;https://docs.python.org/3/whatsnew/2.2.html#pep-234-iterators&quot;&gt;2.2&lt;/a&gt; through &lt;a href=&quot;https://peps.python.org/pep-0234/&quot;&gt;PEP 234&lt;/a&gt;. They were a significant addition to the language because they unified the iteration process and &lt;a href=&quot;https://en.wikipedia.org/wiki/Abstraction_(computer_science)&quot;&gt;abstracted&lt;/a&gt; it away from the actual implementation of collection or &lt;a href=&quot;https://en.wikipedia.org/wiki/Container_(data_structure)&quot;&gt;container&lt;/a&gt; data types. This abstraction allows iteration over unordered collections, such as sets, ensuring every element is visited exactly once.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-iterators-iterables/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-iterators-iterables/ »&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>Writing Clean, Pythonic Code With namedtuple</title>
      <id>https://realpython.com/courses/python-namedtuple/</id>
      <link href="https://realpython.com/courses/python-namedtuple/"/>
      <updated>2023-02-28T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn what Python&#x27;s namedtuple is and how to use it in your code. You&#x27;ll also learn about the main differences between named tuples and other data structures, such as dictionaries, data classes, and typed named tuples.</summary>
      <content type="html">
        &lt;p&gt;Python&amp;rsquo;s &lt;a href=&quot;https://docs.python.org/3/library/collections.html#module-collections&quot;&gt;&lt;code&gt;collections&lt;/code&gt;&lt;/a&gt; module provides a &lt;a href=&quot;https://en.wikipedia.org/wiki/Factory_(object-oriented_programming)&quot;&gt;factory function&lt;/a&gt; called &lt;a href=&quot;https://docs.python.org/3/library/collections.html#collections.namedtuple&quot;&gt;&lt;code&gt;namedtuple()&lt;/code&gt;&lt;/a&gt;, which is specially designed to make your code more &lt;strong&gt;Pythonic&lt;/strong&gt; when you&amp;rsquo;re working with tuples. With &lt;code&gt;namedtuple()&lt;/code&gt;, you can create &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-immutable&quot;&gt;immutable&lt;/a&gt; sequence types that allow you to access their values using descriptive field names and the &lt;strong&gt;dot notation&lt;/strong&gt; instead of unclear integer indices.&lt;/p&gt;
&lt;p&gt;If you have some experience using Python, then you know that writing Pythonic code is a core skill for Python developers. In this video course, you&amp;rsquo;ll level up that skill using &lt;code&gt;namedtuple&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create &lt;code&gt;namedtuple&lt;/code&gt; classes using &lt;strong&gt;&lt;code&gt;namedtuple()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Identify and take advantage of &lt;strong&gt;cool features&lt;/strong&gt; of &lt;code&gt;namedtuple&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;namedtuple&lt;/code&gt; instances to write &lt;strong&gt;Pythonic code&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Decide whether to use a &lt;code&gt;namedtuple&lt;/code&gt; or a &lt;strong&gt;similar data structure&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Subclass&lt;/strong&gt; a &lt;code&gt;namedtuple&lt;/code&gt; to provide new features&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this course, you need to have a general understanding of Python&amp;rsquo;s philosophy related to &lt;a href=&quot;https://realpython.com/learning-paths/writing-pythonic-code/&quot;&gt;writing Pythonic and readable code&lt;/a&gt;. You also need to know the basics of working with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;Tuples&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;Dictionaries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;Classes and object-oriented programming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-data-classes/&quot;&gt;Data classes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you don&amp;rsquo;t have all the required knowledge before starting this video course, then that&amp;rsquo;s okay! You can stop and review the above resources as needed.&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 NumPy reshape() to Change the Shape of an Array</title>
      <id>https://realpython.com/numpy-reshape/</id>
      <link href="https://realpython.com/numpy-reshape/"/>
      <updated>2023-02-27T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to use NumPy reshape() to rearrange the data in an array. You&#x27;ll learn to increase and decrease the number of dimensions and to configure the data in the new array to suit your requirements.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The main data structure that you’ll use in &lt;a href=&quot;https://realpython.com/numpy-tutorial/&quot;&gt;NumPy&lt;/a&gt; is the &lt;a href=&quot;https://numpy.org/doc/stable/reference/arrays.ndarray.html&quot;&gt;N-dimensional array&lt;/a&gt;. An array can have one or more dimensions to structure your data. In some programs, you may need to change how you organize your data within a NumPy array. You can use NumPy’s &lt;strong&gt;&lt;code&gt;reshape()&lt;/code&gt;&lt;/strong&gt; to rearrange the data.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://numpy.org/doc/stable/glossary.html#term-shape&quot;&gt;shape&lt;/a&gt; of an array describes the number of dimensions in the array and the length of each dimension. In this tutorial, you’ll learn how to change the shape of a NumPy array to place all its data in a different configuration. When you complete this tutorial, you’ll be able to alter the shape of any array to suit your application’s needs.&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;Change the shape&lt;/strong&gt; of a NumPy array without changing its number of dimensions&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Add and remove dimensions&lt;/strong&gt; in a NumPy array&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Control how data is rearranged&lt;/strong&gt; when reshaping an array with the &lt;code&gt;order&lt;/code&gt; parameter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Use a wildcard value&lt;/strong&gt; of &lt;code&gt;-1&lt;/code&gt; for one of the dimensions in &lt;code&gt;reshape()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For this tutorial, you should be familiar with the basics of NumPy and N-dimensional arrays. You can read &lt;a href=&quot;https://realpython.com/numpy-tutorial/&quot;&gt;NumPy Tutorial: Your First Steps Into Data Science in Python&lt;/a&gt; to learn more about NumPy before diving in.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Supplemental Material:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/numpy-reshape-repository/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-numpy-reshape-repository&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the image repository&lt;/a&gt; that you’ll use with NumPy &lt;code&gt;reshape()&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;install-numpy&quot;&gt;Install NumPy&lt;a class=&quot;headerlink&quot; href=&quot;#install-numpy&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’ll need to install NumPy to your environment to run the code in this tutorial and explore &lt;code&gt;reshape()&lt;/code&gt;. You can install the package using &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt; within a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;. Select either the Windows or Linux + macOS tab below to see instructions for your operating system:&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

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




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

&lt;/ul&gt;
&lt;div class=&quot;tab-content mt-2 mb-0 js-platform-widget-content&quot;&gt;
&lt;div aria-labelledby=&quot;windows-tab-1&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight pscon&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&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;numpy&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python -m venv venv
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; venv/bin/activate
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python -m pip install numpy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;It’s a convention to use the alias &lt;code&gt;np&lt;/code&gt; when you import NumPy. To get started, you can import NumPy in the &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;Python REPL&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;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;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now that you’ve installed NumPy and imported the package in a REPL environment, you’re ready to start working with NumPy arrays.  &lt;/p&gt;
&lt;h2 id=&quot;understand-the-shape-of-numpy-arrays&quot;&gt;Understand the Shape of NumPy Arrays&lt;a class=&quot;headerlink&quot; href=&quot;#understand-the-shape-of-numpy-arrays&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’ll use NumPy’s &lt;a href=&quot;https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html&quot;&gt;&lt;code&gt;ndarray&lt;/code&gt;&lt;/a&gt;  in this tutorial. In this section, you’ll review the key features of this data structure, including an array’s overall &lt;a href=&quot;https://numpy.org/doc/stable/glossary.html#term-shape&quot;&gt;shape&lt;/a&gt; and number of &lt;a href=&quot;https://numpy.org/doc/stable/glossary.html#term-axis&quot;&gt;dimensions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can create an array from a list of lists:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;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;numbers&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;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&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;numbers&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;array([[1, 2, 3, 4],&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;       [5, 6, 7, 8]])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The function &lt;a href=&quot;https://numpy.org/doc/stable/reference/generated/numpy.array.html&quot;&gt;&lt;code&gt;np.array()&lt;/code&gt;&lt;/a&gt; returns an object of type &lt;a href=&quot;https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html&quot;&gt;&lt;code&gt;np.ndarray&lt;/code&gt;&lt;/a&gt;. This data structure is the main data type in NumPy.&lt;/p&gt;
&lt;p&gt;You can describe the shape of an array using the length of each dimension of the array. NumPy represents this as a tuple of integers. The array &lt;code&gt;numbers&lt;/code&gt; has two rows and four columns. Therefore, this array has a &lt;code&gt;(2, 4)&lt;/code&gt; shape:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(2, 4)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can represent the same data using a different shape:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/numpy-reshape-24-42.679add5e8d11.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/numpy-reshape-24-42.679add5e8d11.png&quot; width=&quot;800&quot; height=&quot;800&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/numpy-reshape-24-42.679add5e8d11.png&amp;amp;w=200&amp;amp;sig=fe6792f8865ca498a6b77f2d8d48bd9d5e6b9837 200w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/numpy-reshape-24-42.679add5e8d11.png&amp;amp;w=266&amp;amp;sig=9779c6c91acaa0b8f6226c76e8a43b489ee1b2e5 266w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/numpy-reshape-24-42.679add5e8d11.png&amp;amp;w=400&amp;amp;sig=9b7ffac39d35910b9ad305fdfa5c40a803f2955a 400w, https://files.realpython.com/media/numpy-reshape-24-42.679add5e8d11.png 800w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Visual representation of NumPy arrays with different shapes&quot; data-asset=&quot;4894&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;Both of these arrays contain the same data. The array with the shape &lt;code&gt;(2, 4)&lt;/code&gt; has two rows and four columns and the array with the shape &lt;code&gt;(4, 2)&lt;/code&gt; has four rows and two columns. You can check the number of dimensions of an array using &lt;code&gt;.ndim&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ndim&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The array &lt;code&gt;numbers&lt;/code&gt; is two-dimensional (2D). You can arrange the same data contained in &lt;code&gt;numbers&lt;/code&gt; in arrays with a different number of dimensions:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/numpy-reshape/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/numpy-reshape/ »&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 #146: Using NumPy and Linear Algebra for Faster Python Code</title>
      <id>https://realpython.com/podcasts/rpp/146/</id>
      <link href="https://realpython.com/podcasts/rpp/146/"/>
      <updated>2023-02-24T12:00:00+00:00</updated>
      <summary>Are you still using loops and lists to process your data in Python? Have you heard of a Python library with optimized data structures and built-in operations that can speed up your data science code? This week on the show, Jodie Burchell, developer advocate for data science at JetBrains, returns to share secrets for harnessing linear algebra and NumPy for your projects.</summary>
      <content type="html">
        &lt;p&gt;Are you still using loops and lists to process your data in Python? Have you heard of a Python library with optimized data structures and built-in operations that can speed up your data science code? This week on the show, Jodie Burchell, developer advocate for data science at JetBrains, returns to share secrets for harnessing linear algebra and NumPy for your 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>The Terminal: First Steps and Useful Commands</title>
      <id>https://realpython.com/terminal-commands/</id>
      <link href="https://realpython.com/terminal-commands/"/>
      <updated>2023-02-22T14:00:00+00:00</updated>
      <summary>The terminal is an essential tool in your journey as a Python developer.
This tutorial helps you to get started with the terminal, pip, and Git by showcasing interesting commands that you can incorporate into your workflow.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The terminal can be intimidating to work with when you’re used to working with graphical user interfaces (GUIs). However, it’s an important tool that you need to get used to in your journey as a Python developer.
And once you level up your skill of using the terminal, it becomes an extremely powerful tool in your repertoire. With just a few commands in the terminal, you can do tasks that are impossible or at least very tedious to do in a GUI.&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;Find the terminal&lt;/strong&gt; on your operating system&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Open the terminal&lt;/strong&gt; for the first time&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Navigate your file system&lt;/strong&gt; with basic commans&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Create files and folders&lt;/strong&gt; with the terminal&lt;/li&gt;
&lt;li&gt;Manage packages with &lt;strong&gt;&lt;code&gt;pip&lt;/code&gt; commands&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Keep track of your files with &lt;strong&gt;Git in the terminal&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you’re new to working with the terminal, or you’re looking to expand your understanding of its capabilities, then this tutorial is a great starting point. In it, you’ll get an introduction to some of the basic commands and learn how to use &lt;code&gt;pip&lt;/code&gt; and Git to manage your projects in the terminal. &lt;/p&gt;
&lt;p&gt;Understanding how to integrate the terminal, &lt;code&gt;pip&lt;/code&gt;, and Git into your workflows is essential for you as a Python developer. 
However, it’s important to note that you’ll only scratch the surface of what the terminal can do, and there’s much more to learn as you continue to explore the terminal as an essential development tool.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/terminal-commands-cheat-sheet/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-terminal-commands-cheat-sheet&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get a free cheat sheet&lt;/a&gt; of useful commands to get you started working with the terminal.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;install-and-open-the-terminal&quot;&gt;Install and Open the Terminal&lt;a class=&quot;headerlink&quot; href=&quot;#install-and-open-the-terminal&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Back in the day, the term &lt;em&gt;terminal&lt;/em&gt; referred to &lt;a href=&quot;https://en.wikipedia.org/wiki/Computer_terminal&quot;&gt;some clunky hardware&lt;/a&gt; that you used to enter data into a computer.
Nowadays, people are usually talking about a &lt;a href=&quot;https://en.wikipedia.org/wiki/terminal_emulator&quot;&gt;terminal emulator&lt;/a&gt; when they say &lt;strong&gt;terminal&lt;/strong&gt;, and they mean some kind of terminal software that you can find on most modern computers. &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; There are two other terms that you might hear now and then in combination with the terminal:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A &lt;strong&gt;shell&lt;/strong&gt; is the program that you interact with when running commands in a terminal.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;command-line interface (CLI)&lt;/strong&gt; is a program designed to run in a shell inside the terminal.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In other words, the shell provides the commands that you use in a command-line interface, and the terminal is the application that you run to access the shell.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;If you’re using a Linux or macOS machine, then the terminal is already built in.
You can start using it right away.&lt;/p&gt;
&lt;p&gt;On Windows, you also have access to command-line applications like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Cmd.exe&quot;&gt;Command Prompt&lt;/a&gt;.
However, for this tutorial and terminal work in general, you should use the Windows terminal application instead. &lt;/p&gt;
&lt;p&gt;Read on to learn how to install and open the terminal on Windows and how to find the terminal on Linux and macOS.&lt;/p&gt;
&lt;h3 id=&quot;windows&quot;&gt;Windows&lt;a class=&quot;headerlink&quot; href=&quot;#windows&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;Windows terminal&lt;/strong&gt; is a modern and feature-rich application that gives you access to the command line, multiple shells, and advanced customization options.
If you have Windows 11 or above, chances are that the Windows terminal is already present on your machine. 
Otherwise, you can download the application from the &lt;a href=&quot;https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701&quot;&gt;Microsoft Store&lt;/a&gt; or from the official &lt;a href=&quot;https://github.com/microsoft/terminal&quot;&gt;GitHub repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Before continuing with this tutorial, you need to get the terminal working on your Windows computer.
You can follow the &lt;a href=&quot;https://realpython.com/python-coding-setup-windows/&quot;&gt;Your Python Coding Environment on Windows: Setup Guide&lt;/a&gt; to learn &lt;a href=&quot;https://realpython.com/python-coding-setup-windows/#installing-windows-terminal&quot;&gt;how to install the Windows terminal&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After you install the Windows terminal, you can find it in the Start menu under &lt;em&gt;Terminal&lt;/em&gt;.
When you start the application, you should see a window that looks like this:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/win-10-setup-14-windows-powershell_-_cropped.f114376b1071.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/win-10-setup-14-windows-powershell_-_cropped.f114376b1071.png&quot; width=&quot;1024&quot; height=&quot;726&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/win-10-setup-14-windows-powershell_-_cropped.f114376b1071.png&amp;amp;w=256&amp;amp;sig=4c3ee571cd3620d957225bc6b4a59c0f2bbcbe2d 256w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/win-10-setup-14-windows-powershell_-_cropped.f114376b1071.png&amp;amp;w=341&amp;amp;sig=24b2c1140624d3c553c5108b2a21135533365fb9 341w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/win-10-setup-14-windows-powershell_-_cropped.f114376b1071.png&amp;amp;w=512&amp;amp;sig=ddd7cee1185bfbba047487f08ff8c17a511009f1 512w, https://files.realpython.com/media/win-10-setup-14-windows-powershell_-_cropped.f114376b1071.png 1024w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Windows Terminal with Windows PowerShell tab&quot; data-asset=&quot;4454&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;It can be handy to create a desktop shortcut for the terminal or pin the application to your task bar for easier access.&lt;/p&gt;
&lt;h3 id=&quot;linux&quot;&gt;Linux&lt;a class=&quot;headerlink&quot; href=&quot;#linux&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can find the terminal application in the application menu of your Linux distribution. 
Alternatively, you can press &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-alt&quot;&gt;Alt&lt;/kbd&gt;&lt;span&gt;+&lt;/span&gt;&lt;kbd class=&quot;key-t&quot;&gt;T&lt;/kbd&gt;&lt;/span&gt; on your keyboard or use the application launcher and search for the word &lt;em&gt;Terminal&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;After opening the terminal, you should see a window similar to the screenshot below:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/linux-terminal.28e537154512.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/linux-terminal.28e537154512.png&quot; width=&quot;1186&quot; height=&quot;701&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/linux-terminal.28e537154512.png&amp;amp;w=296&amp;amp;sig=632da48d85fe0b133fc17109968b4edc6ece5300 296w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/linux-terminal.28e537154512.png&amp;amp;w=395&amp;amp;sig=f5412898d783d1ecae1324cc3df3c39fe3b2f35e 395w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/linux-terminal.28e537154512.png&amp;amp;w=593&amp;amp;sig=e274951177bdb772fb216871ba08c4b7a6b90e55 593w, https://files.realpython.com/media/linux-terminal.28e537154512.png 1186w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Screenshot of the Linux terminal&quot; data-asset=&quot;4775&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;How you open the terminal may also depend on which Linux distribution you’re using. Each one has a different way of doing it.
If you have trouble opening the terminal on Linux, then the Real Python community will help you out in the comments below.&lt;/p&gt;
&lt;h3 id=&quot;macos&quot;&gt;macOS&lt;a class=&quot;headerlink&quot; href=&quot;#macos&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A common way to open the terminal application on macOS is by opening the &lt;a href=&quot;https://support.apple.com/en-us/guide/mac-help/mchlp1008/mac&quot;&gt;Spotlight Search&lt;/a&gt; and searching for &lt;em&gt;Terminal&lt;/em&gt;.
You can also find the terminal app in the application folder inside Finder.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/terminal-commands/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/terminal-commands/ »&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 Terminal on Windows</title>
      <id>https://realpython.com/courses/using-terminal-windows/</id>
      <link href="https://realpython.com/courses/using-terminal-windows/"/>
      <updated>2023-02-21T14:00:00+00:00</updated>
      <summary>In this Code Conversation video course, you&#x27;ll learn how to use the terminal on Windows.
You&#x27;ll navigate the file system with Philipp and Ian and perform common tasks like creating files and folders. If you&#x27;ve never used the terminal before, then this video course will help you get started.</summary>
      <content type="html">
        &lt;p&gt;The &lt;strong&gt;terminal&lt;/strong&gt; can be intimidating to work with when you&amp;rsquo;re used to working with graphical user interfaces. However, it&amp;rsquo;s an important tool that you need to get used to in your journey as a Python developer.
Even though you can substitute some workflows in the terminal with apps that contain a graphical user interface (GUI), you may need to open the terminal at some point in your life as a Python developer.&lt;/p&gt;
&lt;p&gt;In this &lt;strong&gt;Code Conversation&lt;/strong&gt;, you&amp;rsquo;ll follow a chat between Philipp and Ian as they perform common tasks in the terminal on Windows, such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Showing the current working directory&lt;/li&gt;
&lt;li&gt;Listing the contents of a folder&lt;/li&gt;
&lt;li&gt;Adding text to files without opening them&lt;/li&gt;
&lt;li&gt;Displaying the content of a file&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Along the way, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Find the terminal&lt;/strong&gt; on your operating system&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Open the terminal&lt;/strong&gt; for the first time&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Navigate your file system&lt;/strong&gt; with basic commands&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Create files and folders&lt;/strong&gt; with the terminal&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Run Python files&lt;/strong&gt; on Windows&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you&amp;rsquo;ve never worked with the terminal on Windows before or you want to see some interesting use cases to incorporate the terminal into your workflow, then this video course is the perfect start for you.&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>Develop Data Visualization Interfaces in Python With Dash</title>
      <id>https://realpython.com/python-dash/</id>
      <link href="https://realpython.com/python-dash/"/>
      <updated>2023-02-20T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to build a dashboard using Python and Dash. Dash is a framework for building data visualization interfaces. It helps data scientists build fully interactive web applications quickly.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In the past, creating analytical web applications was a task for seasoned developers that required knowledge of multiple programming languages and frameworks. That’s no longer the case. Nowadays, you can make data visualization interfaces using pure Python. One popular tool for this is &lt;a href=&quot;https://dash.plotly.com/introduction&quot;&gt;Dash&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Dash gives data scientists the ability to showcase their results in interactive web applications. You don’t need to be an expert in &lt;a href=&quot;https://realpython.com/learning-paths/become-python-web-developer/&quot;&gt;web development&lt;/a&gt;. In an afternoon, you can build and deploy a Dash app to share with others.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a &lt;strong&gt;Dash application&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use Dash &lt;strong&gt;core components&lt;/strong&gt; and &lt;strong&gt;HTML components&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Customize the style&lt;/strong&gt; of your Dash application&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;callbacks&lt;/strong&gt; to build interactive applications&lt;/li&gt;
&lt;li&gt;Deploy your application on &lt;strong&gt;PythonAnywhere&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can download the source code, data, and resources for the sample application that you’ll make in 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 the Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/dash-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-dash-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the source code you’ll use&lt;/a&gt; to learn about creating data visualization interfaces in Python with Dash in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;what-is-dash&quot;&gt;What Is Dash?&lt;a class=&quot;headerlink&quot; href=&quot;#what-is-dash&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Dash is an open-source framework for building data visualization interfaces. Released in 2017 as a Python library, it’s grown to include implementations for R, Julia, and F#. Dash helps data scientists build analytical web applications without requiring advanced web development knowledge.&lt;/p&gt;
&lt;p&gt;Three technologies constitute the core of Dash:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Flask&lt;/strong&gt; supplies the web server functionality.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React.js&lt;/strong&gt; renders the user interface of the web page.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Plotly.js&lt;/strong&gt; generates the charts used in your application.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;But you don’t have to worry about making all these technologies work together. Dash will do that for you. You just need to write Python, R, Julia, or F# and sprinkle in a bit of CSS.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://plotly.com/&quot;&gt;Plotly&lt;/a&gt;, a Canada-based company, built Dash and supports its development. You may know the company from the &lt;a href=&quot;https://plotly.com/graphing-libraries/&quot;&gt;popular graphing libraries&lt;/a&gt; that share its name. The company released Dash as open source under an &lt;a href=&quot;https://tldrlegal.com/license/mit-license&quot;&gt;MIT license&lt;/a&gt;, so you can use Dash at no cost.&lt;/p&gt;
&lt;p&gt;Plotly also offers a commercial companion to Dash called &lt;a href=&quot;https://plotly.com/dash/&quot;&gt;Dash Enterprise&lt;/a&gt;. This paid service provides companies with support services such as hosting, deploying, and handling authentication on Dash applications. But these features live outside of Dash’s open-source ecosystem.&lt;/p&gt;
&lt;p&gt;Dash will help you build dashboards quickly. If you’re used to analyzing data or building data visualizations using Python, then Dash will be a useful addition to your toolbox. Here are a few examples of what you can make with Dash:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://dash.gallery/self-driving/&quot;&gt;A dashboard showing object detection for self-driving cars&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://dash.gallery/dash-uber-rides-demo/&quot;&gt;A visualization of millions of Uber rides&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://dash.gallery/soccer-match-analytics/&quot;&gt;An interactive tool for analyzing soccer match data&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is just a tiny sample. If you’d like to see other interesting use cases, then go check out the &lt;a href=&quot;https://dash.gallery/&quot;&gt;Dash App Gallery&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; You don’t need advanced knowledge of web development to follow this tutorial, but some familiarity with &lt;a href=&quot;https://realpython.com/html-css-python/&quot;&gt;HTML and CSS&lt;/a&gt; won’t hurt.&lt;/p&gt;
&lt;p&gt;You should know the basics of the following topics, though:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Python graphing libraries such as Plotly, &lt;a href=&quot;https://realpython.com/python-data-visualization-bokeh/&quot;&gt;Bokeh&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-matplotlib-guide/&quot;&gt;Matplotlib&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;HTML and the &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Getting_started&quot;&gt;structure of an HTML file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Learn/CSS/First_steps/Getting_started&quot;&gt;CSS and style sheets&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;If you feel comfortable with the requirements and want to learn how to use Dash in your next project, then continue to the following section!&lt;/p&gt;
&lt;h2 id=&quot;get-started-with-dash-in-python&quot;&gt;Get Started With Dash in Python&lt;a class=&quot;headerlink&quot; href=&quot;#get-started-with-dash-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll go through the end-to-end process of building a dashboard using Dash. If you follow along with the examples, then you’ll go from a bare-bones dashboard on your local machine to a styled dashboard deployed on &lt;a href=&quot;https://www.pythonanywhere.com/&quot;&gt;PythonAnywhere&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To build the dashboard, you’ll use a &lt;a href=&quot;https://www.kaggle.com/neuromusic/avocado-prices&quot;&gt;dataset&lt;/a&gt; of sales and prices of avocados in the United States between 2015 and 2018. &lt;a href=&quot;https://justinkiggins.com/about&quot;&gt;Justin Kiggins&lt;/a&gt; compiled this dataset using data from the &lt;a href=&quot;https://www.hassavocadoboard.com/retail/volume-and-price-data&quot;&gt;Hass Avocado Board&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;how-to-set-up-your-local-environment&quot;&gt;How to Set Up Your Local Environment&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-set-up-your-local-environment&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To develop your app, you’ll need a new directory to store your code and data. You’ll also need a clean Python &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;. To create those, execute the commands below, choosing the version that matches your operating system:&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

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




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

&lt;/ul&gt;
&lt;div class=&quot;tab-content mt-2 mb-0 js-platform-widget-content&quot;&gt;
&lt;div aria-labelledby=&quot;windows-tab-1&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight pscon&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mkdir&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;avocado_analytics&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;avocado_analytics&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;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;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;mkdir avocado_analytics
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; avocado_analytics
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python -m venv venv
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; venv/bin/activate
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-dash/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-dash/ »&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 #145: Creating a Python Wordle Clone &amp; Testing Environments With Nox</title>
      <id>https://realpython.com/podcasts/rpp/145/</id>
      <link href="https://realpython.com/podcasts/rpp/145/"/>
      <updated>2023-02-17T12:00:00+00:00</updated>
      <summary>Would you like to practice your Python skills while building a challenging word game? Have you been wanting to learn more about creating command-line interfaces and  making them colorful and interactive? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Would you like to practice your Python skills while building a challenging word game? Have you been wanting to learn more about creating command-line interfaces and  making them colorful and interactive? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>How to Flush the Output of the Python Print Function</title>
      <id>https://realpython.com/python-flush-print-output/</id>
      <link href="https://realpython.com/python-flush-print-output/"/>
      <updated>2023-02-15T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to flush the output of Python&#x27;s print function. You&#x27;ll explore output stream buffering in Python using code examples and learn that output streams are block-buffered by default, and that print() with its default arguments executes line-buffered when interactive.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Do you want to build a compact visual progress indicator for your Python script using &lt;a href=&quot;https://realpython.com/python-print/&quot;&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/a&gt;, but your output doesn’t show up when you’d expect it to? Or are you piping the logs of your script to another application, but you can’t manage to access them in real time? In both cases, &lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Data_buffer&quot;&gt;data buffering&lt;/a&gt;&lt;/strong&gt; is the culprit, and you can solve your troubles by flushing the output of &lt;code&gt;print()&lt;/code&gt;.&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;Flush the output data buffer explicitly using the &lt;strong&gt;&lt;code&gt;flush&lt;/code&gt; parameter&lt;/strong&gt; of &lt;code&gt;print()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Change data buffering for a &lt;strong&gt;single function&lt;/strong&gt;, the &lt;strong&gt;whole script&lt;/strong&gt;, and even your entire &lt;strong&gt;Python environment&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Determine &lt;strong&gt;when&lt;/strong&gt; you need to flush the data buffer explicitly and when that isn’t necessary&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By repeatedly running a short code snippet that you change only slightly, you’ll see that if you run &lt;code&gt;print()&lt;/code&gt; with its default arguments, then its execution is &lt;strong&gt;line-buffered&lt;/strong&gt; in interactive mode, and &lt;strong&gt;block-buffered&lt;/strong&gt; otherwise.&lt;/p&gt;
&lt;p&gt;You’ll get a feel for what all of that means by exploring the code practically. But before you dive into changing output stream buffering in Python, it’s helpful to revisit how it happens by default, and understand why you might want to change it.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Sample Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-flush-print-output-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-flush-print-output-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that you’ll use to dive deep into flushing the output of the Python print function.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;understand-how-python-buffers-output&quot;&gt;Understand How Python Buffers Output&lt;a class=&quot;headerlink&quot; href=&quot;#understand-how-python-buffers-output&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When you make a write call to a &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-file-like-object&quot;&gt;file-like object&lt;/a&gt;, Python buffers the call by default—and that’s a good idea! Disk write and read operations are slow in comparison to &lt;strong&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Random-access_memory&quot;&gt;random-access memory (RAM)&lt;/a&gt;&lt;/strong&gt; access. When your script makes fewer &lt;a href=&quot;https://en.wikipedia.org/wiki/System_call&quot;&gt;system calls&lt;/a&gt; for write operations by batching characters in a RAM data buffer and writing them all at once to disk with a single system call, then you can save a lot of time.&lt;/p&gt;
&lt;p&gt;To put the use case for buffering into a real-world context, think of traffic lights as buffers for car traffic. If every car crossed an intersection immediately upon arrival, it would end in gridlock. That’s why the traffic lights buffer traffic from one direction while the other direction flushes.&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; Data buffers are generally size-based, not time-based, which is where the traffic analogy breaks down. In the context of a data buffer, the traffic lights would switch if a certain number of cars were queued up and waiting.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;However, there are situations when you don’t want to wait for a data buffer to fill up before it flushes. Imagine that there’s an ambulance that needs to get past the crossroads as quickly as possible. You don’t want it to wait at the traffic lights until there’s a certain number of cars queued up.&lt;/p&gt;
&lt;p&gt;In your program, you usually want to flush the data buffer right away when you need real-time feedback on code that has executed. Here are a couple of use cases for immediate flushing:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Instant feedback:&lt;/strong&gt; In an &lt;strong&gt;interactive environment&lt;/strong&gt;, such as a &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;Python REPL&lt;/a&gt; or a situation where your &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;Python script&lt;/a&gt; writes to a terminal&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;File monitoring:&lt;/strong&gt; In a situation where you’re writing to a &lt;strong&gt;file-like object&lt;/strong&gt;, and the output of the write operation gets read by another program while your script is still executing—for example, when you’re &lt;a href=&quot;https://en.wikipedia.org/wiki/Tail_(Unix)#File_monitoring&quot;&gt;monitoring a log file&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In both cases, you need to read the generated output as soon as it generates, and not only when enough output has assembled to flush the data buffer.&lt;/p&gt;
&lt;p&gt;There are many situations where buffering is helpful, and there are some situations where too much buffering can be a disadvantage. Therefore, there are different types of data buffering that you can implement where they fit best:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unbuffered&lt;/strong&gt; means that there’s no data buffer. Every byte creates a new system call and gets written independently.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Line-buffered&lt;/strong&gt; means that there’s a data buffer that collects information in memory, and once it encounters a newline character (&lt;code&gt;\n&lt;/code&gt;), the data buffer flushes and writes the whole line in one system call.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fully-buffered (block-buffered)&lt;/strong&gt; means that there’s a data buffer of a specific size, which collects all the information that you want to write. Once it’s full, it flushes and sends all its contents onward in a single system call.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Python uses block buffering as a default when writing to file-like objects. However, it executes line-buffered if you’re writing to an interactive environment.&lt;/p&gt;
&lt;p&gt;To better understand what that means, write a Python script that simulates a countdown:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# countdown.py&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;time&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;second&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&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;n&quot;&gt;second&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sleep&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;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Go!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;By default, each number shows up right when &lt;code&gt;print()&lt;/code&gt; is called in the script. But as you develop and tweak your countdown timer, you might run into a situation where all your output gets buffered. Buffering the whole countdown and printing it all at once when the script finishes would lead to a lot of confusion for the athletes waiting at the start line!&lt;/p&gt;
&lt;p&gt;So how can you make sure that you won’t run into data buffering issues as you develop your Python script?&lt;/p&gt;
&lt;h2 id=&quot;add-a-newline-for-python-to-flush-print-output&quot;&gt;Add a Newline for Python to Flush Print Output&lt;a class=&quot;headerlink&quot; href=&quot;#add-a-newline-for-python-to-flush-print-output&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you’re running a code snippet in a Python REPL or executing it as a script directly with your Python interpreter, then you won’t run into any issues with the script shown above.&lt;/p&gt;
&lt;p&gt;In an &lt;a href=&quot;https://realpython.com/interacting-with-python/#using-the-python-interpreter-interactively&quot;&gt;interactive environment&lt;/a&gt;, the standard output stream is &lt;strong&gt;line-buffered&lt;/strong&gt;. This is the output stream that &lt;code&gt;print()&lt;/code&gt; writes to by default. You’re working with an interactive environment any time that your output will display in a terminal. In this case, the data buffer flushes automatically when it encounters a newline character (&lt;code&gt;&quot;\n&quot;&lt;/code&gt;):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When interactive, the stdout stream is line-buffered. (&lt;a href=&quot;https://docs.python.org/3/library/sys.html#sys.stdout&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-flush-print-output/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-flush-print-output/ »&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>Getters and Setters in Python</title>
      <id>https://realpython.com/courses/getters-and-setters-python/</id>
      <link href="https://realpython.com/courses/getters-and-setters-python/"/>
      <updated>2023-02-14T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn what getter and setter methods are, how Python properties are preferred over getters and setters when dealing with attribute access and mutation, and when to use getter and setter methods instead of properties in Python.</summary>
      <content type="html">
        &lt;p&gt;If you come from a language like &lt;a href=&quot;https://realpython.com/java-vs-python/&quot;&gt;Java&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/python-vs-cpp/&quot;&gt;C++&lt;/a&gt;, then you&amp;rsquo;re probably used to writing &lt;strong&gt;getter&lt;/strong&gt; and &lt;strong&gt;setter&lt;/strong&gt; methods for every attribute in your classes. These methods allow you to access and mutate private attributes while maintaining &lt;strong&gt;encapsulation&lt;/strong&gt;. In Python, you&amp;rsquo;ll typically expose attributes as part of your public API and use &lt;strong&gt;properties&lt;/strong&gt; when you need attributes with functional behavior.&lt;/p&gt;
&lt;p&gt;Even though properties are the Pythonic way to go, they can have some practical drawbacks. Because of this, you&amp;rsquo;ll find some situations where getters and setters are preferable over properties.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Write &lt;strong&gt;getter&lt;/strong&gt; and &lt;strong&gt;setter&lt;/strong&gt; methods in your classes&lt;/li&gt;
&lt;li&gt;Replace getter and setter methods with &lt;strong&gt;properties&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Explore &lt;strong&gt;other tools&lt;/strong&gt; to replace getter and setter methods in Python&lt;/li&gt;
&lt;li&gt;Decide when &lt;strong&gt;setter&lt;/strong&gt; and &lt;strong&gt;getter&lt;/strong&gt; methods can be the &lt;strong&gt;right tool for the job&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this course, you should be familiar with Python &lt;a href=&quot;https://realpython.com/courses/intro-object-oriented-programming-oop-python/&quot;&gt;object-oriented&lt;/a&gt; programming. It&amp;rsquo;ll also be a plus if you have basic knowledge of Python &lt;a href=&quot;https://realpython.com/courses/property-python/&quot;&gt;properties&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-descriptors/&quot;&gt;descriptors&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>Python News: What&#x27;s New From January 2023</title>
      <id>https://realpython.com/python-news-january-2023/</id>
      <link href="https://realpython.com/python-news-january-2023/"/>
      <updated>2023-02-13T14:00:00+00:00</updated>
      <summary>Quickly get up to speed on what&#x27;s been happening in the world of Python in the past month. The PSF hires a security developer in residence! You&#x27;ll also read about Python 3.12 alpha 4 and three recently published PEPs. Maybe you&#x27;ll get dragged into the ongoing discussion about Python packaging!</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The new year has arrived, and January brought a flurry of new and interesting &lt;strong&gt;Python enhancement proposals (PEPs)&lt;/strong&gt;. Topics range from &lt;strong&gt;f-string formalization&lt;/strong&gt; and &lt;strong&gt;no-GIL Python&lt;/strong&gt; to &lt;strong&gt;packaging&lt;/strong&gt;. There’s been ample discussion on the &lt;a href=&quot;https://discuss.python.org/&quot;&gt;Python Discourse forum&lt;/a&gt; about the implications of these PEPs, and if you’re still a bit wary of diving deeper into the discussions, then you can get a softer introduction here.&lt;/p&gt;
&lt;p&gt;There have also been a couple of noteworthy &lt;strong&gt;new releases&lt;/strong&gt;, first and foremost the fourth alpha release of Python 3.12. And finally, there’s a new job posting out for a &lt;strong&gt;security developer in residence&lt;/strong&gt; sponsored by the Python Software Foundation (PSF).&lt;/p&gt;
&lt;p&gt;Let’s dive into the biggest &lt;strong&gt;Python news&lt;/strong&gt; from the past month!&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;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;pep-701-attempts-to-formalize-f-strings&quot;&gt;PEP 701 Attempts to Formalize f-Strings&lt;a class=&quot;headerlink&quot; href=&quot;#pep-701-attempts-to-formalize-f-strings&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python’s &lt;a href=&quot;https://realpython.com/python-f-strings/&quot;&gt;f-strings&lt;/a&gt; are great, but there are currently a few edge cases that might make you scratch your head.&lt;/p&gt;
&lt;p&gt;For example, maybe you wanted to greet the new year with a carefully constructed f-string, but you ran into unexpected troubles:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;happy &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;twenty&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;three&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;🥳&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27;s 2023!}!!&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;File &quot;&amp;lt;stdin&amp;gt;&quot;, line 1&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  f&quot;happy {&quot;\n&quot;.join([&quot;twenty&quot;, &quot;three&quot;, &quot;🥳&quot;]) # it&#x27;s 2023!}!!&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;             ^&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;SyntaxError: unexpected character after line continuation character&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You used some double quotes (&lt;code&gt;&quot;&lt;/code&gt;) inside the curly braces (&lt;code&gt;{}&lt;/code&gt;). It looks like Python isn’t happy with that and considers the f-string closed, even though the quotes appear inside the f-string expression part.&lt;/p&gt;
&lt;p&gt;The new year is still fresh, so you won’t let this get you down! You just change the double quotes to single quotes:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Happy &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27;twenty&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;three&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;🥳&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Yes&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2023&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;!!&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;File &quot;&amp;lt;stdin&amp;gt;&quot;, line 1&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  f&quot;Happy {&#x27;\n&#x27;.join([&#x27;twenty&#x27;, &#x27;three&#x27;, &#x27;🥳&#x27;]) # Yes! 2023!}!!&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;                                                               ^&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;SyntaxError: f-string expression part cannot include a backslash&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Oh! There’s another issue with your new year’s greeting f-string. It looks like you can’t include the backslash (&lt;code&gt;\&lt;/code&gt;) character in an f-string expression. &lt;em&gt;Well, maybe 2023 is more about expanding in breadth than in depth&lt;/em&gt;, you think to yourself. So you replace the newline character (&lt;code&gt;\n&lt;/code&gt;) with a whitespace character (&lt;code&gt;&#x27; &#x27;&lt;/code&gt;) and try again:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Happy &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27; &#x27;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27;twenty&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;three&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;🥳&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;#&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Yes&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2023&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;!!&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;File &quot;&amp;lt;stdin&amp;gt;&quot;, line 1&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  f&quot;Happy {&#x27; &#x27;.join([&#x27;twenty&#x27;, &#x27;three&#x27;, &#x27;🥳&#x27;]) # Yes! 2023!}!!&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;                                                              ^&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;SyntaxError: f-string expression part cannot include &#x27;#&#x27;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Argh! Yet another problem! It seems like you can’t include comments in the f-string expression part—not even when they’re full of joy and optimism!&lt;/p&gt;
&lt;p&gt;Python 3.6 introduced f-strings, and the &lt;a href=&quot;https://en.wikipedia.org/wiki/LL_parser&quot;&gt;LL(1) parser&lt;/a&gt; that Python used back then wasn’t able to handle these edge cases.&lt;/p&gt;
&lt;p&gt;Maybe running into the limitations of f-strings has slightly dampened your optimistic beginning of 2023. But don’t write this year off quite yet, because these limitations may go away soon.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://twitter.com/pyblogsal&quot;&gt;Pablo Galindo Salgado&lt;/a&gt; authored &lt;a href=&quot;https://peps.python.org/pep-0701/&quot;&gt;PEP 701 – Syntactic formalization of f-strings&lt;/a&gt; at the end of last year. The PEP proposes a formalized grammar for f-strings, which could be directly integrated into the &lt;a href=&quot;https://en.wikipedia.org/wiki/Parsing_expression_grammar&quot;&gt;parsing expression grammar (PEG)&lt;/a&gt; parser that Python’s been using &lt;a href=&quot;https://realpython.com/python39-new-features/#a-more-powerful-python-parser&quot;&gt;since version 3.9&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-january-2023/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-january-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 #144: Wrangling Business Process Models With Python and SpiffWorkflow</title>
      <id>https://realpython.com/podcasts/rpp/144/</id>
      <link href="https://realpython.com/podcasts/rpp/144/"/>
      <updated>2023-02-10T12:00:00+00:00</updated>
      <summary>Can you describe your business processes with flowcharts? What if you could define the steps in a standard notation and implement the workflows in pure Python? This week on the show, Dan Funk from Sartography is here to discuss SpiffWorkflow.</summary>
      <content type="html">
        &lt;p&gt;Can you describe your business processes with flowcharts? What if you could define the steps in a standard notation and implement the workflows in pure Python? This week on the show, Dan Funk from Sartography is here to discuss SpiffWorkflow.&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 Split a Python List or Iterable Into Chunks</title>
      <id>https://realpython.com/how-to-split-a-python-list-into-chunks/</id>
      <link href="https://realpython.com/how-to-split-a-python-list-into-chunks/"/>
      <updated>2023-02-08T14:00:00+00:00</updated>
      <summary>This tutorial provides an overview of how to split a Python list into chunks. You&#x27;ll learn several ways of breaking a list into smaller pieces using the standard library, third-party libraries, and custom code. You&#x27;ll also split multidimensional data to synthesize an image with parallel processing.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Splitting a Python list into chunks is a common way of distributing the workload across multiple workers that can process them in parallel for faster results. Working with smaller pieces of data at a time may be the only way to fit a large dataset into computer memory. Sometimes, the very nature of the problem requires you to split the list into chunks.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll explore the range of options for splitting a Python list—or another iterable—into chunks. You’ll look at using Python’s standard modules and a few third-party libraries, as well as manually looping through the list and slicing it up with custom code. Along the way, you’ll learn how to handle edge cases and apply these techniques to multidimensional data by synthesizing chunks of an image in parallel.&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;Split a Python list into &lt;strong&gt;fixed-size&lt;/strong&gt; chunks&lt;/li&gt;
&lt;li&gt;Split a Python list into a fixed number of chunks of &lt;strong&gt;roughly equal&lt;/strong&gt; size&lt;/li&gt;
&lt;li&gt;Split &lt;strong&gt;finite lists&lt;/strong&gt; as well as &lt;strong&gt;infinite data streams&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Perform the splitting in a &lt;strong&gt;greedy&lt;/strong&gt; or &lt;strong&gt;lazy&lt;/strong&gt; manner&lt;/li&gt;
&lt;li&gt;Produce &lt;strong&gt;lightweight slices&lt;/strong&gt; without allocating memory for the chunks&lt;/li&gt;
&lt;li&gt;Split &lt;strong&gt;multidimensional data&lt;/strong&gt;, such as an array of pixels&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Throughout the tutorial, you’ll encounter a few technical terms, such as &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-sequence&quot;&gt;sequence&lt;/a&gt;, &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-iterable&quot;&gt;iterable&lt;/a&gt;, &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-iterator&quot;&gt;iterator&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/introduction-to-python-generators/&quot;&gt;generator&lt;/a&gt;. If these are new to you, then check out the linked resources before diving in. Additionally, familiarity with Python’s &lt;a href=&quot;https://realpython.com/python-itertools/&quot;&gt;&lt;code&gt;itertools&lt;/code&gt;&lt;/a&gt; module can be helpful in understanding some of the code snippets that you’ll find later.&lt;/p&gt;
&lt;p&gt;To download the complete source code of the examples presented in this tutorial, click the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Sample Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/how-to-split-a-python-list-into-chunks-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-how-to-split-a-python-list-into-chunks-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free source code&lt;/a&gt; that you’ll use to split a Python list or iterable into chunks.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;split-a-python-list-into-fixed-size-chunks&quot;&gt;Split a Python List Into Fixed-Size Chunks&lt;a class=&quot;headerlink&quot; href=&quot;#split-a-python-list-into-fixed-size-chunks&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are many real-world scenarios that involve splitting a long list of items into smaller pieces of equal size. The whole list may be too large to fit in your computer’s memory. Perhaps it’s more convenient or efficient to process the individual chunks separately rather than all at once. But there could be other reasons for splitting.&lt;/p&gt;
&lt;p&gt;For example, when you search for something online, the results are usually presented to you in chunks, called &lt;strong&gt;pages&lt;/strong&gt;, containing an equal number of items. This technique, known as &lt;a href=&quot;https://realpython.com/django-pagination/&quot;&gt;content pagination&lt;/a&gt;, is common in &lt;a href=&quot;https://realpython.com/learning-paths/become-python-web-developer/&quot;&gt;web development&lt;/a&gt; because it helps improve the website’s performance by reducing the amount of data to transfer from the database at a time. It can also benefit the user by improving their browsing experience.&lt;/p&gt;
&lt;p&gt;Most computer networks use &lt;a href=&quot;https://en.wikipedia.org/wiki/Packet_switching&quot;&gt;packet switching&lt;/a&gt; to transfer data in &lt;strong&gt;packets&lt;/strong&gt; or &lt;strong&gt;datagrams&lt;/strong&gt;, which can be individually routed from the source to the destination address. This approach doesn’t require a dedicated physical connection between the two points, allowing the packets to bypass a damaged part of the network. The packets can be of variable length, but some low-level protocols require the data to be split into fixed-size packets.&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 splitting sequential data, you need to consider its size while keeping a few details in mind.&lt;/p&gt;
&lt;p&gt;Specifically, if the total number of elements to split is an exact multiple of the desired chunk’s length, then you’ll end up with all the chunks having the same number of items. Otherwise, the last chunk will contain fewer items, and you may need extra &lt;strong&gt;padding&lt;/strong&gt; to compensate for that.&lt;/p&gt;
&lt;p&gt;Additionally, your data may have a known size up front when it’s loaded from a file in one go, or it can consist of an &lt;strong&gt;indefinite stream of bytes&lt;/strong&gt;—while live streaming a teleconference, for example. Some solutions that you learn in this tutorial will only work when the number of elements is known before the splitting begins.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Most web frameworks, such as &lt;a href=&quot;https://realpython.com/get-started-with-django-1/&quot;&gt;Django&lt;/a&gt;, will handle content pagination for you. Also, you don’t typically have to worry about some low-level network protocols. That being said, there are times when you’ll need to have more granular control and do the splitting yourself. In this section, you’ll take a look at how to split a list into smaller lists of equal size using different tools in Python.&lt;/p&gt;
&lt;h3 id=&quot;standard-library-in-python-312-itertoolsbatched&quot;&gt;Standard Library in Python 3.12: &lt;code&gt;itertools.batched()&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#standard-library-in-python-312-itertoolsbatched&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Using the &lt;a href=&quot;https://docs.python.org/3/library/index.html&quot;&gt;standard library&lt;/a&gt; is almost always your best choice because it requires no external dependencies. The standard library provides concise, well-documented code that’s been tested by millions of users in production, making it less likely to contain bugs. Besides that, the standard library’s code is portable across different platforms and typically much more performant than a pure-Python equivalent, as most of it is implemented in C.&lt;/p&gt;
&lt;p&gt;Unfortunately, the Python standard library hasn’t traditionally had built-in support for splitting &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-iterable&quot;&gt;iterable objects&lt;/a&gt; like Python lists. At the time of writing, &lt;a href=&quot;https://realpython.com/python311-new-features/&quot;&gt;Python 3.11&lt;/a&gt; is the most recent version of the interpreter. But you can put yourself on the cutting edge by downloading a &lt;a href=&quot;https://realpython.com/python-pre-release/&quot;&gt;pre-release version&lt;/a&gt; of Python 3.12, which gives you access to the new &lt;a href=&quot;https://docs.python.org/3.12/library/itertools.html#itertools.batched&quot;&gt;&lt;code&gt;itertools.batched()&lt;/code&gt;&lt;/a&gt;. Here’s an example demonstrating its use:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;itertools&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;batched&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;batch&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;batched&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ABCDEFGHIJ&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&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;n&quot;&gt;batch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(&#x27;A&#x27;, &#x27;B&#x27;, &#x27;C&#x27;, &#x27;D&#x27;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(&#x27;E&#x27;, &#x27;F&#x27;, &#x27;G&#x27;, &#x27;H&#x27;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(&#x27;I&#x27;, &#x27;J&#x27;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The function accepts any iterable object, such as a string, as its first argument. The chunk size is its second argument. Regardless of the input data type, the function always yields chunks or &lt;strong&gt;batches&lt;/strong&gt; of elements as &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;Python tuples&lt;/a&gt;, which you may need to convert to something else if you prefer working with a different sequence type. For example, you might want to join the characters in the resulting tuples to form strings again.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The underlying implementation of &lt;code&gt;itertools.batched()&lt;/code&gt; could’ve changed since the publishing of this tutorial, which was written against an &lt;a href=&quot;https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha&quot;&gt;alpha release&lt;/a&gt; of Python 3.12. For example, the function may now yield lists instead of tuples, so be sure to check the &lt;a href=&quot;https://docs.python.org/3.12/library/itertools.html#itertools.batched&quot;&gt;official documentation&lt;/a&gt; for the most up-to-date information.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Also, notice that the last chunk will be shorter than its predecessors unless the iterable’s length is divisible by the desired chunk size. To ensure that all the chunks have an equal length at all times, you can pad the last chunk with empty values, such as &lt;a href=&quot;https://realpython.com/null-in-python/&quot;&gt;&lt;code&gt;None&lt;/code&gt;&lt;/a&gt;, when necessary:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;batched_with_padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iterable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;batch_size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fill_value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;batch&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;batched&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iterable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;batch_size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;batch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fill_value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;batch_size&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;batch&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;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;batch&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;batched_with_padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ABCDEFGHIJ&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&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;n&quot;&gt;batch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(&#x27;A&#x27;, &#x27;B&#x27;, &#x27;C&#x27;, &#x27;D&#x27;)&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;go&quot;&gt;(&#x27;E&#x27;, &#x27;F&#x27;, &#x27;G&#x27;, &#x27;H&#x27;)&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;go&quot;&gt;(&#x27;I&#x27;, &#x27;J&#x27;, None, None)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This adapted version of &lt;code&gt;itertools.batched()&lt;/code&gt; takes an &lt;a href=&quot;https://realpython.com/python-optional-arguments/&quot;&gt;optional argument&lt;/a&gt; named &lt;code&gt;fill_value&lt;/code&gt;, which defaults to &lt;code&gt;None&lt;/code&gt;. If a chunk’s length happens to be less than &lt;code&gt;size&lt;/code&gt;, then the function appends additional elements to that chunk’s end using &lt;code&gt;fill_value&lt;/code&gt; as padding.&lt;/p&gt;
&lt;p&gt;You can supply either a &lt;em&gt;finite&lt;/em&gt; &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-sequence&quot;&gt;sequence&lt;/a&gt; of values to the &lt;code&gt;batched()&lt;/code&gt; function or an &lt;em&gt;infinite&lt;/em&gt; &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-iterator&quot;&gt;iterator&lt;/a&gt; yielding values without end:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;itertools&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;count&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;finite&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;batched&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;infinite&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;batched&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;count&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;4&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;finite&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;itertools.batched object at 0x7f4e0e2ee830&amp;gt;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;infinite&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;itertools.batched object at 0x7f4b4e5fbf10&amp;gt;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;finite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[(1, 2, 3, 4), (5, 6, 7, 8), (9, 10)]&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;infinite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(1, 2, 3, 4)&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;infinite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(5, 6, 7, 8)&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;infinite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;(9, 10, 11, 12)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In both cases, the function returns an iterator that consumes the input iterable using &lt;a href=&quot;https://en.wikipedia.org/wiki/Lazy_evaluation&quot;&gt;lazy evaluation&lt;/a&gt; by accumulating just enough elements to fill the next chunk. The finite iterator will eventually reach the end of the sequence and stop yielding chunks. Conversely, the infinite one will continue to produce chunks as long as you keep requesting them—for instance, by calling the built-in &lt;a href=&quot;https://docs.python.org/3/library/functions.html#next&quot;&gt;&lt;code&gt;next()&lt;/code&gt;&lt;/a&gt; function on it.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/how-to-split-a-python-list-into-chunks/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/how-to-split-a-python-list-into-chunks/ »&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: Building Systems With Classes</title>
      <id>https://realpython.com/courses/python-basics-class/</id>
      <link href="https://realpython.com/courses/python-basics-class/"/>
      <updated>2023-02-07T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to work with classes to build complex systems in Python. By 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 the &lt;a href=&quot;https://realpython.com/courses/python-basics-oop/&quot;&gt;previous course&lt;/a&gt; in the &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics&lt;/a&gt; series, you learned how to use classes to create new objects. Now that you understand the basics of object-oriented programming (OOP), it&amp;rsquo;s time to put those classes to work.&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;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;/ul&gt;
&lt;p&gt;With these capabilities, you&amp;rsquo;ll be able to build more complex systems and write readable, reusable code.&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;. &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>Build a Wordle Clone With Python and Rich</title>
      <id>https://realpython.com/python-wordle-clone/</id>
      <link href="https://realpython.com/python-wordle-clone/"/>
      <updated>2023-02-06T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll build your own Wordle clone with Python. Your game will run in the terminal, and you&#x27;ll use Rich to ensure your word-guessing app looks good. Learn how to build a command-line application from scratch and then challenge your friends to a wordly competition!</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In this tutorial, you’ll build your own &lt;strong&gt;Wordle clone&lt;/strong&gt; for the terminal. Since Josh Wardle launched &lt;a href=&quot;https://en.wikipedia.org/wiki/Wordle&quot;&gt;Wordle&lt;/a&gt; in October 2021, millions of people have played it. While you can play the original game on the Web, you’ll create your version as a command-line application and then use the &lt;strong&gt;Rich library&lt;/strong&gt; to make it look good.&lt;/p&gt;
&lt;p&gt;As you follow along in this step-by-step project, you’ll practice how to set up a simple prototype game before iteratively developing it into a solid application.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Build out a command-line application from a &lt;strong&gt;prototype&lt;/strong&gt; to a &lt;strong&gt;polished game&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Read and &lt;strong&gt;validate user input&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use Rich’s console to create an &lt;strong&gt;attractive user interface&lt;/strong&gt; in the terminal&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Organize your code&lt;/strong&gt; into functions&lt;/li&gt;
&lt;li&gt;Provide your users with &lt;strong&gt;actionable feedback&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll create &lt;strong&gt;Wyrdl&lt;/strong&gt;, your own Wordle clone in Python. This project is for anyone getting comfortable with Python who wants to build a terminal application from the ground up. Throughout the tutorial, you’ll build your code step-by-step while focusing on having a game that you can play from the start. You can download all the code by clicking 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;Free Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-wordle-clone-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-wordle-clone-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free source code&lt;/a&gt; that you’ll use to build a Wordle clone with Python and Rich.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Read on to see what you’ll be building.&lt;/p&gt;
&lt;h2 id=&quot;demo-your-python-wordle-clone&quot;&gt;Demo: Your Python Wordle Clone&lt;a class=&quot;headerlink&quot; href=&quot;#demo-your-python-wordle-clone&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Wordle, you have &lt;strong&gt;six attempts&lt;/strong&gt; to guess a secret &lt;strong&gt;five-letter word&lt;/strong&gt;. After each guess, you’ll get feedback about which letters are correctly placed, which are misplaced, and which are wrong.&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;New York Times&lt;/em&gt; bought the original Wordle in early 2022, and you can now play the game on their &lt;a href=&quot;https://www.nytimes.com/games/wordle/&quot;&gt;website&lt;/a&gt;. The game has a social aspect that you won’t re-create in this project. There’s one secret word per day, and all players are guessing the same word.&lt;/p&gt;
&lt;p&gt;Your version of the game will look 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/792593570?background=1&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;After you make a guess, each letter is categorized. Correct letters are marked in green, misplaced letters are marked in yellow, and wrong letters are marked in gray.&lt;/p&gt;
&lt;p&gt;If you make any mistakes, like guessing a word with six letters, then the game will give you appropriate feedback and let you take another guess.&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;An important part of this project is bootstrapping the application early. You want to have code that runs so that you can test that your code works, and you can experiment with different ways of implementing the features that you need in your game.&lt;/p&gt;
&lt;p&gt;You’ll build your Wordle clone iteratively, going through the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a &lt;strong&gt;simple prototype&lt;/strong&gt; that allows you to guess a secret word and gives you feedback on the individual letters.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make the game more interesting by including a &lt;strong&gt;list of words&lt;/strong&gt; that the game randomly chooses from.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Refactor the code to use &lt;strong&gt;functions&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add &lt;strong&gt;color and style&lt;/strong&gt; to the game using the Rich library.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Provide &lt;strong&gt;actionable feedback&lt;/strong&gt; to your users when they play the game.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Improve the user interface by adding the &lt;strong&gt;status of all the letters&lt;/strong&gt; in the alphabet.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;As you work through the tutorial, you’ll see how you can start with a small idea and grow it into a full-featured application. After all, that was &lt;a href=&quot;https://www.protocol.com/bulletins/josh-wardle-wordle-gdc-2022&quot;&gt;Wordle’s journey&lt;/a&gt;!&lt;/p&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll build a Wordle clone using Python and Rich. While working through the steps, it’s helpful if you’re comfortable with the following concepts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-input-output/&quot;&gt;Reading input&lt;/a&gt; from the user at the terminal&lt;/li&gt;
&lt;li&gt;Using &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;&lt;code&gt;if&lt;/code&gt; statements&lt;/a&gt; to check different conditions&lt;/li&gt;
&lt;li&gt;Repeating actions with &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-while-loop/&quot;&gt;&lt;code&gt;while&lt;/code&gt;&lt;/a&gt; loops&lt;/li&gt;
&lt;li&gt;Organizing data in &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;structures&lt;/a&gt; like &lt;a href=&quot;https://realpython.com/python-lists-tuples/#python-lists&quot;&gt;lists&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionaries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Encapsulating code with &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you’re not confident in your knowledge of these prerequisites, then that’s okay too! In fact, going through this tutorial will help you practice these concepts. You can always stop and review the resources linked above if you get stuck.&lt;/p&gt;
&lt;p&gt;It’s time to dive in!&lt;/p&gt;
&lt;h2 id=&quot;step-1-guess-a-word&quot;&gt;Step 1: Guess a Word&lt;a class=&quot;headerlink&quot; href=&quot;#step-1-guess-a-word&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-wordle-clone/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-wordle-clone/ »&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 #143: Create Interactive Maps &amp; Geospatial Data Visualizations With Python</title>
      <id>https://realpython.com/podcasts/rpp/143/</id>
      <link href="https://realpython.com/podcasts/rpp/143/"/>
      <updated>2023-02-03T12:00:00+00:00</updated>
      <summary>Would you like to quickly add data to a map with Python? Have you wanted to create beautiful interactive maps and export them as a stand-alone static web page? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Would you like to quickly add data to a map with Python? Have you wanted to create beautiful interactive maps and export them as a stand-alone static web page? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Build a JavaScript Front End for a Flask API</title>
      <id>https://realpython.com/flask-javascript-frontend-for-rest-api/</id>
      <link href="https://realpython.com/flask-javascript-frontend-for-rest-api/"/>
      <updated>2023-02-01T14:00:00+00:00</updated>
      <summary>Most modern websites are powered by a REST API. That way, you can separate the front-end code from the back-end logic, and users can interact with the interface dynamically.
In this step-by-step tutorial, you&#x27;ll learn how to build a single-page Flask web application with HTML, CSS, and JavaScript.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Most modern web applications are powered by a REST API under the hood. That way, developers can separate JavaScript front-end code from the back-end logic that a web framework like Flask provides.&lt;/p&gt;
&lt;p&gt;Following this step-by-step project, you’ll create an interactive single-page application with HTML, CSS, and JavaScript. The foundation is an existing Flask project with a REST API and a connected SQLite database, which you’ll grab in just a moment.&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;Navigate a &lt;strong&gt;full-stack web development&lt;/strong&gt; workflow&lt;/li&gt;
&lt;li&gt;Structure an &lt;strong&gt;HTML&lt;/strong&gt; file to act as the template for a single-page web application&lt;/li&gt;
&lt;li&gt;Leverage the &lt;strong&gt;Jinja&lt;/strong&gt; templating engine to render dynamic HTML&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;CSS&lt;/strong&gt; to style the presentation of an application&lt;/li&gt;
&lt;li&gt;Write &lt;strong&gt;JavaScript&lt;/strong&gt; to add interactivity to an application&lt;/li&gt;
&lt;li&gt;Leverage &lt;strong&gt;Ajax&lt;/strong&gt; to make HTTP requests to the REST API&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As a Python developer, you’re probably more comfortable working on the back end of an application. This tutorial will guide you through a full-stack experience from the back end to the front end. You may write less Python code than usual, but you’ll learn a whole bunch about HTML, CSS, and JavaScript.&lt;/p&gt;
&lt;p&gt;In the JavaScript world, it’s very common to reach for one of &lt;a href=&quot;https://en.wikipedia.org/wiki/Comparison_of_JavaScript-based_web_frameworks&quot;&gt;many frameworks and libraries&lt;/a&gt;.
However, you won’t be using any frameworks in this tutorial. 
That way, you’ll get to know core JavaScript before using tools that build on top of that foundation in your future projects.&lt;/p&gt;
&lt;p&gt;You can download the final code 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;Free Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/build-a-rest-api-frontend-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-build-a-rest-api-frontend-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free source code&lt;/a&gt; that you’ll use to build a front end for your Flask REST API single-page web application.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo&quot;&gt;Demo&lt;a class=&quot;headerlink&quot; href=&quot;#demo&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll fix some back-end shortcomings and move on to build the front end on top of an existing REST API that you’ll download in a moment. The API already provides several API endpoints to keep track of notes for people who may visit you throughout the year. You’ll initiate the database with people like the &lt;a href=&quot;https://en.wikipedia.org/wiki/Tooth_fairy&quot;&gt;Tooth Fairy&lt;/a&gt;, the &lt;a href=&quot;https://en.wikipedia.org/wiki/Easter_Bunny&quot;&gt;Easter Bunny&lt;/a&gt;, and &lt;a href=&quot;https://en.wikipedia.org/wiki/Knecht_Ruprecht&quot;&gt;Knecht Ruprecht&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Ideally, you want to be on good terms with all three of them. That’s why you’ll send them notes, to increase your chances of getting valuable gifts from them.&lt;/p&gt;
&lt;p&gt;At the end of this tutorial, you’ll be able to interact with your API from the convenience of your application’s front end:&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/790816454?background=1&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;At the end of this tutorial, you can put your earned knowledge into action and continue to build a fully functional single-page application that works seamlessly with the REST API that you’ll get to know over the following few sections.&lt;/p&gt;
&lt;p&gt;Throughout the tutorial, you’ll adjust everything from the data model of the database all the way to the client-side experience. This will give you a good idea of what &lt;strong&gt;full-stack web development&lt;/strong&gt; means for you as a Python developer.&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;In this tutorial, you’ll build upon an existing Flask REST API with several endpoints. 
You’ll start by grabbing the materials for the Flask project and making sure that the API connects to the database.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The tutorial you’re currently reading will guide you through all the steps that you need to create a JavaScript front end for a Flask REST API. However, if you’re curious, you can follow the Python REST APIs With Flask, Connexion, and SQLAlchemy tutorial series to build the Flask REST API that you’ll use in this tutorial.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://realpython.com/flask-connexion-rest-api/&quot;&gt;Part 1&lt;/a&gt; of this series guides you through building a REST API, and &lt;a href=&quot;https://realpython.com/flask-connexion-rest-api-part-2/&quot;&gt;Part 2&lt;/a&gt; shows you how to connect that REST API to a database. In &lt;a href=&quot;https://realpython.com/flask-connexion-rest-api-part-3/&quot;&gt;Part 3&lt;/a&gt;, you add relationships to the REST API and the supporting database.&lt;/p&gt;
&lt;p&gt;If you’re interested in Python back-end development, then it’s a good idea to check out these three parts first. Either way, before you continue with this tutorial, follow the steps below to collect all the prerequisites.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;After you’ve verified that the Flask project works, you’ll get to know the back end by investigating some shortcomings that the REST API currently has.
This part will give you a good impression of the app’s back-end structure before you move on to the front end.&lt;/p&gt;
&lt;p&gt;For most of this step-by-step project, you’ll be iterating over HTML, CSS, and JavaScript code.
Piece by piece, you’ll make your single-page web application more maintainable and better looking.&lt;/p&gt;
&lt;p&gt;In the end, you’ll be able to communicate with your Flask back end from the convenience of your JavaScript-powered front end.&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;In this project, you’ll focus on writing the front-end code. Still, you need a back end to work with. In this case, it’s a Flask project that provides a REST API with several endpoints.&lt;/p&gt;
&lt;p&gt;Read on and download the code that you need to create the Flask project. Additionally, you’ll use a bootstrap script to build the database with some sample datasets.&lt;/p&gt;
&lt;h3 id=&quot;grab-the-back-end-code&quot;&gt;Grab the Back-End Code&lt;a class=&quot;headerlink&quot; href=&quot;#grab-the-back-end-code&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/flask-javascript-frontend-for-rest-api/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/flask-javascript-frontend-for-rest-api/ »&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 Terminal on Linux</title>
      <id>https://realpython.com/courses/using-terminal-linux/</id>
      <link href="https://realpython.com/courses/using-terminal-linux/"/>
      <updated>2023-01-31T14:00:00+00:00</updated>
      <summary>In this Code Conversation video course, you&#x27;ll learn how to use the terminal on Linux.
You&#x27;ll navigate the file system with Philipp and Geir Arne and perform common tasks like creating files and folders. If you&#x27;ve never used the terminal before, then this video course will help you get started.</summary>
      <content type="html">
        &lt;p&gt;The &lt;strong&gt;terminal&lt;/strong&gt; can be intimidating to work with when you&amp;rsquo;re used to working with graphical user interfaces. However, it&amp;rsquo;s an important tool that you need to get used to in your journey as a Python developer.
Even though you can substitute some workflows in the terminal with apps that contain a graphical user interface (GUI), you may need to open the terminal at some point in your life as a Python developer.&lt;/p&gt;
&lt;p&gt;In this &lt;strong&gt;Code Conversation&lt;/strong&gt;, you&amp;rsquo;ll follow a chat between Philipp and Geir Arne as they perform common tasks in the terminal on Linux, such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Showing the current working directory&lt;/li&gt;
&lt;li&gt;Listing the contents of a folder&lt;/li&gt;
&lt;li&gt;Adding text to files without opening them&lt;/li&gt;
&lt;li&gt;Displaying the content of a file&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Along the way, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Find the terminal&lt;/strong&gt; on your operating system&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Open the terminal&lt;/strong&gt; for the first time&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Navigate your file system&lt;/strong&gt; with basic commands&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Create files and folders&lt;/strong&gt; with the terminal&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Run Python files&lt;/strong&gt; on Linux&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you&amp;rsquo;ve never worked with the terminal on Linux before or you want to see some interesting use cases to incorporate the terminal into your workflow, then this video course is the perfect start for you.&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 Iterate Over Rows in pandas, and Why You Shouldn&#x27;t</title>
      <id>https://realpython.com/pandas-iterate-over-rows/</id>
      <link href="https://realpython.com/pandas-iterate-over-rows/"/>
      <updated>2023-01-30T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to iterate over a pandas DataFrame&#x27;s rows, but you&#x27;ll also understand why looping is against the way of the panda. You&#x27;ll understand vectorization, see how to choose vectorized methods, and compare the performance of iteration against pandas.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;One of the most common questions you might have when entering the world of &lt;a href=&quot;https://realpython.com/pandas-python-explore-dataset/&quot;&gt;pandas&lt;/a&gt; is &lt;em&gt;how to iterate over rows&lt;/em&gt; in a pandas &lt;a href=&quot;https://realpython.com/pandas-dataframe/&quot;&gt;DataFrame&lt;/a&gt;. If you’ve gotten comfortable using loops in core Python, then this is a perfectly natural question to ask.&lt;/p&gt;
&lt;p&gt;While iterating over rows is relatively straightforward with &lt;a href=&quot;https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.itertuples.html&quot;&gt;&lt;code&gt;.itertuples()&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.iterrows.html&quot;&gt;&lt;code&gt;.iterrows()&lt;/code&gt;&lt;/a&gt;, that doesn’t necessarily mean iteration is the best way to work with DataFrames. In fact, while iteration may be a quick way to make progress, relying on iteration can become a significant roadblock when it comes to being &lt;a href=&quot;https://realpython.com/podcasts/rpp/103/&quot;&gt;effective with pandas&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll learn how to iterate over the rows in a pandas DataFrame, but you’ll also learn why you probably don’t want to. Generally, you’ll want to avoid iteration because it comes with a performance penalty and goes against the way of the panda.&lt;/p&gt;
&lt;p&gt;To follow along with this tutorial, you can download the datasets and code samples from the following link:&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 Sample Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/pandas-iterate-over-rows-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-pandas-iterate-over-rows-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code and datasets&lt;/a&gt; that you’ll use to explore iterating over rows in a pandas DataFrame vs using vectorized methods.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The last bit of prep work is to spin up a virtual environment and install a few packages:&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

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




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

&lt;/ul&gt;
&lt;div class=&quot;tab-content mt-2 mb-0 js-platform-widget-content&quot;&gt;
&lt;div aria-labelledby=&quot;windows-tab-1&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight pscon&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Scripts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;activate&lt;/span&gt;
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pip&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pandas&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;httpx&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;codetiming&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python -m venv venv
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; venv/bin/activate
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python -m pip install pandas httpx codetiming
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;pandas&lt;/code&gt; installation won’t come as a surprise, but you may wonder about the others. You’ll use the &lt;a href=&quot;https://www.python-httpx.org/&quot;&gt;&lt;code&gt;httpx&lt;/code&gt;&lt;/a&gt; package to carry out some HTTP requests as part of one example, and the &lt;a href=&quot;https://github.com/realpython/codetiming&quot;&gt;&lt;code&gt;codetiming&lt;/code&gt;&lt;/a&gt; package to make some quick performance comparisons.&lt;/p&gt;
&lt;p&gt;With that, you’re ready to get stuck in and learn how to iterate over rows, why you probably don’t want to, and what other options to rule out before resorting to iteration.&lt;/p&gt;
&lt;h2 id=&quot;how-to-iterate-over-dataframe-rows-in-pandas&quot;&gt;How to Iterate Over DataFrame Rows in pandas&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-iterate-over-dataframe-rows-in-pandas&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;While uncommon, there are some situations in which you can get away with iterating over a DataFrame. These situations are typically ones where you:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Need to feed the information from a pandas DataFrame sequentially into another &lt;strong&gt;API&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Need the operation on each row to produce a &lt;strong&gt;side effect&lt;/strong&gt;, such as an HTTP request&lt;/li&gt;
&lt;li&gt;Have &lt;strong&gt;complex operations&lt;/strong&gt; to carry out involving various columns in the DataFrame&lt;/li&gt;
&lt;li&gt;Don’t mind the &lt;strong&gt;performance penalty&lt;/strong&gt; of iteration, maybe because working with the data isn’t the bottleneck, the dataset is very small, or it’s just a personal project&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A common use case for using loops in pandas is when you’re &lt;strong&gt;interactively&lt;/strong&gt; exploring and experimenting with data. In these cases, performance is usually less of a concern. By iterating over the data rows, you can display and get to know individual rows. Based on this experience, you can implement more effective approaches later.&lt;/p&gt;
&lt;p&gt;As an example of a more permanent use case, imagine you have a list of &lt;a href=&quot;https://en.wikipedia.org/wiki/URL&quot;&gt;URLs&lt;/a&gt; in a DataFrame, and you want to check which URLs are online. In the downloadable materials, you’ll find a &lt;a href=&quot;https://realpython.com/python-csv/&quot;&gt;CSV&lt;/a&gt; file with some data on the most popular websites, which you can load into a DataFrame:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pandas&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pd&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;websites&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read_csv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;resources/popular_websites.csv&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index_col&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;websites&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;         name                              url   total_views&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0      Google           https://www.google.com  5.207268e+11&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1     YouTube          https://www.youtube.com  2.358132e+11&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2    Facebook         https://www.facebook.com  2.230157e+11&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3       Yahoo            https://www.yahoo.com  1.256544e+11&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4   Wikipedia        https://www.wikipedia.org  4.467364e+10&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;5       Baidu            https://www.baidu.com  4.409759e+10&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;6     Twitter              https://twitter.com  3.098676e+10&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;7      Yandex               https://yandex.com  2.857980e+10&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;8   Instagram        https://www.instagram.com  2.621520e+10&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;9         AOL              https://www.aol.com  2.321232e+10&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;10   Netscape         https://www.netscape.com  5.750000e+06&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;11       Nope  https://alwaysfails.example.com  0.000000e+00&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This data contains the website’s name, its URL, and the total number of views over an unspecified time period. In the example, pandas shows the number of views in &lt;a href=&quot;https://en.wikipedia.org/wiki/Scientific_notation&quot;&gt;scientific notation&lt;/a&gt;. You’ve also got a dummy website in there for testing purposes.&lt;/p&gt;
&lt;p&gt;You want to write a &lt;a href=&quot;https://realpython.com/site-connectivity-checker-python/&quot;&gt;connectivity checker&lt;/a&gt; to test the URLs and provide a human-readable message indicating whether the website is online or whether it’s being redirected to another URL:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;httpx&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;check_connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;httpx&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;location&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;is&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;None&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;startswith&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;            &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; is online!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;            &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; is online! But redirects to &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;except&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;httpx&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ConnectError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Failed to establish a connection with &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;False&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Here, you’ve defined a &lt;code&gt;check_connection()&lt;/code&gt; function to make the request and print out messages for a given name and URL.&lt;/p&gt;
&lt;p&gt;With this function, you’ll use both the &lt;code&gt;url&lt;/code&gt; and the &lt;code&gt;name&lt;/code&gt; columns. You don’t care much about the performance of reading the values from the DataFrame for two reasons—partly because the data is so small, but mainly because the real time sink is making &lt;a href=&quot;https://realpython.com/urllib-request/&quot;&gt;HTTP requests&lt;/a&gt;, not reading from a DataFrame.&lt;/p&gt;
&lt;p&gt;Additionally, you’re interested in inspecting whether any of the websites are down. That is, you’re interested in the &lt;em&gt;side effect&lt;/em&gt; and not in &lt;em&gt;adding information&lt;/em&gt; to the DataFrame.&lt;/p&gt;
&lt;p&gt;For these reasons, you can get away with using &lt;code&gt;.itertuples()&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;website&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;websites&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;itertuples&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;check_connection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;website&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;website&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Google is online!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;YouTube is online!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Facebook is online!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Yahoo is online!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Wikipedia is online!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Baidu is online!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Twitter is online!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Yandex is online!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Instagram is online!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;AOL is online!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Netscape is online! But redirects to https://www.aol.com/&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Failed to establish a connection with https://alwaysfails.example.com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/pandas-iterate-over-rows/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/pandas-iterate-over-rows/ »&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 #142: Orchestrating Large and Small Projects With Apache Airflow</title>
      <id>https://realpython.com/podcasts/rpp/142/</id>
      <link href="https://realpython.com/podcasts/rpp/142/"/>
      <updated>2023-01-27T12:00:00+00:00</updated>
      <summary>Have you worked on a project that needed an orchestration tool? How do you define the workflow of an entire data pipeline or a messaging system with Python? This week on the show, Calvin Hendryx-Parker is back to talk about using Apache Airflow and orchestrating Python projects.</summary>
      <content type="html">
        &lt;p&gt;Have you worked on a project that needed an orchestration tool? How do you define the workflow of an entire data pipeline or a messaging system with Python? This week on the show, Calvin Hendryx-Parker is back to talk about using Apache Airflow and orchestrating Python 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: Object-Oriented Programming</title>
      <id>https://realpython.com/courses/python-basics-oop/</id>
      <link href="https://realpython.com/courses/python-basics-oop/"/>
      <updated>2023-01-24T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll get to know OOP, or object-oriented programming. You&#x27;ll learn how to create a class, use classes to create new objects, and instantiate classes with attributes.</summary>
      <content type="html">
        &lt;p&gt;&lt;strong&gt;OOP&lt;/strong&gt;, or &lt;strong&gt;object-oriented programming&lt;/strong&gt;, is a method of structuring a program by bundling related properties and behaviors into individual objects. &lt;/p&gt;
&lt;p&gt;Conceptually, objects are like the components of a system. Think of a program as a factory assembly line of sorts. At each step of the assembly line, a system component processes some material, ultimately transforming raw material into a finished product.&lt;/p&gt;
&lt;p&gt;An object contains both data, like the raw or preprocessed materials at each step on an assembly line, and behavior, like the action that each assembly line component performs.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a &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;/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. 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 #141: Exploring Python With bpython &amp; Formalizing f-String Grammar</title>
      <id>https://realpython.com/podcasts/rpp/141/</id>
      <link href="https://realpython.com/podcasts/rpp/141/"/>
      <updated>2023-01-20T12:00:00+00:00</updated>
      <summary>Have you used the Python Read-Eval-Print Loop (REPL) to explore the language and learn about how it operates? Would it help if it provided syntax highlighting, definitions, and code completion and behaved more like an IDE? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you used the Python Read-Eval-Print Loop (REPL) to explore the language and learn about how it operates? Would it help if it provided syntax highlighting, definitions, and code completion and behaved more like an IDE? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Basics Exercises: File System Operations</title>
      <id>https://realpython.com/courses/python-file-system-exercises/</id>
      <link href="https://realpython.com/courses/python-file-system-exercises/"/>
      <updated>2023-01-17T14:00:00+00:00</updated>
      <summary>In this Python Basics Exercises course, you&#x27;ll review how to use Python to work with your computer&#x27;s file system. Then, you&#x27;ll tackle a coding challenge to further develop your skills.</summary>
      <content type="html">
        &lt;p&gt;In &lt;a href=&quot;https://realpython.com/courses/python-basics-file-system-operations/&quot;&gt;Python Basics: File System Operations&lt;/a&gt;, you learned how to use Python to work with files and folders. As a programmer, you&amp;rsquo;ll use the &lt;strong&gt;&lt;code&gt;pathlib&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;shutil&lt;/code&gt;&lt;/strong&gt; modules to complete &lt;strong&gt;file system operations&lt;/strong&gt; without relying on your &lt;strong&gt;graphical user interface (GUI)&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;While you already got lots of hands-on practice with file system operations, programmers never stop training! The more you use your new skills, the more comfortable you&amp;rsquo;ll be when it&amp;rsquo;s time to put them to work in your own coding. That&amp;rsquo;s why it&amp;rsquo;s a great idea to complete exercises to reinforce and test your knowledge of the file system.&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; a directory&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Iterating&lt;/strong&gt; over the contents of a directory&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Searching&lt;/strong&gt; for files using wildcards&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Moving&lt;/strong&gt; and &lt;strong&gt;deleting&lt;/strong&gt; files and folders&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>The Real Python Podcast – Episode #140: Speeding Up Your DataFrames With Polars</title>
      <id>https://realpython.com/podcasts/rpp/140/</id>
      <link href="https://realpython.com/podcasts/rpp/140/"/>
      <updated>2023-01-13T12:00:00+00:00</updated>
      <summary>How can you get more performance from your existing data science infrastructure? What if a DataFrame library could take advantage of your machine&#x27;s available cores and provide built-in methods for handling larger-than-RAM datasets? This week on the show, Liam Brannigan is here to discuss Polars.</summary>
      <content type="html">
        &lt;p&gt;How can you get more performance from your existing data science infrastructure? What if a DataFrame library could take advantage of your machine&#x27;s available cores and provide built-in methods for handling larger-than-RAM datasets? This week on the show, Liam Brannigan is here to discuss Polars.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using the Terminal on macOS</title>
      <id>https://realpython.com/courses/using-terminal-macos/</id>
      <link href="https://realpython.com/courses/using-terminal-macos/"/>
      <updated>2023-01-10T14:00:00+00:00</updated>
      <summary>In this Code Conversation video course, you&#x27;ll learn how to use the terminal on macOS.
You&#x27;ll navigate the file system with Philipp and Martin and perform common tasks like creating files and folders. If you&#x27;ve never used the terminal before, then this video course will help you get started.</summary>
      <content type="html">
        &lt;p&gt;The &lt;strong&gt;terminal&lt;/strong&gt; can be intimidating to work with when you&amp;rsquo;re used to working with graphical user interfaces. However, it&amp;rsquo;s an important tool that you need to get used to in your journey as a Python developer.
Even though you can substitute some workflows in the terminal with apps that contain a graphical user interface (GUI), you may need to open the terminal at some point in your life as a Python developer.&lt;/p&gt;
&lt;p&gt;In this &lt;strong&gt;Code Conversation&lt;/strong&gt;, you&amp;rsquo;ll follow a chat between Philipp and Martin as they perform common tasks in the terminal on macOS, such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Showing the current working directory&lt;/li&gt;
&lt;li&gt;Listing the contents of a folder&lt;/li&gt;
&lt;li&gt;Adding text to files without opening them&lt;/li&gt;
&lt;li&gt;Displaying the content of a file&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Along the way, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Find the terminal&lt;/strong&gt; on your operating system&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Open the terminal&lt;/strong&gt; for the first time&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Navigate your filesystem&lt;/strong&gt; with basic commands&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Create files and folders&lt;/strong&gt; with the terminal&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Run Python files&lt;/strong&gt; on macOS&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you&amp;rsquo;ve never worked with the terminal on macOS before or you want to see some interesting use cases to incorporate the terminal into your workflow, then this video course is the perfect start for you.&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 #139: Surveying Comprehension Constructs &amp; Python Parallelism Infighting</title>
      <id>https://realpython.com/podcasts/rpp/139/</id>
      <link href="https://realpython.com/podcasts/rpp/139/"/>
      <updated>2023-01-06T12:00:00+00:00</updated>
      <summary>Have you embraced the use of comprehensions in your Python journey? Are you familiar with all the varieties of comprehension constructs? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you embraced the use of comprehensions in your Python journey? Are you familiar with all the varieties of comprehension constructs? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Build Cross-Platform GUI Apps With Kivy</title>
      <id>https://realpython.com/courses/cross-platform-gui-apps-kivy/</id>
      <link href="https://realpython.com/courses/cross-platform-gui-apps-kivy/"/>
      <updated>2023-01-03T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to build a cross-platform mobile application with Python and the Kivy GUI framework. You&#x27;ll discover how to develop an application that can run on your desktop as well as your phone. Then, you&#x27;ll package your app for Windows, Linux, and macOS.</summary>
      <content type="html">
        &lt;p&gt;These days, developers are highly likely to be working on a mobile or web application. Python doesn&amp;rsquo;t have built-in mobile development capabilities, but you can create mobile applications by using libraries like Kivy, &lt;a href=&quot;https://riverbankcomputing.com/software/pyqt/intro&quot;&gt;PyQt&lt;/a&gt;, or even Beeware&amp;rsquo;s &lt;a href=&quot;https://toga.readthedocs.io/en/latest/&quot;&gt;Toga&lt;/a&gt; library.&lt;/p&gt;
&lt;p&gt;These libraries are all major players in the Python mobile space. However, there are some benefits that you&amp;rsquo;ll enjoy if you choose to create mobile applications with &lt;strong&gt;Kivy&lt;/strong&gt;. Not only will your application look the same on all platforms, but you also won&amp;rsquo;t need to compile your code after every change. What&amp;rsquo;s more, you&amp;rsquo;ll be able to use Python&amp;rsquo;s clear syntax to build your applications.&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;Work with Kivy &lt;strong&gt;widgets&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Lay out the &lt;strong&gt;user interface (UI)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;events&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use the &lt;strong&gt;KV language&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create a &lt;strong&gt;calculator application&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Package&lt;/strong&gt; your application for Windows, Linux, and macOS&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Research&lt;/strong&gt; the tools to package for iOS and Android&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To complete this video course, you&amp;rsquo;ll need to be familiar with object-oriented programming. If you&amp;rsquo;re not, then check out Object-Oriented Programming (OOP) in Python 3 as either a &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;written tutorial&lt;/a&gt; or a &lt;a href=&quot;https://realpython.com/courses/intro-object-oriented-programming-oop-python/&quot;&gt;video course&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 #138: 2022 Real Python Tutorial &amp; Video Course Wrap Up</title>
      <id>https://realpython.com/podcasts/rpp/138/</id>
      <link href="https://realpython.com/podcasts/rpp/138/"/>
      <updated>2022-12-23T12:00:00+00:00</updated>
      <summary>It&#x27;s been another year of changes at Real Python! The Real Python team has written, edited, curated, illustrated, and produced a mountain of Python material this year. We added some new members to the team, updated the site&#x27;s features, and created new styles of tutorials and video courses.</summary>
      <content type="html">
        &lt;p&gt;It&#x27;s been another year of changes at Real Python! The Real Python team has written, edited, curated, illustrated, and produced a mountain of Python material this year. We added some new members to the team, updated the site&#x27;s features, and created new styles of tutorials and video courses.&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: File System Operations</title>
      <id>https://realpython.com/courses/python-basics-file-system-operations/</id>
      <link href="https://realpython.com/courses/python-basics-file-system-operations/"/>
      <updated>2022-12-20T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to use the pathlib module to carry out file path operations with Python. These operations include creating, iterating over, searching for, moving, and deleting files and folders.</summary>
      <content type="html">
        &lt;p&gt;So far, you&amp;rsquo;ve written programs that get their input from one of two
sources: the user or the program itself. Program output has been limited
to displaying some text in IDLE&amp;rsquo;s interactive window.&lt;/p&gt;
&lt;p&gt;These &lt;strong&gt;input&lt;/strong&gt; and &lt;strong&gt;output&lt;/strong&gt; strategies aren&amp;rsquo;t useful in several common
scenarios, such as when:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The input values are unknown while writing the program.&lt;/li&gt;
&lt;li&gt;The program requires more data than a user can be expected to type in by themselves.&lt;/li&gt;
&lt;li&gt;Output must be shared with others after the program runs.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is where &lt;strong&gt;files&lt;/strong&gt; come in. You&amp;rsquo;ve likely been working with computer files for a long time. Even
so, there are some things that programmers need to know about files
that general users do not. Specifically, you&amp;rsquo;ll want to master some &lt;strong&gt;file system operations&lt;/strong&gt; using the &lt;strong&gt;&lt;code&gt;pathlib&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;shutil&lt;/code&gt;&lt;/strong&gt; modules.&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; files and directories&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Iterate over&lt;/strong&gt; the contents of a directory&lt;/li&gt;
&lt;li&gt;Search for files and folders using &lt;strong&gt;wildcards&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Move&lt;/strong&gt; and &lt;strong&gt;delete&lt;/strong&gt; files and folders&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. 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 #137: Start Using a Build System &amp; Continuous Integration in Python</title>
      <id>https://realpython.com/podcasts/rpp/137/</id>
      <link href="https://realpython.com/podcasts/rpp/137/"/>
      <updated>2022-12-16T12:00:00+00:00</updated>
      <summary>What advantages can a build system provide for a Python developer? What new skills are required when working with a team of developers? This week on the show, Benjy Weinberger from Toolchain is here to discuss the Pants build system and getting started with continuous integration (CI).</summary>
      <content type="html">
        &lt;p&gt;What advantages can a build system provide for a Python developer? What new skills are required when working with a team of developers? This week on the show, Benjy Weinberger from Toolchain is here to discuss the Pants build system and getting started with continuous integration (CI).&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>
