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

  <title>Real Python</title>
  <link href="https://realpython.com/atom.xml" rel="self"/>
  <link href="https://realpython.com/"/>
  <updated>2021-01-27T14:00:00+00:00</updated>
  <id>https://realpython.com/</id>
  <author>
    <name>Real Python</name>
  </author>

  
    <entry>
      <title>Stochastic Gradient Descent Algorithm With Python and NumPy</title>
      <id>https://realpython.com/gradient-descent-algorithm-python/</id>
      <link href="https://realpython.com/gradient-descent-algorithm-python/"/>
      <updated>2021-01-27T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn what the stochastic gradient descent algorithm is, how it works, and how to implement it with Python and NumPy.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Stochastic_gradient_descent&quot;&gt;&lt;strong&gt;Stochastic gradient descent&lt;/strong&gt;&lt;/a&gt; is an optimization algorithm often used in machine learning applications to find the model parameters that correspond to the best fit between predicted and actual outputs. It’s an inexact but powerful technique.&lt;/p&gt;
&lt;p&gt;Stochastic gradient descent is widely used in machine learning applications. Combined with &lt;a href=&quot;https://brilliant.org/wiki/backpropagation/&quot;&gt;backpropagation&lt;/a&gt;, it’s dominant in &lt;a href=&quot;https://realpython.com/python-keras-text-classification/#a-primer-on-deep-neural-networks&quot;&gt;neural network&lt;/a&gt; training applications.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How &lt;strong&gt;gradient descent&lt;/strong&gt; and &lt;strong&gt;stochastic gradient descent&lt;/strong&gt; algorithms work&lt;/li&gt;
&lt;li&gt;How to apply gradient descent and stochastic gradient descent to &lt;strong&gt;minimize the loss function&lt;/strong&gt; in machine learning&lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;learning rate&lt;/strong&gt; is, why it’s important, and how it impacts results&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;write your own function&lt;/strong&gt; for stochastic gradient descent&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-mastery-course/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-mastery-course&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you’ll need to take your Python skills to the next level.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;basic-gradient-descent-algorithm&quot;&gt;Basic Gradient Descent Algorithm&lt;a class=&quot;headerlink&quot; href=&quot;#basic-gradient-descent-algorithm&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Gradient_descent&quot;&gt;gradient descent algorithm&lt;/a&gt; is an approximate and iterative method for &lt;a href=&quot;https://en.wikipedia.org/wiki/Mathematical_optimization&quot;&gt;mathematical optimization&lt;/a&gt;. You can use it to approach the minimum of any &lt;a href=&quot;https://en.wikipedia.org/wiki/Differentiable_function&quot;&gt;differentiable function&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; There are many optimization methods and &lt;a href=&quot;https://en.wikipedia.org/wiki/Mathematical_optimization#Major_subfields&quot;&gt;subfields of mathematical programming&lt;/a&gt;. If you want to learn how to use some of them with Python, then check out &lt;a href=&quot;https://realpython.com/python-scipy-cluster-optimize/&quot;&gt;Scientific Python: Using SciPy for Optimization&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/linear-programming-python/&quot;&gt;Hands-On Linear Programming: Optimization With Python&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Although gradient descent sometimes gets stuck in a &lt;a href=&quot;https://en.wikipedia.org/wiki/Local_optimum&quot;&gt;local minimum&lt;/a&gt; or a &lt;a href=&quot;https://en.wikipedia.org/wiki/Saddle_point&quot;&gt;saddle point&lt;/a&gt; instead of finding the global minimum, it’s widely used in practice. &lt;a href=&quot;https://realpython.com/learning-paths/data-science-python-core-skills/&quot;&gt;Data science&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/learning-paths/machine-learning-python/&quot;&gt;machine learning&lt;/a&gt; methods often apply it internally to optimize model parameters. For example, neural networks find &lt;a href=&quot;https://docs.paperspace.com/machine-learning/wiki/weights-and-biases&quot;&gt;weights and biases&lt;/a&gt; with gradient descent.&lt;/p&gt;
&lt;h3 id=&quot;cost-function-the-goal-of-optimization&quot;&gt;Cost Function: The Goal of Optimization&lt;a class=&quot;headerlink&quot; href=&quot;#cost-function-the-goal-of-optimization&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;cost function&lt;/strong&gt;, or &lt;a href=&quot;https://en.wikipedia.org/wiki/Loss_function&quot;&gt;loss function&lt;/a&gt;, is the function to be minimized (or maximized) by varying the decision variables. Many machine learning methods solve optimization problems under the surface. They tend to minimize the difference between actual and predicted outputs by adjusting the model parameters (like weights and biases for &lt;a href=&quot;https://en.wikipedia.org/wiki/Artificial_neural_network&quot;&gt;neural networks&lt;/a&gt;, decision rules for &lt;a href=&quot;https://en.wikipedia.org/wiki/Random_forest&quot;&gt;random forest&lt;/a&gt; or &lt;a href=&quot;https://en.wikipedia.org/wiki/Gradient_boosting&quot;&gt;gradient boosting&lt;/a&gt;, and so on).&lt;/p&gt;
&lt;p&gt;In a &lt;a href=&quot;https://realpython.com/linear-regression-in-python/#regression&quot;&gt;regression problem&lt;/a&gt;, you typically have the vectors of input variables 𝐱 = (𝑥₁, …, 𝑥ᵣ) and the actual outputs 𝑦. You want to find a model that maps 𝐱 to a predicted response 𝑓(𝐱) so that 𝑓(𝐱) is as close as possible to 𝑦. For example, you might want to predict an output such as a person’s salary given inputs like the person’s number of years at the company or level of education.&lt;/p&gt;
&lt;p&gt;Your goal is to minimize the difference between the prediction 𝑓(𝐱) and the actual data 𝑦. This difference is called the &lt;strong&gt;residual&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In this type of problem, you want to minimize the &lt;a href=&quot;https://en.wikipedia.org/wiki/Residual_sum_of_squares&quot;&gt;sum of squared residuals (SSR)&lt;/a&gt;, where SSR = Σᵢ(𝑦ᵢ − 𝑓(𝐱ᵢ))² for all observations 𝑖 = 1, …, 𝑛, where 𝑛 is the total number of observations. Alternatively, you could use the &lt;a href=&quot;https://en.wikipedia.org/wiki/Mean_squared_error&quot;&gt;mean squared error&lt;/a&gt; (MSE = SSR / 𝑛) instead of SSR.&lt;/p&gt;
&lt;p&gt;Both SSR and MSE use the square of the difference between the actual and predicted outputs. The lower the difference, the more accurate the prediction. A difference of zero indicates that the prediction is equal to the actual data.&lt;/p&gt;
&lt;p&gt;SSR or MSE is minimized by adjusting the model parameters. For example, in &lt;a href=&quot;https://realpython.com/linear-regression-in-python/&quot;&gt;linear regression&lt;/a&gt;, you want to find the function 𝑓(𝐱) = 𝑏₀ + 𝑏₁𝑥₁ + ⋯ + 𝑏ᵣ𝑥ᵣ, so you need to determine the weights 𝑏₀, 𝑏₁, …, 𝑏ᵣ that minimize SSR or MSE.&lt;/p&gt;
&lt;p&gt;In a &lt;a href=&quot;https://realpython.com/logistic-regression-python/#classification&quot;&gt;classification problem&lt;/a&gt;, the outputs 𝑦 are &lt;a href=&quot;https://en.wikipedia.org/wiki/Categorical_variable&quot;&gt;categorical&lt;/a&gt;, often either 0 or 1. For example, you might try to predict whether an email is spam or not. In the case of binary outputs, it’s convenient to minimize the &lt;a href=&quot;https://en.wikipedia.org/wiki/Cross_entropy&quot;&gt;cross-entropy function&lt;/a&gt; that also depends on the actual outputs 𝑦ᵢ and the corresponding predictions 𝑝(𝐱ᵢ):&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;https://files.realpython.com/media/mmst-gda-eqs-1.119ab87cc186.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-66&quot; src=&quot;https://files.realpython.com/media/mmst-gda-eqs-1.119ab87cc186.png&quot; width=&quot;1816&quot; height=&quot;194&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/mmst-gda-eqs-1.119ab87cc186.png&amp;amp;w=454&amp;amp;sig=e6d8b3e4d147738a8c0ccebf2e4747b5b63b74a9 454w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/mmst-gda-eqs-1.119ab87cc186.png&amp;amp;w=908&amp;amp;sig=1558fcfcdbaf30b23a55ae380291769b090d1194 908w, https://files.realpython.com/media/mmst-gda-eqs-1.119ab87cc186.png 1816w&quot; sizes=&quot;75vw&quot; alt=&quot;mmst-gda-eqs-1&quot; data-asset=&quot;3400&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;In &lt;a href=&quot;https://realpython.com/logistic-regression-python/&quot;&gt;logistic regression&lt;/a&gt;, which is often used to solve classification problems, the functions 𝑝(𝐱) and 𝑓(𝐱) are defined as the following:&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;https://files.realpython.com/media/mmst-gda-eqs-2.76aa15da2cc0.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-66&quot; src=&quot;https://files.realpython.com/media/mmst-gda-eqs-2.76aa15da2cc0.png&quot; width=&quot;1820&quot; height=&quot;317&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/mmst-gda-eqs-2.76aa15da2cc0.png&amp;amp;w=455&amp;amp;sig=8d933a1259c626545ac1760d9fdbb509c1efe61e 455w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/mmst-gda-eqs-2.76aa15da2cc0.png&amp;amp;w=910&amp;amp;sig=c961e1c3c89347d7084083609cb267b54dfb67be 910w, https://files.realpython.com/media/mmst-gda-eqs-2.76aa15da2cc0.png 1820w&quot; sizes=&quot;75vw&quot; alt=&quot;mmst-gda-eqs-2&quot; data-asset=&quot;3401&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;Again, you need to find the weights 𝑏₀, 𝑏₁, …, 𝑏ᵣ, but this time they should minimize the cross-entropy function.&lt;/p&gt;
&lt;h3 id=&quot;gradient-of-a-function-calculus-refresher&quot;&gt;Gradient of a Function: Calculus Refresher&lt;a class=&quot;headerlink&quot; href=&quot;#gradient-of-a-function-calculus-refresher&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In calculus, the &lt;a href=&quot;https://www.mathsisfun.com/calculus/derivatives-introduction.html&quot;&gt;derivative&lt;/a&gt; of a function shows you how much a value changes when you modify its argument (or arguments). Derivatives are important for optimization because the &lt;a href=&quot;http://sofia.nmsu.edu/~breakingaway/ebookofcalculus/MeaningOfDerivativesAndIntegrals/WhatDoesItMeanThatTheDerivativeOfAFunctionEquals0/WhatDoesItMeanThatTheDerivativeOfAFunctionEquals0.html&quot;&gt;zero derivatives&lt;/a&gt; might indicate a minimum, maximum, or saddle point.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/Gradient&quot;&gt;gradient&lt;/a&gt; of a function 𝐶 of several independent variables 𝑣₁, …, 𝑣ᵣ is denoted with ∇𝐶(𝑣₁, …, 𝑣ᵣ) and defined as the vector function of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Partial_derivative&quot;&gt;partial derivatives&lt;/a&gt; of 𝐶 with respect to each independent variable: ∇𝐶 = (∂𝐶/∂𝑣₁, …, ∂𝐶/𝑣ᵣ). The symbol ∇ is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Nabla_symbol&quot;&gt;nabla&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The nonzero value of the gradient of a function 𝐶 at a given point defines the direction and rate of the fastest increase of 𝐶. When working with gradient descent, you’re interested in the direction of the fastest &lt;em&gt;decrease&lt;/em&gt; in the cost function. This direction is determined by the negative gradient, −∇𝐶.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/gradient-descent-algorithm-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/gradient-descent-algorithm-python/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Evaluate Expressions Dynamically With Python eval()</title>
      <id>https://realpython.com/courses/evaluate-expressions-dynamically-python-eval/</id>
      <link href="https://realpython.com/courses/evaluate-expressions-dynamically-python-eval/"/>
      <updated>2021-01-26T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn how Python&#x27;s eval() works and how to use it effectively in your programs. Additionally, you&#x27;ll learn how to minimize the security risks associated to the use of eval().</summary>
      <content type="html">
        &lt;p&gt;The built-in Python function &lt;code&gt;eval()&lt;/code&gt; is used to evaluate Python expressions. You can pass a string containing Python, or a pre-compiled object into &lt;code&gt;eval()&lt;/code&gt; and it will run the code and return the result. &lt;/p&gt;
&lt;p&gt;Although Python&amp;rsquo;s &lt;code&gt;eval()&lt;/code&gt; is an incredibly useful tool, the function has some important security implications that you should consider before using it. In this course, you&amp;rsquo;ll learn how &lt;code&gt;eval()&lt;/code&gt; works and how to use it safely and effectively in your Python programs.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How Python&amp;rsquo;s &lt;strong&gt;&lt;code&gt;eval()&lt;/code&gt;&lt;/strong&gt; works&lt;/li&gt;
&lt;li&gt;How to use &lt;code&gt;eval()&lt;/code&gt; to &lt;strong&gt;dynamically evaluate&lt;/strong&gt; arbitrary string-based or compiled-code-based input&lt;/li&gt;
&lt;li&gt;How &lt;code&gt;eval()&lt;/code&gt; can make your code insecure and how to minimize the associated &lt;strong&gt;security risks&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The code in this course was tested with Python 3.9.0, &lt;code&gt;eval()&lt;/code&gt; has not changed much and older versions should be compatible.&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 Use Python: Your First Steps</title>
      <id>https://realpython.com/python-first-steps/</id>
      <link href="https://realpython.com/python-first-steps/"/>
      <updated>2021-01-25T16:27:13+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn the basics of how to use Python. With this knowledge, you&#x27;ll be able to start coding your Python applications.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Are you looking for a place to learn the basics of how to use &lt;a href=&quot;https://realpython.com/learning-paths/python3-introduction/&quot;&gt;Python from a beginner’s perspective&lt;/a&gt;? Do you want to get up and running with Python but don’t know where to start? If so, then this tutorial is for you. This tutorial focuses on the essentials you need to know to start programming with Python.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;strong&gt;Python&lt;/strong&gt; is and why you should use it&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;basic Python syntax&lt;/strong&gt; you should learn to start coding&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;handle errors&lt;/strong&gt; in Python&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;get help&lt;/strong&gt; quickly in Python&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;code style&lt;/strong&gt; you should apply in your code&lt;/li&gt;
&lt;li&gt;Where to get &lt;strong&gt;extra functionalities&lt;/strong&gt; without reinventing the wheel&lt;/li&gt;
&lt;li&gt;Where to find quality Python content and &lt;strong&gt;grow your skills&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll also have the opportunity to create your first Python program and &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;run it on your computer&lt;/a&gt;. Finally, you’ll have a chance to evaluate your progress with a quiz that’ll give you an idea of how much you’ve learned.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-experiment&quot; data-focus=&quot;false&quot;&gt;Click here to get our free Python Cheat Sheet&lt;/a&gt; that shows you the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;why-you-should-use-python&quot;&gt;Why You Should Use Python&lt;a class=&quot;headerlink&quot; href=&quot;#why-you-should-use-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;figure&gt;&lt;a href=&quot;https://files.realpython.com/media/pythonlogo.0658b34b4498.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid w-25 float-right&quot; src=&quot;https://files.realpython.com/media/pythonlogo.0658b34b4498.jpg&quot; width=&quot;680&quot; height=&quot;459&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/pythonlogo.0658b34b4498.jpg&amp;amp;w=170&amp;amp;sig=ac227e7d70841aa87fe92a62acbdddf6938350eb 170w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/pythonlogo.0658b34b4498.jpg&amp;amp;w=340&amp;amp;sig=1afd2a88fd379da035a4734b3e5d8616075dcf22 340w, https://files.realpython.com/media/pythonlogo.0658b34b4498.jpg 680w&quot; sizes=&quot;75vw&quot; alt=&quot;The Python Logo. The Python logo is a trademark of the Python Software Foundation.&quot; data-asset=&quot;183&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;Python, named after the British comedy group &lt;a href=&quot;https://en.wikipedia.org/wiki/Monty_Python&quot;&gt;Monty Python&lt;/a&gt;, is a &lt;strong&gt;high-level&lt;/strong&gt;, &lt;strong&gt;interpreted&lt;/strong&gt;, &lt;strong&gt;interactive&lt;/strong&gt;, and &lt;strong&gt;object-oriented&lt;/strong&gt; programming language. Its flexibility allows you to do &lt;a href=&quot;https://realpython.com/what-can-i-do-with-python/&quot;&gt;many things&lt;/a&gt;, both big and small. With Python, you can write basic programs and scripts and also to create complex and large-scale enterprise solutions. Here’s a sampling of its uses:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Building desktop applications, including &lt;a href=&quot;https://realpython.com/learning-paths/python-gui-programming/&quot;&gt;GUI applications&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/&quot;&gt;CLI tools&lt;/a&gt;, and even &lt;a href=&quot;https://realpython.com/pygame-a-primer/&quot;&gt;games&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Doing &lt;a href=&quot;https://realpython.com/learning-paths/math-data-science/&quot;&gt;mathematical&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/learning-paths/data-science-python-core-skills/&quot;&gt;scientific&lt;/a&gt; analysis of data&lt;/li&gt;
&lt;li&gt;Building &lt;a href=&quot;https://realpython.com/learning-paths/become-python-web-developer/&quot;&gt;web&lt;/a&gt; and Internet applications&lt;/li&gt;
&lt;li&gt;Doing computer systems administration and automating tasks&lt;/li&gt;
&lt;li&gt;Performing &lt;a href=&quot;https://realpython.com/tutorials/devops/&quot;&gt;DevOps&lt;/a&gt; tasks&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can find Python everywhere in the world of computer programming. For example, Python is the foundation of some of the world’s &lt;a href=&quot;https://realpython.com/world-class-companies-using-python/&quot;&gt;most popular websites&lt;/a&gt;, including Reddit, Dropbox, and YouTube, to name a few. The Python web framework &lt;a href=&quot;https://realpython.com/learning-paths/django-web-development/&quot;&gt;Django&lt;/a&gt; powers both &lt;a href=&quot;https://www.instagram.com/&quot;&gt;Instagram&lt;/a&gt; and &lt;a href=&quot;https://pinterest.com/&quot;&gt;Pinterest&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Python has a bunch of features that make it attractive as your first programming language:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Free:&lt;/strong&gt; Python is available free of charge, even for commercial purposes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Open source:&lt;/strong&gt; Anyone can contribute to Python development.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Accessible:&lt;/strong&gt; People of all ages, from school children to retirees, have learned Python, and so can you.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Versatile:&lt;/strong&gt; Python can help you solve problems in many fields, including scripting, data science, web development, GUI development, and more.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Powerful:&lt;/strong&gt; You can code small scripts to automate repetitive tasks, and you can also create complex and large-scale enterprise solutions with Python.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Compared to other programming languages, Python has the following features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Interpreted:&lt;/strong&gt; It’s portable and quicker to experiment with than compiled languages.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Multiparadigm:&lt;/strong&gt; It lets you write code in different styles, including &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Imperative_programming&quot;&gt;imperative&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-reduce-function/&quot;&gt;functional&lt;/a&gt; style.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Dynamically typed:&lt;/strong&gt; It checks &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variable&lt;/a&gt; types at runtime, so you don’t need to declare them explicitly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Strongly typed:&lt;/strong&gt; It won’t let unsafe operations on incompatible types go unnoticed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There’s a lot more to learn about Python. But by now, you should have a better idea of why Python is so popular and why you should consider learning to program with it.&lt;/p&gt;
&lt;h2 id=&quot;how-to-download-and-install-python&quot;&gt;How to Download and Install Python&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-download-and-install-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python works on Linux, Mac, Windows, and several other platforms. It comes preinstalled on macOS and on most Linux distributions. However, if you want to be up to date, then you probably need to download and install the latest version. You also have the choice of using &lt;a href=&quot;https://realpython.com/intro-to-pyenv/&quot;&gt;different Python versions&lt;/a&gt; in different projects if you want to.&lt;/p&gt;
&lt;p&gt;To check what Python version has been installed globally in your operating system, open the terminal or command line and run the following command:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; python3 -V
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command prints the version of your system’s default Python 3 installation. Note that you use &lt;code&gt;python3&lt;/code&gt; instead of &lt;code&gt;python&lt;/code&gt; because some operating systems still include Python 2 as their default Python installation.&lt;/p&gt;
&lt;h3 id=&quot;installing-python-from-binaries&quot;&gt;Installing Python From Binaries&lt;a class=&quot;headerlink&quot; href=&quot;#installing-python-from-binaries&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Regardless of your operating system, you can download an appropriate version of Python from the &lt;a href=&quot;https://www.python.org/&quot;&gt;official site&lt;/a&gt;. Go there and grab the appropriate 32-bit or 64-bit version for your operating system and processor.&lt;/p&gt;
&lt;p&gt;Selecting and downloading a Python binary from the language’s official site is often a good choice. However, there are some OS-specific alternatives:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;macOS:&lt;/strong&gt; You have the option of &lt;a href=&quot;https://realpython.com/installing-python/#what-your-options-are_1&quot;&gt;installing Python&lt;/a&gt; from &lt;a href=&quot;http://brew.sh/&quot;&gt;Homebrew&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Linux:&lt;/strong&gt; You can install several Python versions using your distribution’s package manager.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Windows:&lt;/strong&gt; You can install Python from the &lt;a href=&quot;https://www.microsoft.com/en-ca/search?q=python&quot;&gt;Microsoft Store&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can also use the &lt;a href=&quot;https://www.anaconda.com/products/individual&quot;&gt;Anaconda distribution&lt;/a&gt; to install Python along with a rich set of packages and libraries, or you can use &lt;a href=&quot;https://docs.conda.io/en/latest/miniconda.html&quot;&gt;Miniconda&lt;/a&gt; if you want to install only the packages you need.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-first-steps/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-first-steps/ »&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 #44: Creating an Interactive Online Python Conference for PyCascades 2021</title>
      <id>https://realpython.com/podcasts/rpp/44/</id>
      <link href="https://realpython.com/podcasts/rpp/44/"/>
      <updated>2021-01-22T12:00:00+00:00</updated>
      <summary>How do you create a virtual conference that retains the interactivity of an in-person event? What are the tools needed for talk submissions, ticketing, and live hosting? Can you find those tools written in Python? 
This week on the show, we have several of the organizers of the PyCascades 2021 conference. They share the process of restructuring a Python conference to meet those challenges.</summary>
      <content type="html">
        &lt;p&gt;How do you create a virtual conference that retains the interactivity of an in-person event? What are the tools needed for talk submissions, ticketing, and live hosting? Can you find those tools written in Python? 
This week on the show, we have several of the organizers of the PyCascades 2021 conference. They share the process of restructuring a Python conference to meet those challenges.&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>C for Python Programmers</title>
      <id>https://realpython.com/c-for-python-programmers/</id>
      <link href="https://realpython.com/c-for-python-programmers/"/>
      <updated>2021-01-20T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn the basics of the C language, which is used in the source code for CPython, the most popular Python implementation. Learning C is important for Python programmers interested in contributing to CPython.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The purpose of this tutorial is to get an experienced Python programmer up to speed with the basics of the &lt;a href=&quot;https://en.wikipedia.org/wiki/C_(programming_language)&quot;&gt;C language&lt;/a&gt; and how it’s used in the &lt;a href=&quot;https://en.wikipedia.org/wiki/CPython&quot;&gt;CPython&lt;/a&gt; source code. It assumes you already have an intermediate understanding of Python syntax.&lt;/p&gt;
&lt;p&gt;That said, C is a fairly limited language, and most of its usage in CPython falls under a small set of syntax rules. Getting to the point where you understand the code is a much smaller step than being able to write C effectively. This tutorial is aimed at the first goal but not the second.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What the &lt;strong&gt;C preprocessor&lt;/strong&gt; is and what role it plays in building C programs&lt;/li&gt;
&lt;li&gt;How you can use &lt;strong&gt;preprocessor directives&lt;/strong&gt; to manipulate source files&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;C syntax&lt;/strong&gt; compares to &lt;strong&gt;Python syntax&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to create &lt;strong&gt;loops&lt;/strong&gt;, &lt;strong&gt;functions&lt;/strong&gt;, &lt;strong&gt;strings&lt;/strong&gt;, and other features in C&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;One of the first things that stands out as a big difference between Python and C is the C preprocessor. You’ll look at that first.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This tutorial is adapted from the appendix, “Introduction to C for Python Programmers,” in &lt;a href=&quot;https://realpython.com/products/cpython-internals-book/&quot;&gt;&lt;em&gt;CPython Internals: Your Guide to the Python Interpreter&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/div&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/cpython-internals-sample/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-cpython-internals-sample&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Get a sample chapter from CPython Internals: Your Guide to the Python 3 Interpreter&lt;/a&gt; showing you how to unlock the inner workings of the Python language, compile the Python interpreter from source  code, and participate in the development of CPython.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;the-c-preprocessor&quot;&gt;The C Preprocessor&lt;a class=&quot;headerlink&quot; href=&quot;#the-c-preprocessor&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The preprocessor, as the name suggests, is run on your source files before the compiler runs. It has very limited abilities, but you can use them to great advantage in building C programs.&lt;/p&gt;
&lt;p&gt;The preprocessor produces a new file, which is what the compiler will actually process. All the commands to the preprocessor start at the beginning of a line, with a &lt;code&gt;#&lt;/code&gt; symbol as the first non-whitespace character.&lt;/p&gt;
&lt;p&gt;The main purpose of the preprocessor is to do text substitution in the source file, but it will also do some basic conditional code with &lt;code&gt;#if&lt;/code&gt; or similar statements.&lt;/p&gt;
&lt;p&gt;You’ll start with the most frequent preprocessor directive: &lt;code&gt;#include&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&quot;include&quot;&gt;&lt;code&gt;#include&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#include&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;#include&lt;/code&gt; is used to pull the contents of one file into the current source file. There’s nothing sophisticated about &lt;code&gt;#include&lt;/code&gt;. It reads a file from the file system, runs the preprocessor on that file, and puts the results into the output file. This is done recursively for each &lt;code&gt;#include&lt;/code&gt; directive.&lt;/p&gt;
&lt;p&gt;For example, if you look at CPython’s &lt;a href=&quot;https://github.com/python/cpython/blob/master/Modules/_multiprocessing/semaphore.c&quot;&gt;&lt;code&gt;Modules/_multiprocessing/semaphore.c&lt;/code&gt; file&lt;/a&gt;, then near the top you’ll see the following line:&lt;/p&gt;
&lt;div class=&quot;highlight c&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#include&lt;/span&gt; &lt;span class=&quot;cpf&quot;&gt;&quot;multiprocessing.h&quot;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This tells the preprocessor to pull in the entire contents of &lt;code&gt;multiprocessing.h&lt;/code&gt; and put them into the output file at this position.&lt;/p&gt;
&lt;p&gt;You’ll notice two different forms for the &lt;code&gt;#include&lt;/code&gt; statement. One of them uses quotes (&lt;code&gt;&quot;&quot;&lt;/code&gt;) to specify the name of the include file, and the other uses angle brackets (&lt;code&gt;&amp;lt;&amp;gt;&lt;/code&gt;). The difference comes from which paths are searched when looking for the file on the file system.&lt;/p&gt;
&lt;p&gt;If you use &lt;code&gt;&amp;lt;&amp;gt;&lt;/code&gt; for the filename, then the preprocessor will look only at system include files. Using quotes around the filename instead will force the preprocessor to look in the local directory first and then fall back to the system directories.&lt;/p&gt;
&lt;h3 id=&quot;define&quot;&gt;&lt;code&gt;#define&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#define&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;#define&lt;/code&gt; allows you to do simple text substitution and also plays into the &lt;code&gt;#if&lt;/code&gt; directives you’ll see below.&lt;/p&gt;
&lt;p&gt;At its most basic, &lt;code&gt;#define&lt;/code&gt; lets you define a new symbol that gets replaced with a text string in the preprocessor output.&lt;/p&gt;
&lt;p&gt;Continuing in &lt;code&gt;semphore.c&lt;/code&gt;, you’ll find this line:&lt;/p&gt;
&lt;div class=&quot;highlight c&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#define SEM_FAILED NULL&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This tells the preprocessor to replace every instance of &lt;code&gt;SEM_FAILED&lt;/code&gt; below this point with the literal string &lt;code&gt;NULL&lt;/code&gt; before the code is sent to the compiler.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/c-for-python-programmers/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/c-for-python-programmers/ »&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>Introduction to Sorting Algorithms in Python</title>
      <id>https://realpython.com/courses/intro-sorting-algorithms/</id>
      <link href="https://realpython.com/courses/intro-sorting-algorithms/"/>
      <updated>2021-01-19T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn all about five different sorting algorithms in Python from both a theoretical and a practical standpoint. You&#x27;ll also learn several related and important concepts, including Big O notation and recursion.</summary>
      <content type="html">
        &lt;p&gt;&lt;strong&gt;Sorting&lt;/strong&gt; is a basic building block that many other algorithms are built upon. It&amp;rsquo;s related to several exciting ideas that you&amp;rsquo;ll see throughout your programming career. Understanding how sorting algorithms in Python work behind the scenes is a fundamental step toward implementing correct and efficient algorithms that solve real-world problems.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How different &lt;strong&gt;sorting algorithms in Python&lt;/strong&gt; work and how they compare under different circumstances&lt;/li&gt;
&lt;li&gt;How &lt;strong&gt;Python&amp;rsquo;s built-in sort functionality&lt;/strong&gt; works behind the scenes&lt;/li&gt;
&lt;li&gt;How different computer science concepts like &lt;strong&gt;recursion&lt;/strong&gt; and &lt;strong&gt;divide and conquer&lt;/strong&gt; apply to sorting&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;Big O notation&lt;/strong&gt; is and how to use it to compare the efficiency of different algorithms&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Make Your First Python Game: Rock, Paper, Scissors!</title>
      <id>https://realpython.com/python-rock-paper-scissors/</id>
      <link href="https://realpython.com/python-rock-paper-scissors/"/>
      <updated>2021-01-18T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn to program rock paper scissors in Python from scratch. You&#x27;ll learn how to take in user input, make the computer choose a random action, determine a winner, and split your code into functions.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Game programming is a great way to learn how to program. You use many tools that you’ll see in the real world, plus you get to play a game to test your results! An ideal game to start your Python game programming journey is &lt;a href=&quot;https://en.wikipedia.org/wiki/Rock_paper_scissors&quot;&gt;rock paper scissors&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Code your own &lt;strong&gt;rock paper scissors&lt;/strong&gt; game &lt;/li&gt;
&lt;li&gt;Take in user input with &lt;strong&gt;&lt;code&gt;input()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Play several games in a row using a &lt;strong&gt;&lt;code&gt;while&lt;/code&gt; loop&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Clean up your code with &lt;strong&gt;&lt;code&gt;Enum&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;functions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Define more complex rules with a &lt;strong&gt;dictionary&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-mastery-course/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-mastery-course&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you’ll need to take your Python skills to the next level.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;what-is-rock-paper-scissors&quot;&gt;What Is Rock Paper Scissors?&lt;a class=&quot;headerlink&quot; href=&quot;#what-is-rock-paper-scissors&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You may have played rock paper scissors before. Maybe you’ve used it to decide who pays for dinner or who gets first choice of players for a team.&lt;/p&gt;
&lt;p&gt;If you’re unfamiliar, rock paper scissors is a &lt;a href=&quot;https://en.wikipedia.org/wiki/Hand_game&quot;&gt;hand game&lt;/a&gt; for two or more players. Participants say “rock, paper, scissors” and then simultaneously form their hands into the shape of a rock (a fist), a piece of paper (palm facing downward), or a pair of scissors (two fingers extended). The rules are straightforward: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Rock&lt;/strong&gt; smashes scissors. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Paper&lt;/strong&gt; covers rock.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scissors&lt;/strong&gt; cut paper.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now that you have the rules down, you can start thinking about how they might translate to Python code. &lt;/p&gt;
&lt;h2 id=&quot;play-a-single-game-of-rock-paper-scissors-in-python&quot;&gt;Play a Single Game of Rock Paper Scissors in Python&lt;a class=&quot;headerlink&quot; href=&quot;#play-a-single-game-of-rock-paper-scissors-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Using the description and rules above, you can make a game of rock paper scissors. Before you dive in, you’re going to need to &lt;a href=&quot;https://realpython.com/python-import/&quot;&gt;import&lt;/a&gt; the module you’ll use to simulate the computer’s choices:&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;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;random&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Awesome! Now you’re able to use the different tools inside &lt;code&gt;random&lt;/code&gt; to randomize the computer’s actions in the game. Now what? Since your users will also need to be able to choose their actions, the first logical thing you need is a way to take in user input.&lt;/p&gt;
&lt;h3 id=&quot;take-user-input&quot;&gt;Take User Input&lt;a class=&quot;headerlink&quot; href=&quot;#take-user-input&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://realpython.com/python-input-output/&quot;&gt;Taking input from a user&lt;/a&gt; is pretty straightforward in Python. The goal here is to ask the user what they would like to choose as an action and then assign that choice to a variable:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;user_action&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Enter a choice (rock, paper, scissors): &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;This will prompt the user to enter a selection and save it to a variable for later use. Now that the user has selected an action, the computer needs to decide what to do.&lt;/p&gt;
&lt;h3 id=&quot;make-the-computer-choose&quot;&gt;Make the Computer Choose&lt;a class=&quot;headerlink&quot; href=&quot;#make-the-computer-choose&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A competitive game of rock paper scissors involves &lt;a href=&quot;https://arstechnica.com/science/2014/05/win-at-rock-paper-scissors-by-knowing-thy-opponent/&quot;&gt;strategy&lt;/a&gt;. Rather than trying to develop a model for that, though, you can save yourself some time by having the computer select a random action. &lt;a href=&quot;https://realpython.com/python-random/&quot;&gt;Random selections&lt;/a&gt; are a great way to have the computer choose a &lt;a href=&quot;https://en.wikipedia.org/wiki/Pseudorandom_number_generator&quot;&gt;pseudorandom&lt;/a&gt; value.&lt;/p&gt;
&lt;p&gt;You can use &lt;strong&gt;&lt;code&gt;random.choice()&lt;/code&gt;&lt;/strong&gt; to have the computer randomly select between the actions:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;possible_actions&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;rock&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;paper&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;scissors&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;computer_action&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;choice&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;possible_actions&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;This allows a random element to be selected from the list. You can also &lt;a href=&quot;https://realpython.com/python-print/&quot;&gt;print&lt;/a&gt; the choices that the user and the computer made:&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;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;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;You chose &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user_action&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;, computer chose &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;computer_action&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.&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;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Printing the user and computer actions can be helpful to the user, and it can also help you debug later on in case something isn’t quite right with the outcome.&lt;/p&gt;
&lt;h3 id=&quot;determine-a-winner&quot;&gt;Determine a Winner&lt;a class=&quot;headerlink&quot; href=&quot;#determine-a-winner&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-rock-paper-scissors/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-rock-paper-scissors/ »&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 #43: Deep Reinforcement Learning in a Notebook With Jupylet + Gaming and Synthesis</title>
      <id>https://realpython.com/podcasts/rpp/43/</id>
      <link href="https://realpython.com/podcasts/rpp/43/"/>
      <updated>2021-01-15T12:00:00+00:00</updated>
      <summary>What is it like to design a Python library for three different audiences?  This week on the show, we have Nir Aides, creator of Jupylet. His new library is designed for deep reinforcement learning researchers, musicians interested in live music coding, and kids interested in learning to program. Everything is designed to run inside of a Jupyter notebook.</summary>
      <content type="html">
        &lt;p&gt;What is it like to design a Python library for three different audiences?  This week on the show, we have Nir Aides, creator of Jupylet. His new library is designed for deep reinforcement learning researchers, musicians interested in live music coding, and kids interested in learning to program. Everything is designed to run inside of a Jupyter notebook.&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>Sentiment Analysis: First Steps With Python&#x27;s NLTK Library</title>
      <id>https://realpython.com/python-nltk-sentiment-analysis/</id>
      <link href="https://realpython.com/python-nltk-sentiment-analysis/"/>
      <updated>2021-01-13T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to work with Python&#x27;s Natural Language Toolkit (NLTK) to process and analyze text. You&#x27;ll also learn how to perform sentiment analysis with built-in as well as custom classifiers!</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Once you understand the &lt;a href=&quot;https://realpython.com/learning-paths/python-basics-book/&quot;&gt;basics of Python&lt;/a&gt;, familiarizing yourself with its most popular packages will not only boost your mastery over the language but also rapidly increase your versatility. In this tutorial, you’ll learn the amazing capabilities of the Natural Language Toolkit (NLTK) for processing and analyzing text, from basic &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/sentiment-analysis-python/&quot;&gt;sentiment analysis&lt;/a&gt; powered by &lt;a href=&quot;https://realpython.com/learning-paths/machine-learning-python/&quot;&gt;machine learning&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sentiment analysis&lt;/strong&gt; can help you determine the ratio of positive to negative engagements about a specific topic. You can analyze bodies of text, such as comments, tweets, and product reviews, to obtain insights from your audience. In this tutorial, you’ll learn the important features of NLTK for processing text data and the different approaches you can use to perform sentiment analysis on your data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll be ready to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Split&lt;/strong&gt; and &lt;strong&gt;filter&lt;/strong&gt; text data in preparation for analysis&lt;/li&gt;
&lt;li&gt;Analyze &lt;strong&gt;word frequency&lt;/strong&gt; &lt;/li&gt;
&lt;li&gt;Find &lt;strong&gt;concordance&lt;/strong&gt; and &lt;strong&gt;collocations&lt;/strong&gt; using different methods&lt;/li&gt;
&lt;li&gt;Perform quick &lt;strong&gt;sentiment analysis&lt;/strong&gt; with NLTK’s built-in classifier&lt;/li&gt;
&lt;li&gt;Define features for &lt;strong&gt;custom classification&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use and compare &lt;strong&gt;classifiers&lt;/strong&gt; for sentiment analysis with NLTK&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-cheat-sheet-experiment&quot; data-focus=&quot;false&quot;&gt;Click here to get our free Python Cheat Sheet&lt;/a&gt; that shows you the basics of Python 3, like working with data types, dictionaries, lists, and Python functions.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-nltk&quot;&gt;Getting Started With NLTK&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-nltk&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The NLTK library contains various utilities that allow you to effectively manipulate and analyze linguistic data. Among its advanced features are &lt;strong&gt;text classifiers&lt;/strong&gt; that you can use for many kinds of classification, including sentiment analysis.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sentiment analysis&lt;/strong&gt; is the practice of using algorithms to classify various samples of related text into overall positive and negative categories. With NLTK, you can employ these algorithms through powerful built-in machine learning operations to obtain insights from linguistic data.&lt;/p&gt;
&lt;h3 id=&quot;installing-and-importing&quot;&gt;Installing and Importing&lt;a class=&quot;headerlink&quot; href=&quot;#installing-and-importing&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You’ll begin by installing some prerequisites, including NLTK itself as well as specific resources you’ll need throughout this tutorial.&lt;/p&gt;
&lt;p&gt;First, use &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt; to install NLTK:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; python3 -m pip install nltk
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;While this will install the NLTK module, you’ll still need to obtain a few additional resources. Some of them are text samples, and others are data models that certain NLTK functions require.&lt;/p&gt;
&lt;p&gt;To get the resources you’ll need, use &lt;code&gt;nltk.download()&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;nltk&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;nltk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;download&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;NLTK will display a download manager showing all available and installed resources. Here are the ones you’ll need to download for this tutorial:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;names&lt;/code&gt;:&lt;/strong&gt; A &lt;a href=&quot;http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/areas/nlp/corpora/names/&quot;&gt;list of common English names&lt;/a&gt; compiled by Mark Kantrowitz&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;stopwords&lt;/code&gt;:&lt;/strong&gt; A list of really common words, like articles, pronouns, prepositions, and conjunctions&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;state_union&lt;/code&gt;:&lt;/strong&gt; A sample of transcribed &lt;a href=&quot;https://en.wikipedia.org/wiki/State_of_the_Union&quot;&gt;State of the Union&lt;/a&gt; addresses by different US presidents, compiled by Kathleen Ahrens &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;twitter_samples&lt;/code&gt;:&lt;/strong&gt; A list of social media phrases posted to Twitter&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;movie_reviews&lt;/code&gt;:&lt;/strong&gt; &lt;a href=&quot;http://www.cs.cornell.edu/people/pabo/movie-review-data/&quot;&gt;Two thousand movie reviews&lt;/a&gt; categorized by Bo Pang and Lillian Lee&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;averaged_perceptron_tagger&lt;/code&gt;:&lt;/strong&gt; A data model that NLTK uses to categorize words into their &lt;a href=&quot;https://en.wikipedia.org/wiki/Part_of_speech&quot;&gt;part of speech&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;vader_lexicon&lt;/code&gt;:&lt;/strong&gt; A scored &lt;a href=&quot;https://github.com/cjhutto/vaderSentiment&quot;&gt;list of words and jargon&lt;/a&gt; that NLTK references when performing sentiment analysis, created by C.J. Hutto and Eric Gilbert&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;punkt&lt;/code&gt;:&lt;/strong&gt; A data model created by Jan Strunk that NLTK uses to split full texts into word lists&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Throughout this tutorial, you’ll find many references to the word &lt;strong&gt;corpus&lt;/strong&gt; and its plural form, &lt;strong&gt;corpora&lt;/strong&gt;. A corpus is a large collection of related text samples. In the context of NLTK, corpora are compiled with features for &lt;a href=&quot;https://en.wikipedia.org/wiki/Natural_language_processing&quot;&gt;natural language processing (NLP)&lt;/a&gt;, such as categories and numerical scores for particular features.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;A quick way to download specific resources directly from the console is to pass a list to &lt;code&gt;nltk.download()&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;nltk&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;nltk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;download&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;s2&quot;&gt;&quot;names&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;s2&quot;&gt;&quot;stopwords&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;s2&quot;&gt;&quot;state_union&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;s2&quot;&gt;&quot;twitter_samples&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;s2&quot;&gt;&quot;movie_reviews&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;s2&quot;&gt;&quot;averaged_perceptron_tagger&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;s2&quot;&gt;&quot;vader_lexicon&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;s2&quot;&gt;&quot;punkt&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data] Downloading package names to /home/user/nltk_data...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data]   Unzipping corpora/names.zip.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data] Downloading package stopwords to /home/user/nltk_data...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data]   Unzipping corpora/stopwords.zip.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data] Downloading package state_union to&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data]     /home/user/nltk_data...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data]   Unzipping corpora/state_union.zip.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data] Downloading package twitter_samples to&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data]     /home/user/nltk_data...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data]   Unzipping corpora/twitter_samples.zip.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data] Downloading package movie_reviews to&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data]     /home/user/nltk_data...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data]   Unzipping corpora/movie_reviews.zip.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data] Downloading package averaged_perceptron_tagger to&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data]     /home/user/nltk_data...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data]   Unzipping taggers/averaged_perceptron_tagger.zip.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data] Downloading package vader_lexicon to&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data]     /home/user/nltk_data...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data] Downloading package punkt to /home/user/nltk_data...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[nltk_data]   Unzipping tokenizers/punkt.zip.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will tell NLTK to find and download each resource based on its identifier.&lt;/p&gt;
&lt;p&gt;Should NLTK require additional resources that you haven’t installed, you’ll see a helpful &lt;code&gt;LookupError&lt;/code&gt; with details and instructions to download the resource:&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;nltk&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;w&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nltk&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;corpus&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shakespeare&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;words&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;LookupError:&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;**********************************************************************&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Resource shakespeare not found.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  Please use the NLTK Downloader to obtain the resource:&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;  &amp;gt;&amp;gt;&amp;gt; import nltk&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  &amp;gt;&amp;gt;&amp;gt; nltk.download(&#x27;shakespeare&#x27;)&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;The &lt;code&gt;LookupError&lt;/code&gt; specifies which resource is necessary for the requested operation along with instructions to download it using its identifier.&lt;/p&gt;
&lt;h3 id=&quot;compiling-data&quot;&gt;Compiling Data&lt;a class=&quot;headerlink&quot; href=&quot;#compiling-data&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-nltk-sentiment-analysis/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-nltk-sentiment-analysis/ »&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>Managing Python Dependencies</title>
      <id>https://realpython.com/courses/managing-python-dependencies/</id>
      <link href="https://realpython.com/courses/managing-python-dependencies/"/>
      <updated>2021-01-12T14:00:00+00:00</updated>
      <summary>Get up to speed with Python dependency management quickly and go from “writing scripts” to “building applications” with this complete course.</summary>
      <content type="html">
        &lt;p&gt;&lt;em&gt;Managing Python Dependencies&lt;/em&gt; is your &amp;ldquo;one-stop shop&amp;rdquo; for picking up modern Python dependency management practices and workflows with minimal time investment.&lt;/p&gt;
&lt;p&gt;The course consists of 32 bite-sized video lessons, each focusing on a single concept. Progressing through the course, you’ll quickly build up a comprehensive knowledge of dependency management best practices in Python at your own, comfortable pace.&lt;/p&gt;
&lt;p&gt;Along the way, you’ll see hands on examples and step-by-step workflows that reinforce the skills you’re learning.&lt;/p&gt;
&lt;p&gt;By the end, you’ll know how to apply Python’s recommended dependency management tools, like pip, virtualenvs, and requirements files effectively in the most common day-to-day development scenarios on Linux, macOS, and Windows.&lt;/p&gt;
&lt;p&gt;With &lt;em&gt;Managing Python Dependencies&lt;/em&gt; you will:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Code at a higher level and become more efficient&lt;/strong&gt;: Leveraging Python&amp;rsquo;s rich third-party library ecosystem let&amp;rsquo;s you write better programs in a shorter amount of time. With a large body of freely available modules you can avoid reinventing the wheel and deliver higher quality Python software, faster. This is a great way for you to demonstrate senior level skills that will benefit your development career.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Get up to speed with Python dependency management quickly&lt;/strong&gt;: Your time is your most important asset. If you can use it efficiently you will save your sanity—and a nice stack of money. This course is concise but thorough and will help you attain solid Python dependency management knowledge fast.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Go from &amp;ldquo;writing scripts&amp;rdquo; to &amp;ldquo;building applications&amp;rdquo; with Python&lt;/strong&gt;: By taking advantage of Python’s rich packaging ecosystem you’ll be able to build substantial and full-featured applications in Python. You’ll know the best practices for finding and documenting application dependencies that put you right on track for deploying and shipping production-grade apps.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Find great libraries for a specific task at hand&lt;/strong&gt;: This course teaches you a unique 7-step workflow for finding and identifying quality Python packages. Find out which libraries and tools are available on PyPI to help you. By quickly and easily identifying the correct libraries you’ll speed up your development efficiency by a large margin. Meet your deadlines and write better code at the same time by not having to &amp;ldquo;reinvent the wheel.&amp;rdquo;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Master &amp;ldquo;the tools of the trade&amp;rdquo; for dependency management&lt;/strong&gt;: With this course you’ll master the tools and workflows recommended by the official Python Packaging Authority. By getting those skills under your belt you’ll be ready to work with the Python development and production environments used by professional development teams across the world. Knowing these &amp;ldquo;tools of the trade&amp;rdquo; by heart puts you at an advantage in any job interview situation.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&amp;ldquo;Productionize&amp;rdquo; your projects and share them with the world&lt;/strong&gt;: You’ll see how to apply the best practices for defining and installing package dependencies in Python. You&amp;rsquo;ll know how to get your programs ready to be deployed on production and automated testing environments and how to make it easy for other developers to contribute code with minimal setup effort.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Become more valuable as an employee and team member&lt;/strong&gt;: With my detailed 7-step workflow for researching quality Python packages you’ll know how to document and justify added program dependencies to your team and your manager. By taking on more responsibilities and picking up these senior-level &amp;ldquo;architectural&amp;rdquo; skills you’ll rise head and shoulders above other devs stuck at the &amp;ldquo;code monkey&amp;rdquo; level.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;who-is-this-course-for&quot;&gt;Who Is This Course For?&lt;a class=&quot;headerlink&quot; href=&quot;#who-is-this-course-for&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;This course is for Python developers&lt;/strong&gt; wanting to break through to the next phase of developing code by becoming more efficient, productive, and skilled using Python&amp;rsquo;s rich library ecosystem.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;ve ever caught yourself thinking &lt;em&gt;&amp;ldquo;There&amp;rsquo;s got to be a Python package out there that does exactly what I want&amp;hellip;But how do I find it?&amp;rdquo;&lt;/em&gt; this course will fill in the missing pieces for you.&lt;/p&gt;
&lt;p&gt;Discover the industry best practices around choosing and managing third-party dependencies for your Python 2 or Python 3 projects on Windows, macOS, and Linux.&lt;/p&gt;
&lt;p&gt;If you already know how to use alternative package managers like &lt;em&gt;Conda&lt;/em&gt; you&amp;rsquo;ll discover how to use the standards-compliant tools and workflows supported by any Python distribution and used in most production application deployments.&lt;/p&gt;
&lt;h2 id=&quot;course-goals&quot;&gt;Course Goals&lt;a class=&quot;headerlink&quot; href=&quot;#course-goals&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;By the end of the course you’ll know how to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Install, use, and manage third-party Python packages with the &amp;ldquo;pip&amp;rdquo; package manager on Windows, macOS, and Linux.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Isolate project dependencies with so-called virtual environments to avoid version conflicts in your Python projects.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Apply a complete 7-step workflow for finding and identifying quality third-party packages to use in your own Python projects (and justifying your decisions to your team or manager.)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set up repeatable development environments and application deployments using the &amp;ldquo;pip&amp;rdquo; package manager and requirements files.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>NumPy Tutorial: Your First Steps Into Data Science in Python</title>
      <id>https://realpython.com/numpy-tutorial/</id>
      <link href="https://realpython.com/numpy-tutorial/"/>
      <updated>2021-01-11T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn everything you need to know to get up and running with NumPy, Python&#x27;s de facto standard for multidimensional data arrays. NumPy is the foundation for most data science in Python, so if you&#x27;re interested in that field, then this is a great place to start.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;NumPy is a Python library that provides a simple yet powerful data structure: the &lt;strong&gt;n-dimensional array&lt;/strong&gt;. This is the foundation on which almost all the power of Python’s data science toolkit is built, and learning NumPy is the first step on any Python data scientist’s journey. This tutorial will provide you with the knowledge you need to use NumPy and the higher-level libraries that rely on it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;strong&gt;core concepts&lt;/strong&gt; in data science are made possible by NumPy&lt;/li&gt;
&lt;li&gt;How to create &lt;strong&gt;NumPy arrays&lt;/strong&gt; using various methods&lt;/li&gt;
&lt;li&gt;How to manipulate NumPy arrays to perform &lt;strong&gt;useful calculations&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to apply these new skills to &lt;strong&gt;real-world problems&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this NumPy tutorial, you should be familiar with writing Python code. Working through the &lt;a href=&quot;https://realpython.com/learning-paths/python3-introduction/&quot;&gt;Introduction to Python&lt;/a&gt; learning path is a great way to make sure you’ve got the basic skills covered. If you’re familiar with &lt;a href=&quot;https://en.wikipedia.org/wiki/Matrix_(mathematics)&quot;&gt;matrix mathematics&lt;/a&gt;, then that will certainly be helpful as well. You don’t need to know anything about data science, however. You’ll learn that here.&lt;/p&gt;
&lt;p&gt;There’s also a repository of NumPy code samples that you’ll see throughout this tutorial. You can use it for reference and experiment with the examples to see how changing the code changes the outcome. To download the code, click the link below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Sample Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/numpy-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-numpy-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to get the sample code you’ll use&lt;/a&gt; to learn about NumPy in this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;choosing-numpy-the-benefits&quot;&gt;Choosing NumPy: The Benefits&lt;a class=&quot;headerlink&quot; href=&quot;#choosing-numpy-the-benefits&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Since you already know Python, you may be asking yourself if you really have to learn a whole new paradigm to do data science. Python’s &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/a&gt; are awesome! &lt;a href=&quot;https://realpython.com/python-csv/&quot;&gt;Reading and writing CSV files&lt;/a&gt; can be done with traditional code. However, there are some convincing arguments for learning a new paradigm.&lt;/p&gt;
&lt;p&gt;Here are the top four benefits that NumPy can bring to your code:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;More speed:&lt;/strong&gt; NumPy uses algorithms written in C that complete in nanoseconds rather than seconds.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fewer loops:&lt;/strong&gt; NumPy helps you to &lt;a href=&quot;https://realpython.com/numpy-array-programming/&quot;&gt;reduce loops&lt;/a&gt; and keep from getting tangled up in iteration indices.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Clearer code:&lt;/strong&gt; Without loops, your code will look more like the equations you’re trying to calculate.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Better quality:&lt;/strong&gt; There are thousands of contributors working to keep NumPy fast, friendly, and bug free.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Because of these benefits, NumPy is the de facto standard for multidimensional arrays in Python data science, and many of the most popular libraries are built on top of it. Learning NumPy is a great way to set down a solid foundation as you expand your knowledge into more specific areas of data science.&lt;/p&gt;
&lt;h2 id=&quot;installing-numpy&quot;&gt;Installing NumPy&lt;a class=&quot;headerlink&quot; href=&quot;#installing-numpy&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;It’s time to get everything set up so you can start learning how to work with NumPy. There are a few different ways to do this, and you can’t go wrong by following the instructions on the &lt;a href=&quot;https://numpy.org/install/&quot;&gt;NumPy website&lt;/a&gt;. But there are some extra details to be aware of that are outlined below. &lt;/p&gt;
&lt;p&gt;You’ll also be installing &lt;a href=&quot;https://realpython.com/python-matplotlib-guide/&quot;&gt;Matplotlib&lt;/a&gt;. You’ll use it in one of the later examples to explore how other libraries make use of NumPy.&lt;/p&gt;
&lt;h3 id=&quot;using-replit-as-an-online-editor&quot;&gt;Using Repl.it as an Online Editor&lt;a class=&quot;headerlink&quot; href=&quot;#using-replit-as-an-online-editor&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you just want to get started with some examples, follow along with this tutorial, and start building some muscle memory with NumPy, then &lt;a href=&quot;https://repl.it/&quot;&gt;Repl.it&lt;/a&gt; is a great option for in-browser editing. You can sign up and fire up a Python environment in minutes. Along the left side, there’s a tab for packages. You can add as many as you want. For this NumPy tutorial, go with the current versions of NumPy and Matplotlib.&lt;/p&gt;
&lt;p&gt;Here’s where you can find the packages in the interface:&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;https://files.realpython.com/media/numpy-tutorial-replit-1000.070229bde757.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-50&quot; src=&quot;https://files.realpython.com/media/numpy-tutorial-replit-1000.070229bde757.png&quot; width=&quot;1449&quot; height=&quot;1000&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/numpy-tutorial-replit-1000.070229bde757.png&amp;amp;w=362&amp;amp;sig=a086162dbbe3336f94bab1bb6b9d747fd1cbcd1f 362w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/numpy-tutorial-replit-1000.070229bde757.png&amp;amp;w=724&amp;amp;sig=a7827a5e9ba2c0bcb2aa216bb1fd388cc75f52a4 724w, https://files.realpython.com/media/numpy-tutorial-replit-1000.070229bde757.png 1449w&quot; sizes=&quot;75vw&quot; alt=&#x27;The location of the &quot;Packages&quot; tab on Repl.it.&#x27; data-asset=&quot;2937&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;Luckily, they allow you to just click and install.&lt;/p&gt;
&lt;h3 id=&quot;installing-numpy-with-anaconda&quot;&gt;Installing NumPy With Anaconda&lt;a class=&quot;headerlink&quot; href=&quot;#installing-numpy-with-anaconda&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.anaconda.com/products/individual&quot;&gt;Anaconda&lt;/a&gt; distribution is a suite of common Python data science tools bundled around a &lt;strong&gt;package manager&lt;/strong&gt; that helps manage your &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environments&lt;/a&gt; and project dependencies. It’s built around &lt;a href=&quot;https://docs.conda.io/en/latest/&quot;&gt;&lt;code&gt;conda&lt;/code&gt;&lt;/a&gt;, which is the actual package manager. This is the method recommended by the NumPy project, especially if you’re stepping into data science in Python without having already &lt;a href=&quot;https://realpython.com/python-windows-machine-learning-setup/&quot;&gt;set up a complex development environment&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you’ve already got a workflow you like that uses &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/pipenv-guide/&quot;&gt;Pipenv&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/effective-python-environment/#poetry&quot;&gt;Poetry&lt;/a&gt;, or some other toolset, then it might be better not to add &lt;code&gt;conda&lt;/code&gt; to the mix. The &lt;code&gt;conda&lt;/code&gt; package repository is separate from &lt;a href=&quot;https://pypi.org/&quot;&gt;PyPI&lt;/a&gt;, and &lt;code&gt;conda&lt;/code&gt; itself sets up a separate little island of packages on your machine, so managing paths and remembering which package lives where can be a &lt;a href=&quot;https://xkcd.com/1987/&quot;&gt;nightmare&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Once you’ve got &lt;code&gt;conda&lt;/code&gt; installed, you can run the &lt;code&gt;install&lt;/code&gt; command for the libraries you’ll need:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; conda install numpy matplotlib
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will install what you need for this NumPy tutorial, and you’ll be all set to go.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/numpy-tutorial/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/numpy-tutorial/ »&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 #42: What Is Data Engineering and Researching 10 Million Jupyter Notebooks</title>
      <id>https://realpython.com/podcasts/rpp/42/</id>
      <link href="https://realpython.com/podcasts/rpp/42/"/>
      <updated>2021-01-08T12:00:00+00:00</updated>
      <summary>Are you familiar with the role data engineers play in the modern landscape of data science and Python? Data engineering is a sub-discipline that focuses on the transportation, transformation, and storage of data.  This week on the show, David Amos is back, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Are you familiar with the role data engineers play in the modern landscape of data science and Python? Data engineering is a sub-discipline that focuses on the transportation, transformation, and storage of data.  This week on the show, David Amos is back, and he&#x27;s brought another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Develop Data Visualization Interfaces in Python With Dash</title>
      <id>https://realpython.com/python-dash/</id>
      <link href="https://realpython.com/python-dash/"/>
      <updated>2021-01-06T14: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;Heroku&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 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 and Julia. 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, or Julia and sprinkle it with 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. Plotly (the company) open-sourced Dash and released it 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.plotly.host/dash-web-trader/&quot;&gt;A dashboard to analyze trading positions in real-time&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://dash-gallery.plotly.host/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.plotly.host/dash-financial-report/&quot;&gt;An interactive financial report&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 the &lt;a href=&quot;https://dash-gallery.plotly.host/Portal/&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 HTML and CSS won’t hurt.&lt;/p&gt;
&lt;p&gt;The rest of this tutorial assumes you know the basics of the following topics:&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;, or &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.heroku.com/about&quot;&gt;Heroku&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. This dataset was compiled by &lt;a href=&quot;https://justinkiggins.com/about&quot;&gt;Justin Kiggins&lt;/a&gt; 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 and a clean Python 3 &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;. To create those, follow the instructions below, choosing the version that matches your operating system.&lt;/p&gt;
&lt;p&gt;If you’re using &lt;strong&gt;Windows&lt;/strong&gt;, then open a command prompt and execute these commands: &lt;/p&gt;
&lt;div class=&quot;highlight doscon&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;c:\&amp;gt;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;mkdir&lt;/span&gt; avocado_analytics &lt;span class=&quot;p&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;cd&lt;/span&gt; avocado_analytics
&lt;span class=&quot;gp&quot;&gt;c:\&amp;gt;&lt;/span&gt; c:\path\to\python\launcher\python -m venv venv
&lt;span class=&quot;gp&quot;&gt;c:\&amp;gt;&lt;/span&gt; venv\Scripts\activate.bat
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/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>Building With Django REST Framework</title>
      <id>https://realpython.com/courses/django-rest-framework/</id>
      <link href="https://realpython.com/courses/django-rest-framework/"/>
      <updated>2021-01-05T14:00:00+00:00</updated>
      <summary>This course will get you ready to build with Django REST Framework. The Django REST framework (DRF) is a toolkit built on top of the Django web framework that reduces the amount of code you need to write to create REST interfaces.</summary>
      <content type="html">
        &lt;p&gt;REST is a loosely defined protocol for listing, creating, changing, and deleting data on your server over HTTP. The Django REST framework (DRF) is a toolkit built on top of the Django web framework that reduces the amount of code you need to write to create REST HTTP API interfaces.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course you&amp;rsquo;ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;REST protocol&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;DRF &lt;strong&gt;&lt;code&gt;Serializers&lt;/code&gt;&lt;/strong&gt; and how to use them with Django objects&lt;/li&gt;
&lt;li&gt;Using Django &lt;code&gt;views&lt;/code&gt; and DRF &lt;code&gt;ViewSet&lt;/code&gt; classes to create REST &lt;strong&gt;end-points&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Multiple flavors of &lt;strong&gt;renderers&lt;/strong&gt; and how to control their output&lt;/li&gt;
&lt;li&gt;Specifying &lt;strong&gt;permissions&lt;/strong&gt; and limiting who can see what data in your REST API&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s .append(): Add Items to Your Lists in Place</title>
      <id>https://realpython.com/python-append/</id>
      <link href="https://realpython.com/python-append/"/>
      <updated>2021-01-04T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how Python&#x27;s .append() works and how to use it for adding items to your list in place. You&#x27;ll also learn how to code your own stacks and queues using .append() and .pop().</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Adding items to a list is a fairly common task in Python, so the language provides a bunch of methods and operators that can help you out with this operation. One of those methods is &lt;strong&gt;&lt;code&gt;.append()&lt;/code&gt;&lt;/strong&gt;. With &lt;code&gt;.append()&lt;/code&gt;, you can add items to the end of an existing list object. You can also use &lt;code&gt;.append()&lt;/code&gt; in a &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/a&gt; to populate lists programmatically.&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;Work with &lt;strong&gt;&lt;code&gt;.append()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Populate lists using &lt;code&gt;.append()&lt;/code&gt; and a &lt;strong&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Replace &lt;code&gt;.append()&lt;/code&gt; with &lt;strong&gt;list comprehensions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Work with &lt;code&gt;.append()&lt;/code&gt; in &lt;strong&gt;&lt;code&gt;array.array()&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;collections.deque()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll also code some examples of how to use &lt;code&gt;.append()&lt;/code&gt; in practice. With this knowledge, you’ll be able to effectively use &lt;code&gt;.append()&lt;/code&gt; in your programs.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-basics-sample-download/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-basics-sample-download&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Get a sample chapter from Python Basics: A Practical Introduction to Python 3&lt;/a&gt; to see how you can go from beginner to intermediate in Python with a complete curriculum, up-to-date for Python 3.8.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;adding-items-to-a-list-with-pythons-append&quot;&gt;Adding Items to a List With Python’s &lt;code&gt;.append()&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#adding-items-to-a-list-with-pythons-append&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python’s &lt;a href=&quot;https://docs.python.org/3/tutorial/datastructures.html#more-on-lists&quot;&gt;&lt;code&gt;.append()&lt;/code&gt;&lt;/a&gt; takes an object as an argument and adds it to the end of an existing &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;list&lt;/a&gt;, right after its last element:&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;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;append&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;numbers&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[1, 2, 3, 4]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Every time you call &lt;code&gt;.append()&lt;/code&gt; on an existing list, the method adds a new item to the end, or right side, of the list. The following diagram illustrates the process:&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;https://files.realpython.com/media/python-append-diagram.57d5bd1285c6.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block w-66&quot; src=&quot;https://files.realpython.com/media/python-append-diagram.57d5bd1285c6.png&quot; width=&quot;812&quot; height=&quot;386&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/python-append-diagram.57d5bd1285c6.png&amp;amp;w=203&amp;amp;sig=a24924061a3344399c3f448e0c1b1e6665deb2eb 203w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/python-append-diagram.57d5bd1285c6.png&amp;amp;w=406&amp;amp;sig=f4f86fbe52905ab1bb7dfe84750530062481e760 406w, https://files.realpython.com/media/python-append-diagram.57d5bd1285c6.png 812w&quot; sizes=&quot;75vw&quot; alt=&quot;Python&#x27;s .append()&quot; data-asset=&quot;3264&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;Python lists reserve extra space for new items at the end of the list. A call to &lt;code&gt;.append()&lt;/code&gt; will place new items in the available space.&lt;/p&gt;
&lt;p&gt;In practice, you can use &lt;code&gt;.append()&lt;/code&gt; to add any kind of object to a given list:&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;mixed&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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mixed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mixed&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[1, 2, 3]&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mixed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;four&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mixed&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[1, 2, 3, &#x27;four&#x27;]&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mixed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;5.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;mixed&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[1, 2, 3, &#x27;four&#x27;, 5.0]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Lists are sequences that can hold different data types and Python objects, so you can use &lt;code&gt;.append()&lt;/code&gt; to add any object to a given list. In this example, you first add an &lt;a href=&quot;https://realpython.com/python-numbers/#integers&quot;&gt;integer number&lt;/a&gt;, then a &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt;, and finally a &lt;a href=&quot;https://realpython.com/python-numbers/#floating-point-numbers&quot;&gt;floating-point number&lt;/a&gt;. However, you can also add another list, a &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt;, a &lt;a href=&quot;https://realpython.com/python-lists-tuples/#python-tuples&quot;&gt;tuple&lt;/a&gt;, a user-defined object, and so on.&lt;/p&gt;
&lt;p&gt;Using &lt;code&gt;.append()&lt;/code&gt; is equivalent to the following operation:&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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# Equivalent to numbers.append(4)&lt;/span&gt;
&lt;span class=&quot;hll&quot;&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;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;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&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;[1, 2, 3, 4]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the highlighted line, you perform two operations at the same time:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You take a slice from &lt;code&gt;numbers&lt;/code&gt; using the expression &lt;code&gt;numbers[len(numbers):]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You assign an iterable to that slice.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The slicing operation takes the space after the last item in &lt;code&gt;numbers&lt;/code&gt;. Meanwhile, the assignment operation &lt;a href=&quot;https://realpython.com/python-lists-tuples/#tuple-assignment-packing-and-unpacking&quot;&gt;unpacks&lt;/a&gt; the items in the list to the right of the assignment operator and adds them to &lt;code&gt;numbers&lt;/code&gt;. However, there’s an important difference between using this kind of assignment and using &lt;code&gt;.append()&lt;/code&gt;. With the assignment, you can add several items to the end of your list at once:&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;hll&quot;&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;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;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&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;[1, 2, 3, 4, 5, 6]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this example, the highlighted line takes a slice from the end of &lt;code&gt;numbers&lt;/code&gt;, unpacks the items in the list on the right side, and adds them to the slice as individual items.&lt;/p&gt;
&lt;h3 id=&quot;append-adds-a-single-item&quot;&gt;&lt;code&gt;.append()&lt;/code&gt; Adds a Single Item&lt;a class=&quot;headerlink&quot; href=&quot;#append-adds-a-single-item&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;With &lt;code&gt;.append()&lt;/code&gt;, you can add a number, list, tuple, dictionary, user-defined object, or any other object to an existing list. However, you need to keep in mind that &lt;code&gt;.append()&lt;/code&gt; adds only a single item or object at a time:&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;x&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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[1, 2, 3, 4, (5, 6)]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What happens here is that &lt;code&gt;.append()&lt;/code&gt; adds the tuple object &lt;code&gt;y&lt;/code&gt; to the end of your target list, &lt;code&gt;x&lt;/code&gt;. What if you want to add each item in &lt;code&gt;y&lt;/code&gt; to the end of &lt;code&gt;x&lt;/code&gt; as an individual item and get &lt;code&gt;[1, 2, 3, 4, 5, 6]&lt;/code&gt;? In that case, you can use &lt;code&gt;.extend()&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-append/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-append/ »&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>Django Admin Customization</title>
      <id>https://realpython.com/courses/django-admin-customization/</id>
      <link href="https://realpython.com/courses/django-admin-customization/"/>
      <updated>2020-12-29T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to customize Django&#x27;s admin with Python. You&#x27;ll use AdminModel objects to add display columns, calculate values, link to referring objects, and search and filter results. You&#x27;ll also use template overriding to gain full control over the admin&#x27;s HTML.</summary>
      <content type="html">
        &lt;p&gt;The &lt;a href=&quot;https://www.djangoproject.com/&quot;&gt;&lt;strong&gt;Django&lt;/strong&gt;&lt;/a&gt; framework comes with a powerful &lt;a href=&quot;https://docs.djangoproject.com/en/3.0/ref/contrib/admin/&quot;&gt;administrative tool&lt;/a&gt; called &lt;strong&gt;admin&lt;/strong&gt;. You can use it out of the box to quickly add, delete, or edit any database model from a web interface. But with a little extra code, you can customize the Django admin to take your admin capabilities to the next level.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add &lt;strong&gt;attribute columns&lt;/strong&gt; in the model object list &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link&lt;/strong&gt; between model objects&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;filters&lt;/strong&gt; to the model object list&lt;/li&gt;
&lt;li&gt;Make model object lists &lt;strong&gt;searchable&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Modify the object &lt;strong&gt;edit forms&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Override Django &lt;strong&gt;admin templates&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python and MySQL Database: A Practical Introduction</title>
      <id>https://realpython.com/python-mysql/</id>
      <link href="https://realpython.com/python-mysql/"/>
      <updated>2020-12-28T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to connect your Python application with a MySQL database. You&#x27;ll design a movie rating system and perform some common queries on it. You&#x27;ll also see best practices and tips to prevent SQL injection attacks.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;a href=&quot;https://www.mysql.com/&quot;&gt;MySQL&lt;/a&gt; is one of the most popular &lt;a href=&quot;https://en.wikipedia.org/wiki/Database#Database_management_system&quot;&gt;database management systems (DBMSs)&lt;/a&gt; on the market today. It ranked second only to the &lt;a href=&quot;https://docs.oracle.com/cd/E11882_01/server.112/e40540/intro.htm&quot;&gt;Oracle DBMS&lt;/a&gt; in this year’s &lt;a href=&quot;https://db-engines.com/en/ranking&quot;&gt;DB-Engines Ranking&lt;/a&gt;. As most software applications need to interact with data in some form, programming languages like Python provide tools for storing and accessing these data sources.&lt;/p&gt;
&lt;p&gt;Using the techniques discussed in this tutorial, you’ll be able to efficiently integrate a MySQL database with a Python application. You’ll develop a small MySQL database for a movie rating system and learn how to query it directly from your Python code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll be able to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Identify unique features of &lt;strong&gt;MySQL&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Connect your application&lt;/strong&gt; to a MySQL database&lt;/li&gt;
&lt;li&gt;Query the database to &lt;strong&gt;fetch required data&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Handle exceptions&lt;/strong&gt; that occur while accessing the database&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;best practices&lt;/strong&gt; while building database applications&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should have a working knowledge of Python concepts like &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loops&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-exceptions/&quot;&gt;exception handling&lt;/a&gt;, and installing Python packages using &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;. You should also have a basic understanding of relational database management systems and SQL queries like &lt;code&gt;SELECT&lt;/code&gt;, &lt;code&gt;DROP&lt;/code&gt;, &lt;code&gt;CREATE&lt;/code&gt;, and &lt;code&gt;JOIN&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Download:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-tricks-sample-pdf/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-tricks-sample-pdf&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Get a sample chapter from Python Tricks: The Book&lt;/a&gt; that shows you Python’s best practices with simple examples you can apply instantly to write more beautiful + Pythonic code.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;comparing-mysql-to-other-sql-databases&quot;&gt;Comparing MySQL to Other SQL Databases&lt;a class=&quot;headerlink&quot; href=&quot;#comparing-mysql-to-other-sql-databases&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;SQL&lt;/strong&gt; stands for &lt;a href=&quot;https://en.wikipedia.org/wiki/SQL&quot;&gt;Structured Query Language&lt;/a&gt; and is a widely used programming language for managing relational databases. You may have heard of the different flavors of SQL-based DBMSs. The most popular ones include &lt;a href=&quot;https://www.mysql.com/&quot;&gt;MySQL&lt;/a&gt;, &lt;a href=&quot;https://www.postgresql.org/&quot;&gt;PostgreSQL&lt;/a&gt;, &lt;a href=&quot;https://www.sqlite.org/index.html&quot;&gt;SQLite&lt;/a&gt;, and &lt;a href=&quot;https://www.microsoft.com/en-us/sql-server/sql-server-2019&quot;&gt;SQL Server&lt;/a&gt;. All of these databases are compliant with the &lt;a href=&quot;https://docs.oracle.com/cd/B28359_01/server.111/b28286/intro002.htm&quot;&gt;SQL standards&lt;/a&gt; but with varying degrees of compliance.&lt;/p&gt;
&lt;p&gt;Being &lt;strong&gt;open source&lt;/strong&gt; since its inception in 1995, MySQL quickly became a market leader among SQL solutions. MySQL is also a part of the Oracle ecosystem. While its core functionality is completely free, there are some paid add-ons as well. Currently, MySQL is used by all major tech firms, including Google, LinkedIn, Uber, Netflix, Twitter, and others.&lt;/p&gt;
&lt;p&gt;Apart from a large open source community for support, there are many other reasons for MySQL’s success:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Ease of installation:&lt;/strong&gt; MySQL was designed to be user-friendly. It’s quite straightforward to set up a MySQL database, and several widely available third-party tools, like &lt;a href=&quot;https://www.phpmyadmin.net/&quot;&gt;phpMyAdmin&lt;/a&gt;, further streamline the setup process. MySQL is available for all major operating systems, including Windows, macOS, Linux, and Solaris.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Speed:&lt;/strong&gt; MySQL holds a reputation for being an exceedingly fast database solution. It has a relatively smaller footprint and is extremely scalable in the long run.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;User privileges and security:&lt;/strong&gt; MySQL comes with a script that allows you to set the password security level, assign admin passwords, and add and remove user account privileges. This script uncomplicates the admin process for a web hosting user management portal. Other DBMSs, like PostgreSQL, use &lt;a href=&quot;https://www.postgresql.org/docs/9.3/config-setting.html&quot;&gt;config files&lt;/a&gt; that are more complicated to use.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;While MySQL is famous for its speed and ease of use, you can get more &lt;a href=&quot;https://www.postgresqltutorial.com/postgresql-vs-mysql/&quot;&gt;advanced features&lt;/a&gt; with PostgreSQL. Also, MySQL isn’t fully SQL compliant and has certain functional limitations, like no support for &lt;code&gt;FULL JOIN&lt;/code&gt; clauses.&lt;/p&gt;
&lt;p&gt;You might also face some &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/concurrent-inserts.html&quot;&gt;issues with concurrent reading and writing&lt;/a&gt; in MySQL. If your software has many users writing data to it at once, then PostgreSQL might be a more suitable choice.&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; For a more in-depth comparison of MySQL and PostgreSQL in a real-world context, check out &lt;a href=&quot;https://eng.uber.com/postgres-to-mysql-migration/&quot;&gt;Why Uber Engineering Switched from Postgres to MySQL&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;SQL Server is also a very popular DBMS and is known for its reliability, efficiency, and security. It’s preferred by companies, especially in the banking domain, who regularly deal with large traffic workloads. It’s a commercial solution and is one of the systems that are most compatible with Windows services.&lt;/p&gt;
&lt;p&gt;In 2010, when &lt;a href=&quot;https://en.wikipedia.org/wiki/Oracle_Corporation&quot;&gt;Oracle&lt;/a&gt; acquired &lt;a href=&quot;https://en.wikipedia.org/wiki/Sun_Microsystems&quot;&gt;Sun Microsystems&lt;/a&gt; and MySQL, many were worried about MySQL’s future. At the time, Oracle was MySQL’s biggest competitor. Developers feared that this was a hostile takeover from Oracle with the aim of destroying MySQL.&lt;/p&gt;
&lt;p&gt;Several developers led by &lt;a href=&quot;https://en.wikipedia.org/wiki/Michael_Widenius&quot;&gt;Michael Widenius&lt;/a&gt;, the original author of MySQL, created a &lt;a href=&quot;https://en.wikipedia.org/wiki/Fork_(software_development)&quot;&gt;fork&lt;/a&gt; of the MySQL code base and laid the foundation of &lt;a href=&quot;https://mariadb.org/&quot;&gt;MariaDB&lt;/a&gt;. The aim was to secure access to MySQL and keep it free forever.&lt;/p&gt;
&lt;p&gt;To date, MariaDB remains fully &lt;a href=&quot;https://en.wikipedia.org/wiki/GNU_General_Public_License&quot;&gt;GPL licensed&lt;/a&gt;, keeping it completely in the public domain. Some features of MySQL, on the other hand, are available only with paid licenses. Also, MariaDB provides several extremely useful features that aren’t supported by MySQL server, like &lt;a href=&quot;https://mariadb.com/resources/blog/mariadb-adds-xpand-for-distributed-sql/&quot;&gt;distributed SQL&lt;/a&gt; and &lt;a href=&quot;http://www.inf.ufpr.br/eduardo/ensino/ci809/papers/p967-abadi.pdf&quot;&gt;columnar storage&lt;/a&gt;. You can find more differences between MySQL and MariaDB listed on &lt;a href=&quot;https://mariadb.com/products/mariadb-platform/comparison/&quot;&gt;MariaDB’s website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;MySQL uses a very similar syntax to the Standard SQL. There are, however, some notable differences mentioned in the &lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/differences-from-ansi.html&quot;&gt;official documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;installing-mysql-server-and-mysql-connectorpython&quot;&gt;Installing MySQL Server and MySQL Connector/Python&lt;a class=&quot;headerlink&quot; href=&quot;#installing-mysql-server-and-mysql-connectorpython&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Now, to start working through this tutorial, you need to set up two things: a &lt;strong&gt;MySQL server&lt;/strong&gt; and a &lt;strong&gt;MySQL connector&lt;/strong&gt;. MySQL server will provide all the services required for handling your database. Once the server is up and running, you can connect your Python application with it using MySQL Connector/Python.&lt;/p&gt;
&lt;h3 id=&quot;installing-mysql-server&quot;&gt;Installing MySQL Server&lt;a class=&quot;headerlink&quot; href=&quot;#installing-mysql-server&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://dev.mysql.com/doc/refman/5.7/en/installing.html&quot;&gt;official documentation&lt;/a&gt; details the recommended way to download and install MySQL server. You’ll find instructions for all popular operating systems, including &lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/windows-installation.html&quot;&gt;Windows&lt;/a&gt;, &lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/osx-installation.html&quot;&gt;macOS&lt;/a&gt;, &lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/solaris-installation.html&quot;&gt;Solaris&lt;/a&gt;, &lt;a href=&quot;https://dev.mysql.com/doc/refman/8.0/en/linux-installation.html&quot;&gt;Linux&lt;/a&gt;, and many more.&lt;/p&gt;
&lt;p&gt;For Windows, the best way is to download &lt;a href=&quot;https://dev.mysql.com/downloads/installer/&quot;&gt;MySQL Installer&lt;/a&gt; and let it take care of the entire process. The installation manager also helps you configure the security settings of the MySQL server. On the Accounts and Roles page, you need to enter a password for the &lt;strong&gt;root&lt;/strong&gt; (admin) account and also optionally add other users with varying privileges:&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;https://files.realpython.com/media/root_user_pass.cf4a9c6ea5f5.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/root_user_pass.cf4a9c6ea5f5.png&quot; width=&quot;1325&quot; height=&quot;1000&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/root_user_pass.cf4a9c6ea5f5.png&amp;amp;w=331&amp;amp;sig=10210869c02392210a316382535f79a6d78b7ca0 331w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/root_user_pass.cf4a9c6ea5f5.png&amp;amp;w=662&amp;amp;sig=713d73262434be81043b6568078b727e3bcf74e8 662w, https://files.realpython.com/media/root_user_pass.cf4a9c6ea5f5.png 1325w&quot; sizes=&quot;75vw&quot; alt=&quot;Snapshot of the mysql installation manager asking for login credentials&quot; data-asset=&quot;3105&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;MySQL Installer Account Setup&lt;/figcaption&gt;&lt;/figure&gt;

&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-mysql/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-mysql/ »&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 #41: 2020 Real Python Articles in Review</title>
      <id>https://realpython.com/podcasts/rpp/41/</id>
      <link href="https://realpython.com/podcasts/rpp/41/"/>
      <updated>2020-12-25T12:00:00+00:00</updated>
      <summary>It&#x27;s been quite the year! The Real Python team has written, edited, curated, illustrated, and produced a mountain of Python articles this year. We also upgraded the site and membership with office hours, transcripts, this podcast, and much more. 

We are joined by two members of the Real Python team, David Amos and Joanna Jablonski. We wanted to share a year-end wrap-up with a collection of articles that showcase a diversity of Python topics and the quality of what our team created this year.</summary>
      <content type="html">
        &lt;p&gt;It&#x27;s been quite the year! The Real Python team has written, edited, curated, illustrated, and produced a mountain of Python articles this year. We also upgraded the site and membership with office hours, transcripts, this podcast, and much more. 

We are joined by two members of the Real Python team, David Amos and Joanna Jablonski. We wanted to share a year-end wrap-up with a collection of articles that showcase a diversity of Python topics and the quality of what our team created this year.&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>Serializing Objects With the Python pickle Module</title>
      <id>https://realpython.com/courses/pickle-serializing-objects/</id>
      <link href="https://realpython.com/courses/pickle-serializing-objects/"/>
      <updated>2020-12-22T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how you can use the Python pickle module to convert your objects into a stream of bytes that can be saved to a disk or sent over a network. You&#x27;ll also learn the security implications of using this process on objects from an untrusted source.</summary>
      <content type="html">
        &lt;p&gt;As a developer, you may sometimes need to send complex object hierarchies over a network or save the internal state of your objects to a disk or database for later use. To accomplish this, you can use a process called &lt;strong&gt;serialization&lt;/strong&gt;, which is fully supported by the standard library thanks to the Python &lt;strong&gt;&lt;code&gt;pickle&lt;/code&gt;&lt;/strong&gt; module.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What it means to &lt;strong&gt;serialize&lt;/strong&gt; and &lt;strong&gt;deserialize&lt;/strong&gt; an object&lt;/li&gt;
&lt;li&gt;Which &lt;strong&gt;modules&lt;/strong&gt; you can use to serialize objects in Python&lt;/li&gt;
&lt;li&gt;Which kinds of objects can be serialized with the Python &lt;strong&gt;&lt;code&gt;pickle&lt;/code&gt;&lt;/strong&gt; module&lt;/li&gt;
&lt;li&gt;How to use the Python &lt;code&gt;pickle&lt;/code&gt; module to serialize &lt;strong&gt;object hierarchies&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;risks&lt;/strong&gt; are when deserializing an object from an untrusted source&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Use PyQt&#x27;s QThread to Prevent Freezing GUIs</title>
      <id>https://realpython.com/python-pyqt-qthread/</id>
      <link href="https://realpython.com/python-pyqt-qthread/"/>
      <updated>2020-12-21T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you’ll learn how to prevent freezing GUIs by offloading long-running tasks to worker QThreads in PyQt.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;PyQt graphical user interface (GUI) applications have a &lt;strong&gt;main thread&lt;/strong&gt; of execution that runs the &lt;a href=&quot;https://www.riverbankcomputing.com/static/Docs/PyQt5/api/qtcore/qcoreapplication.html#the-event-loop-and-event-handling&quot;&gt;event loop&lt;/a&gt; and GUI. If you launch a &lt;strong&gt;long-running task&lt;/strong&gt; in this &lt;a href=&quot;https://en.wikipedia.org/wiki/Thread_(computing)&quot;&gt;thread&lt;/a&gt;, then your GUI will freeze until the task terminates. During that time, the user won’t be able to interact with the application, resulting in a bad user experience. Luckily, PyQt’s &lt;strong&gt;&lt;code&gt;QThread&lt;/code&gt;&lt;/strong&gt; class allows you to work around this issue.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use PyQt’s &lt;strong&gt;&lt;code&gt;QThread&lt;/code&gt;&lt;/strong&gt; to prevent freezing GUIs&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;reusable threads&lt;/strong&gt; with &lt;code&gt;QThreadPool&lt;/code&gt; and &lt;code&gt;QRunnable&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Manage &lt;strong&gt;interthread communication&lt;/strong&gt; using signals and slots&lt;/li&gt;
&lt;li&gt;Safely use &lt;strong&gt;shared resources&lt;/strong&gt; with PyQt’s locks&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;best practices&lt;/strong&gt; for developing GUI applications with PyQt’s thread support&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For a better understanding of how to use PyQt’s threads, some previous knowledge of &lt;a href=&quot;https://realpython.com/python-pyqt-gui-calculator/&quot;&gt;GUI programming with PyQt&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/intro-to-python-threading/&quot;&gt;Python multithreaded programming&lt;/a&gt; would be helpful.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-basics-sample-free-chapter/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-basics-sample-free-chapter&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Get a sample chapter from Python Basics: A Practical Introduction to Python 3&lt;/a&gt; to see how you can go from beginner to intermediate in Python with a complete curriculum, up-to-date for Python 3.8.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;freezing-a-gui-with-long-running-tasks&quot;&gt;Freezing a GUI With Long-Running Tasks&lt;a class=&quot;headerlink&quot; href=&quot;#freezing-a-gui-with-long-running-tasks&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Long-running tasks occupying the main thread of a GUI application and causing the application to freeze is a common issue in GUI programming that almost always results in a bad user experience. For example, consider the following GUI application:&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;https://files.realpython.com/media/pyqt-freezing-gui.1a899db536e8.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/pyqt-freezing-gui.1a899db536e8.png&quot; width=&quot;302&quot; height=&quot;175&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/pyqt-freezing-gui.1a899db536e8.png&amp;amp;w=75&amp;amp;sig=068e3bc2b135a6ea1137745633693b0badcd042f 75w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/pyqt-freezing-gui.1a899db536e8.png&amp;amp;w=151&amp;amp;sig=ee793c37ccd144b49e047c1e828dad1983782bc4 151w, https://files.realpython.com/media/pyqt-freezing-gui.1a899db536e8.png 302w&quot; sizes=&quot;75vw&quot; alt=&quot;PyQt Freezing GUI Example&quot; data-asset=&quot;3250&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;Say you need the &lt;em&gt;Counting&lt;/em&gt; label to reflect the total number of clicks on the &lt;em&gt;Click me!&lt;/em&gt; button. Clicking the &lt;em&gt;Long-Running Task!&lt;/em&gt; button will launch a task that takes a lot of time to finish. Your long-running task could be a file download, a query to a large database, or any other resource-intensive operation.&lt;/p&gt;
&lt;p&gt;Here’s a first approach to coding this application using PyQt and a single thread of execution:&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;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;sys&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;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;PyQt5.QtCore&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Qt&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;PyQt5.QtWidgets&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;QApplication&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;QLabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;QMainWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;QPushButton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;QVBoxLayout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;QWidget&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;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;QMainWindow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fm&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;parent&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;nb&quot;&gt;super&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;fm&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;parent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clicksCount&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;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setupUi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setupUi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setWindowTitle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Freezing GUI&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;resize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;150&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;centralWidget&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;QWidget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setCentralWidget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;centralWidget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;# Create and connect widgets&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clicksLabel&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;QLabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Counting: 0 clicks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clicksLabel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setAlignment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Qt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AlignHCenter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Qt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AlignVCenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stepLabel&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;QLabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Long-Running Step: 0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stepLabel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setAlignment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Qt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AlignHCenter&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Qt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AlignVCenter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;countBtn&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;QPushButton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Click me!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;countBtn&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clicked&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;countClicks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;longRunningBtn&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;QPushButton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Long-Running Task!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;longRunningBtn&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clicked&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;runLongTask&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;# Set the layout&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;QVBoxLayout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;addWidget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clicksLabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;addWidget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;countBtn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;addStretch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;addWidget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stepLabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;addWidget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;longRunningBtn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;centralWidget&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setLayout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;countClicks&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clicksCount&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;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clicksLabel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setText&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;Counting: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;clicksCount&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; clicks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;reportProgress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stepLabel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setText&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;Long-Running Step: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&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;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;runLongTask&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;sd&quot;&gt;&quot;&quot;&quot;Long-running task in 5 steps.&quot;&quot;&quot;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&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;5&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;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reportProgress&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;app&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;QApplication&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;argv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;win&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;win&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;exec&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this Freezing GUI application, &lt;code&gt;.setupUi()&lt;/code&gt; creates all the required graphical components for the GUI. A click on the &lt;em&gt;Click me!&lt;/em&gt; button calls &lt;code&gt;.countClicks()&lt;/code&gt;, which makes the text of the &lt;em&gt;Counting&lt;/em&gt; label reflect the number of button clicks.&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; PyQt was first developed to target Python 2, which has an &lt;code&gt;exec&lt;/code&gt; keyword. To avoid a name conflict on those earlier versions of PyQt, an underscore was added to the end of &lt;code&gt;.exec_()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Even though PyQt5 targets only Python 3, which doesn’t have an &lt;code&gt;exec&lt;/code&gt; keyword, the library provides two methods to start an application’s event loop:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;.exec_()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.exec()&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Both variations of the method work the same, so you can use either one in your applications.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Clicking the &lt;em&gt;Long-Running Task!&lt;/em&gt; button calls &lt;code&gt;.runLongTask()&lt;/code&gt;, which performs a task that takes &lt;code&gt;5&lt;/code&gt; seconds to complete. This is a hypothetical task that you coded using &lt;a href=&quot;https://realpython.com/python-sleep/&quot;&gt;&lt;code&gt;time.sleep(secs)&lt;/code&gt;&lt;/a&gt;, which suspends the execution of the calling thread for the given number of seconds, &lt;code&gt;secs&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In &lt;code&gt;.runLongTask()&lt;/code&gt;, you also call &lt;code&gt;.reportProgress()&lt;/code&gt; to make the &lt;em&gt;Long-Running Step&lt;/em&gt; label reflect the progress of the operation.&lt;/p&gt;
&lt;p&gt;Does this application work as you intend? &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;Run the application&lt;/a&gt; and check out its behavior:&lt;/p&gt;
&lt;figure&gt;&lt;a href=&quot;https://files.realpython.com/media/pyqt-freezing-gui-animation.03895ab5576e.gif&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/pyqt-freezing-gui-animation.03895ab5576e.gif&quot; width=&quot;325&quot; height=&quot;202&quot; srcset=&quot;https://files.realpython.com/media/pyqt-freezing-gui-animation.03895ab5576e.gif 81w, https://files.realpython.com/media/pyqt-freezing-gui-animation.03895ab5576e.gif 162w, https://files.realpython.com/media/pyqt-freezing-gui-animation.03895ab5576e.gif 325w&quot; sizes=&quot;75vw&quot; alt=&quot;PyQt Freezing GUI Example&quot; data-asset=&quot;3251&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;When you click the &lt;em&gt;Click me!&lt;/em&gt; button, the label shows the number of clicks. However, if you click the &lt;em&gt;Long-Running Task!&lt;/em&gt; button, then the application becomes frozen and unresponsive. The buttons no longer respond to clicks and the labels don’t reflect the application’s state.&lt;/p&gt;
&lt;p&gt;After five seconds, the application’s GUI gets updated again. The &lt;em&gt;Counting&lt;/em&gt; label shows ten clicks, reflecting five clicks that occurred while the GUI was frozen. The &lt;em&gt;Long-Running Step&lt;/em&gt; label doesn’t reflect the progress of your long-running operation. It jumps from zero to five without showing the intermediate steps.&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; Even though your application’s GUI freezes during the long-running task, the application still registers events such as clicks and keystrokes. It’s just unable to process them until the main thread gets released.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The application’s GUI freezes as a result of a blocked main thread. The main thread is busy processing a long-running task and doesn’t immediately respond to the user’s actions. This is an annoying behavior because the user doesn’t know for sure if the application is working correctly or if it’s crashed.&lt;/p&gt;
&lt;p&gt;Fortunately, there are some techniques you can use to work around this issue. A commonly used solution is to run your long-running task outside of the application’s main thread using a &lt;strong&gt;worker thread&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In the sections below, you’ll learn how to use PyQt’s built-in thread support to solve the issue of unresponsive or frozen GUIs and provide the best possible user experience in your applications.&lt;/p&gt;
&lt;h2 id=&quot;multithreading-the-basics&quot;&gt;Multithreading: The Basics&lt;a class=&quot;headerlink&quot; href=&quot;#multithreading-the-basics&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Sometimes you can divide your programs into several smaller &lt;strong&gt;subprograms&lt;/strong&gt;, or &lt;strong&gt;tasks&lt;/strong&gt;, that you can run in several threads. This might make your programs faster, or it might help you improve the user experience by preventing your programs from freezing while executing long-running tasks.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-pyqt-qthread/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-pyqt-qthread/ »&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 #40: How Python Manages Memory and Creating Arrays With np.linspace</title>
      <id>https://realpython.com/podcasts/rpp/40/</id>
      <link href="https://realpython.com/podcasts/rpp/40/"/>
      <updated>2020-12-18T12:00:00+00:00</updated>
      <summary>Have you wondered how Python manages memory? How are your variables stored in memory, and when do they get deleted? This week on the show, David Amos is here, and he has brought another batch of PyCoder&#x27;s Weekly articles and projects.

Along with the Real Python article on Python memory management, we also talk about another article about creating even and non-even spaced arrays in Python with np.linspace.</summary>
      <content type="html">
        &lt;p&gt;Have you wondered how Python manages memory? How are your variables stored in memory, and when do they get deleted? This week on the show, David Amos is here, and he has brought another batch of PyCoder&#x27;s Weekly articles and projects.

Along with the Real Python article on Python memory management, we also talk about another article about creating even and non-even spaced arrays in Python with np.linspace.&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 Turtle for Beginners</title>
      <id>https://realpython.com/courses/python-turtle-beginners/</id>
      <link href="https://realpython.com/courses/python-turtle-beginners/"/>
      <updated>2020-12-15T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn the basics of Python programming with the help of a simple and interactive Python library called turtle. If you&#x27;re a beginner to Python, then this course will definitely help you on your journey as you take your first steps into the world of programming.</summary>
      <content type="html">
        &lt;p&gt;In this step-by-step course, you&amp;rsquo;ll learn the basics of Python programming with the help of a simple and interactive Python library called turtle. If you&amp;rsquo;re a beginner to Python, then this course will definitely help you on your journey as you take your first steps into the world of programming. The Python &lt;code&gt;turtle&lt;/code&gt; library comes with a similar interactive feature that gives new programmers a taste of what it&amp;rsquo;s like to work with Python.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you will:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Understand&lt;/strong&gt; what the Python &lt;code&gt;turtle&lt;/code&gt; library is&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Learn&lt;/strong&gt; how to set &lt;code&gt;turtle&lt;/code&gt; up on your computer&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Program&lt;/strong&gt; with the Python &lt;code&gt;turtle&lt;/code&gt; library&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Grasp&lt;/strong&gt; some important Python concepts and &lt;code&gt;turtle&lt;/code&gt; commands&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Develop&lt;/strong&gt; a short but entertaining game using what you&amp;rsquo;ve learned&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #39: Generators, Coroutines, and Learning Python Through Exercises</title>
      <id>https://realpython.com/podcasts/rpp/39/</id>
      <link href="https://realpython.com/podcasts/rpp/39/"/>
      <updated>2020-12-11T12:00:00+00:00</updated>
      <summary>Have you started to use generators in Python? Are you unsure why you would even use one over a regular function? How do you use the special &quot;send&quot; method and the &quot;yield from&quot; syntax? This week on the show, we have Reuven Lerner to talk about his PyCon Africa 2020 talk titled &quot;Generators, coroutines, and nanoservices.&quot;</summary>
      <content type="html">
        &lt;p&gt;Have you started to use generators in Python? Are you unsure why you would even use one over a regular function? How do you use the special &quot;send&quot; method and the &quot;yield from&quot; syntax? This week on the show, we have Reuven Lerner to talk about his PyCon Africa 2020 talk titled &quot;Generators, coroutines, and nanoservices.&quot;&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Speed Up Python With Concurrency</title>
      <id>https://realpython.com/courses/speed-python-concurrency/</id>
      <link href="https://realpython.com/courses/speed-python-concurrency/"/>
      <updated>2020-12-08T14:00:00+00:00</updated>
      <summary>Learn what concurrency means in Python and why you might want to use it. You&#x27;ll see a simple, non-concurrent approach and then look into why you&#x27;d want threading, asyncio, or multiprocessing.</summary>
      <content type="html">
        &lt;p&gt;Concurrency is the act of having your computer do multiple things at the same time. If you&amp;rsquo;ve heard lots of talk about &lt;code&gt;asyncio&lt;/code&gt; &lt;a href=&quot;https://realpython.com/python37-new-features/&quot;&gt;being added to Python&lt;/a&gt; but are curious how it compares to other concurrency methods or are wondering what concurrency is and how it might speed up your program, you&amp;rsquo;ve come to the right place.&lt;/p&gt;
&lt;p&gt;In this course, you&amp;rsquo;ll learn the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How I/O bound programs are effected by latency&lt;/li&gt;
&lt;li&gt;Which concurrent programming patterns to use&lt;/li&gt;
&lt;li&gt;What the differences are between the Python concurrency libraries&lt;/li&gt;
&lt;li&gt;How to write code that uses the &lt;code&gt;threading&lt;/code&gt;, &lt;code&gt;asyncio&lt;/code&gt;, and &lt;code&gt;multiprocessing&lt;/code&gt; libraries&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sample code was tested using Python 3.8.5. Much of the &lt;code&gt;asyncio&lt;/code&gt; library has been in flux since Python 3.4, it is recommended to use at least Python 3.7 for the &lt;code&gt;asyncio&lt;/code&gt; portions of the 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 #38: Looping With enumerate() and Python GUIs With PyQt</title>
      <id>https://realpython.com/podcasts/rpp/38/</id>
      <link href="https://realpython.com/podcasts/rpp/38/"/>
      <updated>2020-12-04T12:00:00+00:00</updated>
      <summary>If you&#x27;re coming to Python from a different language, you may not know about a useful tool for working with loops, Python&#x27;s built-in enumerate function. This week on the show, David Amos is here, and he has brought another batch of PyCoder&#x27;s Weekly articles and projects.

Along with the Real Python article covering the details of the enumerate function, we also talk about another article about constructing Python graphical user interface elements in PyQt.</summary>
      <content type="html">
        &lt;p&gt;If you&#x27;re coming to Python from a different language, you may not know about a useful tool for working with loops, Python&#x27;s built-in enumerate function. This week on the show, David Amos is here, and he has brought another batch of PyCoder&#x27;s Weekly articles and projects.

Along with the Real Python article covering the details of the enumerate function, we also talk about another article about constructing Python graphical user interface elements in PyQt.&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 Python Manages Memory</title>
      <id>https://realpython.com/courses/how-python-manages-memory/</id>
      <link href="https://realpython.com/courses/how-python-manages-memory/"/>
      <updated>2020-12-01T14:00:00+00:00</updated>
      <summary>Get ready for a deep dive into the internals of Python to understand how it handles memory management. By the end of this course, you’ll know more about low-level computing, understand how Python abstracts lower-level operations, and find out about Python’s internal memory management algorithms.</summary>
      <content type="html">
        &lt;p&gt;Ever wonder how Python handles your data behind the scenes? How are your &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt; stored in memory? When do they get deleted?&lt;/p&gt;
&lt;p&gt;In this course, we&amp;rsquo;re going to do a deep dive into the internals of Python to understand how it handles memory management.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learn more about low-level computing, specifically as relates to memory&lt;/li&gt;
&lt;li&gt;Understand how Python abstracts lower-level operations&lt;/li&gt;
&lt;li&gt;Learn about Python&amp;rsquo;s internal memory management algorithms&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #37: Teaching Python and Finding Resources for Students</title>
      <id>https://realpython.com/podcasts/rpp/37/</id>
      <link href="https://realpython.com/podcasts/rpp/37/"/>
      <updated>2020-11-27T12:00:00+00:00</updated>
      <summary>One of the best ways to learn something well is to teach it. This week on the show, we have Kelly Schuster-Paredes and Sean Tibor from the Teaching Python podcast.

Sean and Kelly teach middle school students Python and share their art and science of teaching Python on their podcast. They wanted to come on the show to talk about the Real Python articles, quizzes, and other resources they use when teaching their students.</summary>
      <content type="html">
        &lt;p&gt;One of the best ways to learn something well is to teach it. This week on the show, we have Kelly Schuster-Paredes and Sean Tibor from the Teaching Python podcast.

Sean and Kelly teach middle school students Python and share their art and science of teaching Python on their podcast. They wanted to come on the show to talk about the Real Python articles, quizzes, and other resources they use when teaching their students.&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>Formatting Python Strings</title>
      <id>https://realpython.com/courses/formatting-python-strings/</id>
      <link href="https://realpython.com/courses/formatting-python-strings/"/>
      <updated>2020-11-24T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll see two items to add to your Python string formatting toolkit. You&#x27;ll learn about Python&#x27;s string format method and the formatted string literal, or f-string. You&#x27;ll learn about these formatting techniques in detail and add them to your Python string formatting toolkit.</summary>
      <content type="html">
        &lt;p&gt;In this course, you&amp;rsquo;ll see two items to add to your Python string formatting toolkit. You&amp;rsquo;ll learn about Python&amp;rsquo;s string format method and the formatted string literal, or f-string. You&amp;rsquo;ll learn about these formatting techniques in detail and add them to your Python string formatting toolkit.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;string &lt;code&gt;.format()&lt;/code&gt; method&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;formatted string literal&lt;/strong&gt;, or &lt;strong&gt;f-string&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&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 #36: Sentiment Analysis, Fourier Transforms, and More Python Data Science</title>
      <id>https://realpython.com/podcasts/rpp/36/</id>
      <link href="https://realpython.com/podcasts/rpp/36/"/>
      <updated>2020-11-20T12:00:00+00:00</updated>
      <summary>Are you interested in learning more about Natural Language Processing? Have you heard of sentiment analysis? This week on the show, Kyle Stratis returns to talk about his new article titled, Use Sentiment Analysis With Python to Classify Movie Reviews. David Amos is also here, and all of us cover another batch of PyCoder’s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Are you interested in learning more about Natural Language Processing? Have you heard of sentiment analysis? This week on the show, Kyle Stratis returns to talk about his new article titled, Use Sentiment Analysis With Python to Classify Movie Reviews. David Amos is also here, and all of us cover another batch of PyCoder’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>The Real Python Podcast – Episode #35: Security and Authorization in Your Python Web Applications</title>
      <id>https://realpython.com/podcasts/rpp/35/</id>
      <link href="https://realpython.com/podcasts/rpp/35/"/>
      <updated>2020-11-13T12:00:00+00:00</updated>
      <summary>So you built a web application in Python. Now how are you going to authorize users? Security goes beyond authentication. Who gets to do what, where, and when? This week on the show, we have Sam Scott, chief technology officer from Oso. Oso is an open-source policy engine for authorization that you embed in your application.</summary>
      <content type="html">
        &lt;p&gt;So you built a web application in Python. Now how are you going to authorize users? Security goes beyond authentication. Who gets to do what, where, and when? This week on the show, we have Sam Scott, chief technology officer from Oso. Oso is an open-source policy engine for authorization that you embed in your application.&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>
