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

  
    <entry>
      <title>Python vs JavaScript for Pythonistas</title>
      <id>https://realpython.com/python-vs-javascript/</id>
      <link href="https://realpython.com/python-vs-javascript/"/>
      <updated>2020-05-18T14:00:00+00:00</updated>
      <summary>Python and JavaScript are two of the most popular programming languages in the world. In this tutorial, you&#x27;ll take a deep dive into the JavaScript ecosystem by comparing Python vs JavaScript. You&#x27;ll learn the jargon, language history, and best practices from a Pythonista&#x27;s perspective.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you’re serious about &lt;strong&gt;&lt;a href=&quot;https://realpython.com/learning-paths/become-python-web-developer/&quot;&gt;web development&lt;/a&gt;&lt;/strong&gt;, then you’ll need to learn about &lt;strong&gt;JavaScript&lt;/strong&gt; at some point. Year after year, numerous &lt;a href=&quot;https://insights.stackoverflow.com/survey&quot;&gt;surveys&lt;/a&gt; have shown that JavaScript is one of the most &lt;a href=&quot;https://octoverse.github.com/#top-languages&quot;&gt;popular programming languages&lt;/a&gt; in the world, with a large and growing community of developers. Just like Python, modern JavaScript can be used almost anywhere, including the front end, back end, desktop, mobile, and the &lt;a href=&quot;https://en.wikipedia.org/wiki/Internet_of_things&quot;&gt;Internet of Things&lt;/a&gt; (IoT). Sometimes it might not be an obvious choice between Python vs JavaScript.&lt;/p&gt;
&lt;p&gt;If you’ve never used JavaScript before or have felt overwhelmed by the quick pace of its evolution in recent years, then this article will set you on the right path. You should already know the &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;basics of Python&lt;/a&gt; to benefit fully from the comparisons made between the two languages.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this article, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Compare &lt;strong&gt;Python vs JavaScript&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Choose the &lt;strong&gt;right language&lt;/strong&gt; for the job&lt;/li&gt;
&lt;li&gt;Write a &lt;strong&gt;shell script&lt;/strong&gt; in JavaScript&lt;/li&gt;
&lt;li&gt;Generate &lt;strong&gt;dynamic content&lt;/strong&gt; on a web page&lt;/li&gt;
&lt;li&gt;Take advantage of the JavaScript &lt;strong&gt;ecosystem&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Avoid common &lt;strong&gt;pitfalls&lt;/strong&gt; in JavaScript&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;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;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you&#x27;ll need to take your Python skills to the next level.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;javascript-at-a-glance&quot;&gt;JavaScript at a Glance&lt;/h2&gt;
&lt;p&gt;If you’re already familiar with the origins of JavaScript or just want to see the code in action, then feel free to jump ahead to the &lt;a href=&quot;#javascript-starter-kit&quot;&gt;next section&lt;/a&gt;. Otherwise, prepare for a brief history lesson that will take you through the evolution of JavaScript.&lt;/p&gt;
&lt;h3 id=&quot;its-not-java&quot;&gt;It’s Not Java!&lt;/h3&gt;
&lt;p&gt;Many people, notably some IT recruiters, believe that JavaScript and &lt;strong&gt;Java&lt;/strong&gt; are the same language. It’s hard to blame them, though, because inventing such a familiar-sounding name was a marketing trick.&lt;/p&gt;
&lt;p&gt;JavaScript was originally called &lt;strong&gt;Mocha&lt;/strong&gt; before it was renamed to &lt;strong&gt;LiveScript&lt;/strong&gt; and finally rebranded as &lt;strong&gt;JavaScript&lt;/strong&gt; shortly before its release. At the time, Java was a promising web technology, but it was too difficult for nontechnical webmasters. JavaScript was intended as a somewhat similar but beginner-friendly language to supplement &lt;a href=&quot;https://en.wikipedia.org/wiki/Java_applet&quot;&gt;Java applets&lt;/a&gt; in web browsers.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Fun Fact:&lt;/strong&gt; Both Java and JavaScript were released in 1995. Python was already five years old.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To add to the confusion, Microsoft developed its own version of the language, which it called &lt;strong&gt;JScript&lt;/strong&gt; due to a lack of licensing rights, for use with Internet Explorer 3.0. Today, people often refer to JavaScript as &lt;strong&gt;JS&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;While Java and JavaScript share a few similarities in their &lt;strong&gt;C-like syntax&lt;/strong&gt; as well as in their standard libraries, they’re used for different purposes. Java diverged from the client side into a more general-purpose language. JavaScript, despite its simplicity, was sufficient for validating HTML forms and adding little animations.&lt;/p&gt;
&lt;h3 id=&quot;its-ecmascript&quot;&gt;It’s ECMAScript&lt;/h3&gt;
&lt;p&gt;JavaScript was developed in the early days of the Web by a relatively small company known as &lt;strong&gt;Netscape&lt;/strong&gt;. To win the market against Microsoft and mitigate the differences across web browsers, Netscape needed to standardize their language. After being turned down by the international &lt;strong&gt;World Wide Web Consortium (W3C)&lt;/strong&gt;, they asked a European standardization body called &lt;strong&gt;ECMA&lt;/strong&gt; (today &lt;strong&gt;Ecma International&lt;/strong&gt;) for help.&lt;/p&gt;
&lt;p&gt;ECMA defined a formal specification for the language called &lt;strong&gt;ECMAScript&lt;/strong&gt; because the name &lt;em&gt;JavaScript&lt;/em&gt; had been trademarked by &lt;strong&gt;Sun Microsystems&lt;/strong&gt;. JavaScript became one of the implementations of the specification that it originally inspired.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; In other words, JavaScript conforms to the &lt;a href=&quot;https://www.ecma-international.org/publications/standards/Ecma-262.htm&quot;&gt;ECMAScript specification&lt;/a&gt;. Another notable member of the ECMAScript family is &lt;strong&gt;ActionScript&lt;/strong&gt;, which is used on the Flash platform.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;While individual implementations of the specification complied with ECMAScript to some extent, they also shipped with additional proprietary APIs. This led to web pages not displaying correctly across different browsers and the advent of libraries such as &lt;a href=&quot;https://jquery.com/&quot;&gt;jQuery&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;are-there-other-scripts&quot;&gt;Are There Other Scripts?&lt;/h3&gt;
&lt;p&gt;To this day, JavaScript remains the only programming language natively supported by web browsers. It’s the &lt;strong&gt;lingua franca&lt;/strong&gt; of the Web. Some people love it, while others don’t.&lt;/p&gt;
&lt;p&gt;There have been—and continue to be—many attempts to replace or supplant JavaScript with other technologies, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Rich Internet Applications:&lt;/strong&gt; Flash, Silverlight, JavaFX&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Transpilers:&lt;/strong&gt; Haxe, Google Web Toolkit, pyjs&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;JavaScript dialects:&lt;/strong&gt; CoffeeScript, TypeScript&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These attempts were driven not only by personal preference but also by web browsers’ limitations before &lt;strong&gt;HTML5&lt;/strong&gt; came onto the scene. In those days, you couldn’t use JavaScript for computationally intensive tasks such as drawing vector graphics or processing audio.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Rich Internet Applications (RIA)&lt;/strong&gt;, on the other hand, offered an immersive desktop-like experience in the browser through plugins. They were great for games and processing media. Unfortunately, most of them were closed source. Some had security vulnerabilities or performance issues on certain platforms. To top it off, they all severely limited the ability of web search engines to index pages built with these plugins.&lt;/p&gt;
&lt;p&gt;Around the same time came &lt;strong&gt;transpilers&lt;/strong&gt;, which allowed for an automated translation of other languages into JavaScript. This made the entry barrier to front-end development much lower because suddenly back-end engineers could leverage their skills in a new field. However, the downsides were slower development time, limited support for web standards, and cumbersome debugging of the transpiled JavaScript code. To link it back to the original code, you’d need a &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Use_a_source_map&quot;&gt;source map&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-vs-javascript/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-vs-javascript/ »&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 #9: Leveling Up Your Python Literacy and Finding Python Projects to Study</title>
      <id>https://realpython.com/podcasts/rpp/9/</id>
      <link href="https://realpython.com/podcasts/rpp/9/"/>
      <updated>2020-05-15T12:00:00+00:00</updated>
      <summary>In your quest to become a better developer, how do you find Python code that is at your reading level? What are good code bases or projects to study? What are the things holding you back from leveling up your Python literacy? This week we have Cecil Phillip on the show to discuss all of these common questions. Cecil is a Senior Cloud Advocate at Microsoft.</summary>
      <content type="html">
        &lt;p&gt;In your quest to become a better developer, how do you find Python code that is at your reading level? What are good code bases or projects to study? What are the things holding you back from leveling up your Python literacy? This week we have Cecil Phillip on the show to discuss all of these common questions. Cecil is a Senior Cloud Advocate at Microsoft.&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 Community Interview With Christopher Bailey</title>
      <id>https://realpython.com/interview-christopher-bailey/</id>
      <link href="https://realpython.com/interview-christopher-bailey/"/>
      <updated>2020-05-13T14:00:00+00:00</updated>
      <summary>Christopher Bailey is the host of The Real Python Podcast. In this interview, we dig into his past in music and video production and provide some helpful tips and tricks for any budding content creator looking to create their first coding video tutorials.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Today I’m speaking to &lt;a href=&quot;https://twitter.com/digiglean&quot;&gt;Christopher Bailey&lt;/a&gt;, the host of &lt;a href=&quot;https://realpython.com/podcasts/rpp/&quot;&gt;The Real Python Podcast&lt;/a&gt;. We dig into his past in music and video production as well as his approach to producing online video content. Christopher also provides some helpful tips and tricks for any budding content creator looking to create their first coding video tutorials.&lt;/p&gt;
&lt;p class=&quot;mt-5&quot;&gt;&lt;strong&gt;Ricky:&lt;/strong&gt; &lt;em&gt;Thanks for joining me, Christopher, and welcome to the other side of the interview desk. Let’s start the same way we do with all our guests: How’d you get into programming, and when did you start using Python?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid w-25 float-right ml-3 rounded-circle&quot; src=&quot;https://files.realpython.com/media/IMG_1250.b2eeb8f803ea.jpeg&quot; width=&quot;1770&quot; height=&quot;1770&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/IMG_1250.b2eeb8f803ea.jpeg&amp;amp;w=442&amp;amp;sig=8484016889c6b7e5a6b775e00b9d9b44e34bc6d4 442w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/IMG_1250.b2eeb8f803ea.jpeg&amp;amp;w=885&amp;amp;sig=e4601f8101f721fb037789649cbd97172afb9d93 885w, https://files.realpython.com/media/IMG_1250.b2eeb8f803ea.jpeg 1770w&quot; sizes=&quot;75vw&quot; alt=&quot;Chris Bailey&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Christopher:&lt;/strong&gt; Thanks for having me. I started programming at a friend’s house, which had an Apple II. We were typing in the code from a magazine to create a text adventure. I can’t remember the specifics, but between sessions of Ultima we were trying our hands at BASIC. &lt;/p&gt;
&lt;p&gt;My next big experience was saving all my paper route money to purchase a ColecoVision for myself. My parents then surprised me by buying the Adam computer that attached to it. It was basically an Apple II clone with a horrible daisy wheel printer and a “high speed” tape drive. I taught myself BASIC and made a couple of simple games as well as a Dungeons &amp;amp; Dragons character generator.&lt;/p&gt;
&lt;p&gt;Fast-forward to college, and I studied electrical engineering at Arizona State. I learned some C and Fortran in a huge Unix lab. I dropped out in my second year and never got a degree. I was deep in the music scene, forming bands and learning everything I could about home recording and MIDI (Musical Instrument Digital Interface).&lt;/p&gt;
&lt;p&gt;I’ve always had a knack for learning software and electronic hardware. It’s always just made sense. I turned that into a job at a musical instrument store, which led to me doing one-on-one consulting teaching people how to use their music hardware. That turned into touring as a technician for Wayman Tisdale. That then led to being a recording engineer in a studio in Sacramento, where I earned a Platinum record for working on Tyrese Gibson’s first album.&lt;/p&gt;
&lt;p&gt;When I left California to move back to Arizona, a former colleague asked me if I wanted to teach at a school for recording engineers. I taught at the Conservatory of Recording Arts &amp;amp; Sciences for ten years. I taught everything from MIDI to digital audio, surround sound, video game audio, Pro Tools, and Logic. After that, I moved to Hawaii, where my wife was born, and I worked for Apple as a trainer and then as a repair technician.&lt;/p&gt;
&lt;p&gt;My wife is the person I need to thank for getting me back into programming. She worked for a bank, and they needed someone who could create SQL queries. I taught myself using as many resources as I could find: Lynda online training, &lt;em&gt;Learn SQL the Hard Way&lt;/em&gt;, SQLZoo.net.&lt;/p&gt;
&lt;p&gt;On my first day on the job, I was tasked with recreating a mortgage database tool based on a raw export of all the tables from the program. The tools I had were Microsoft SQL Server and Report Builder. I had no relationship diagrams, just raw data and examples of the types of forms to recreate. I learned a lot about mortgages and SQL very quickly!&lt;/p&gt;
&lt;p&gt;Eventually, another job opened up at a different bank in Hawaii, but they were looking for someone who could use Python. I once again crammed as much as I could before the interview. That’s where I found Real Python and Dan’s book, &lt;a href=&quot;https://realpython.com/products/python-tricks-book/&quot;&gt;&lt;em&gt;Python Tricks&lt;/em&gt;&lt;/a&gt;. I had heard him on the Talk Python to Me podcast. I did a short coding test in person and another take-home one. I got the job and worked as a data analyst for their marketing department.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/interview-christopher-bailey/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/interview-christopher-bailey/ »&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>Improve Your Tests With the Python Mock Object Library</title>
      <id>https://realpython.com/courses/python-mock-object-library/</id>
      <link href="https://realpython.com/courses/python-mock-object-library/"/>
      <updated>2020-05-12T14:00:00+00:00</updated>
      <summary>In this course, you&#x27;ll learn how to use the Python mock object library, unittest.mock, to create and use mock objects to improve your tests. Obstacles like complex logic and unpredictable dependencies make writing valuable tests difficult, but unittest.mock can help you overcome these obstacles.</summary>
      <content type="html">
        &lt;p&gt;When you&amp;rsquo;re writing robust code, &lt;strong&gt;tests&lt;/strong&gt; are essential for verifying that your application logic is correct, reliable, and efficient. However, the value of your tests depends on how well they demonstrate these criteria. Obstacles such as &lt;strong&gt;complex logic&lt;/strong&gt; and unpredictable &lt;strong&gt;dependencies&lt;/strong&gt; make writing valuable tests difficult. The Python mock object library, &lt;strong&gt;&lt;code&gt;unittest.mock&lt;/code&gt;&lt;/strong&gt;, can help you overcome these obstacles.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll be able to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create Python mock objects using &lt;code&gt;Mock&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Assert that you&amp;rsquo;re using objects as you intended&lt;/li&gt;
&lt;li&gt;Inspect usage data stored on your Python mocks&lt;/li&gt;
&lt;li&gt;Configure certain aspects of your Python mock objects&lt;/li&gt;
&lt;li&gt;Substitute your mocks for real objects using &lt;code&gt;patch()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Avoid common problems inherent in Python mocking&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll begin by seeing what mocking is and how it will improve your tests!&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 eval(): Evaluate Expressions Dynamically</title>
      <id>https://realpython.com/python-eval-function/</id>
      <link href="https://realpython.com/python-eval-function/"/>
      <updated>2020-05-11T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, 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;div&gt;&lt;p&gt;Python’s &lt;strong&gt;&lt;code&gt;eval()&lt;/code&gt;&lt;/strong&gt; allows you to evaluate arbitrary Python &lt;a href=&quot;https://realpython.com/python-operators-expressions/&quot;&gt;&lt;strong&gt;expressions&lt;/strong&gt;&lt;/a&gt; from a string-based or &lt;a href=&quot;https://docs.python.org/3/library/stdtypes.html#code-objects&quot;&gt;compiled-code-based&lt;/a&gt; input. This function can be handy when you’re trying to dynamically evaluate Python expressions from any input that comes as a &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt; or a compiled code object.&lt;/p&gt;
&lt;p&gt;Although Python’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 tutorial, you’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’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;How Python’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;Additionally, you’ll learn how to use Python’s &lt;code&gt;eval()&lt;/code&gt; to code an application that interactively evaluates math expressions. With this example, you’ll apply everything you’ve learned about &lt;code&gt;eval()&lt;/code&gt; to a real-world problem. If you want to get the code for this application, then you can click on the box below:&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Download the sample code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-eval-project/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-eval-project&quot; data-focus=&quot;false&quot;&gt;Click here to get the code you&#x27;ll use&lt;/a&gt; to learn about Python&#x27;s eval() in this tutorial.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;understanding-pythons-eval&quot;&gt;Understanding Python’s &lt;code&gt;eval()&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;You can use the built-in Python &lt;a href=&quot;https://docs.python.org/3/library/functions.html#eval&quot;&gt;&lt;strong&gt;&lt;code&gt;eval()&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; to dynamically evaluate expressions from a string-based or compiled-code-based input. If you pass in a &lt;a href=&quot;https://realpython.com/courses/python-strings/&quot;&gt;string&lt;/a&gt; to &lt;code&gt;eval()&lt;/code&gt;, then the function parses it, compiles it to &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-bytecode&quot;&gt;bytecode&lt;/a&gt;, and evaluates it as a Python expression. But if you call &lt;code&gt;eval()&lt;/code&gt; with a compiled code object, then the function performs just the evaluation step, which is quite convenient if you call &lt;code&gt;eval()&lt;/code&gt; several times with the same input.&lt;/p&gt;
&lt;p&gt;The signature of Python’s &lt;code&gt;eval()&lt;/code&gt; is defined as follows:&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;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;expression&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;globals&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;locals&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The function takes a first argument, called &lt;code&gt;expression&lt;/code&gt;, which holds the expression that you need to evaluate. &lt;code&gt;eval()&lt;/code&gt; also takes two optional arguments:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;globals&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;locals&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In the next three sections, you’ll learn what these arguments are and how &lt;code&gt;eval()&lt;/code&gt; uses them to evaluate Python expressions on the fly.&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 can also use &lt;a href=&quot;https://docs.python.org/3/library/functions.html#exec&quot;&gt;&lt;strong&gt;&lt;code&gt;exec()&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; to dynamically execute Python code. The main difference between &lt;code&gt;eval()&lt;/code&gt; and &lt;code&gt;exec()&lt;/code&gt; is that &lt;code&gt;eval()&lt;/code&gt; can only execute or evaluate expressions, whereas &lt;code&gt;exec()&lt;/code&gt; can execute any piece of Python code.&lt;/p&gt;
&lt;/div&gt;
&lt;h3 id=&quot;the-first-argument-expression&quot;&gt;The First Argument: &lt;code&gt;expression&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The first argument to &lt;code&gt;eval()&lt;/code&gt; is called &lt;strong&gt;&lt;code&gt;expression&lt;/code&gt;&lt;/strong&gt;. It’s a required argument that holds the &lt;strong&gt;string-based&lt;/strong&gt; or &lt;strong&gt;compiled-code-based&lt;/strong&gt; input to the function. When you call &lt;code&gt;eval()&lt;/code&gt;, the content of &lt;code&gt;expression&lt;/code&gt; is evaluated as a Python expression. Check out the following examples that use string-based input:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;2 ** 8&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;256&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1024 + 1024&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2048&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sum([8, 16, 32])&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;56&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;mi&quot;&gt;100&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;eval&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;x * 2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;200&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;When you call &lt;code&gt;eval()&lt;/code&gt; with a string as an argument, the function returns the value that results from evaluating the input string. By default, &lt;code&gt;eval()&lt;/code&gt; has access to global names like &lt;code&gt;x&lt;/code&gt; in the above example.&lt;/p&gt;
&lt;p&gt;To evaluate a string-based &lt;code&gt;expression&lt;/code&gt;, Python’s &lt;code&gt;eval()&lt;/code&gt; runs the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Parse&lt;/strong&gt; &lt;code&gt;expression&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Compile&lt;/strong&gt; it to bytecode&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Evaluate&lt;/strong&gt; it as a Python expression&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Return&lt;/strong&gt; the result of the evaluation&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The name &lt;code&gt;expression&lt;/code&gt; for the first argument to &lt;code&gt;eval()&lt;/code&gt; highlights that the function works only with expressions and not with &lt;a href=&quot;https://docs.python.org/3/reference/compound_stmts.html&quot;&gt;compound statements&lt;/a&gt;. The &lt;a href=&quot;https://docs.python.org/3/&quot;&gt;Python documentation&lt;/a&gt; defines &lt;strong&gt;expression&lt;/strong&gt; as follows:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;expression&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A piece of syntax which can be evaluated to some value. In other words, an expression is an accumulation of expression elements like literals, names, attribute access, operators or function calls which all return a value. In contrast to many other languages, not all language constructs are expressions. There are also statements which cannot be used as expressions, such as &lt;code&gt;while&lt;/code&gt;. Assignments are also statements, not expressions. (&lt;a href=&quot;https://docs.python.org/3/glossary.html#term-expression&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On the other hand, a Python &lt;strong&gt;statement&lt;/strong&gt; has the following definition:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;statement&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A statement is part of a suite (a “block” of code). A statement is either an expression or one of several constructs with a keyword, such as &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;while&lt;/code&gt; or &lt;code&gt;for&lt;/code&gt;. (&lt;a href=&quot;https://docs.python.org/3/glossary.html#term-statement&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If you try to pass a compound statement to &lt;code&gt;eval()&lt;/code&gt;, then you’ll get a &lt;a href=&quot;https://realpython.com/invalid-syntax-python/&quot;&gt;&lt;code&gt;SyntaxError&lt;/code&gt;&lt;/a&gt;. Take a look at the following example in which you try to execute an &lt;a href=&quot;https://realpython.com/python-conditional-statements/&quot;&gt;&lt;code&gt;if&lt;/code&gt; statement&lt;/a&gt; using &lt;code&gt;eval()&lt;/code&gt;:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-eval-function/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-eval-function/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #8: Docker + Python for Data Science and Machine Learning</title>
      <id>https://realpython.com/podcasts/rpp/8/</id>
      <link href="https://realpython.com/podcasts/rpp/8/"/>
      <updated>2020-05-08T12:00:00+00:00</updated>
      <summary>Docker is a common tool for Python developers creating and deploying applications, but what do you need to know if you want to use Docker for data science and machine learning? What are the best practices if you want to start using containers for your scientific projects? This week we have Tania Allard on the show. She is a Sr. Developer Advocate at Microsoft focusing on Machine Learning, scientific computing, research and open source.</summary>
      <content type="html">
        &lt;p&gt;Docker is a common tool for Python developers creating and deploying applications, but what do you need to know if you want to use Docker for data science and machine learning? What are the best practices if you want to start using containers for your scientific projects? This week we have Tania Allard on the show. She is a Sr. Developer Advocate at Microsoft focusing on Machine Learning, scientific computing, research and open source.&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 Move a Django Model to Another App</title>
      <id>https://realpython.com/move-django-model/</id>
      <link href="https://realpython.com/move-django-model/"/>
      <updated>2020-05-06T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how to move a Django model from one app to another using Django migrations. You&#x27;ll explore three different techniques and learn some helpful guidelines for choosing the best approach for your situation and needs.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you’ve ever thought about refactoring your Django app, then you might have found yourself needing to move a Django model around. There are several ways to move a Django model from one app to another using Django &lt;strong&gt;migrations&lt;/strong&gt;, but unfortunately none of them are straightforward.&lt;/p&gt;
&lt;p&gt;Moving models between Django apps is usually a very complicated task that involves copying data, changing constraints, and renaming objects. Because of these complications, the Django &lt;strong&gt;object-relational mapper (ORM)&lt;/strong&gt; does not provide built-in migration operations that can detect and automate the entire process. Instead, the ORM provides a set of low-level migration operations that allow Django developers to implement the process themselves in the migration framework.&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 to &lt;strong&gt;move a Django model&lt;/strong&gt; from one app to another&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;advanced features&lt;/strong&gt; of the Django migration command line interface (CLI), such as &lt;code&gt;sqlmigrate&lt;/code&gt;, &lt;code&gt;showmigrations&lt;/code&gt;, and &lt;code&gt;sqlsequencereset&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;How to produce and inspect a &lt;strong&gt;migration plan&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to make a migration reversible and how to &lt;strong&gt;reverse migrations&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;introspection&lt;/strong&gt; is and how Django uses it in migrations&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After completing this tutorial, you’ll be able to choose the best approach for moving a Django model from one app to another based on your specific use case.&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-django-resources-learing-guide&quot; data-focus=&quot;false&quot;&gt;Click here to get access to a free Django Learning Resources Guide (PDF)&lt;/a&gt; that shows you tips and tricks as well as common pitfalls to avoid when building Python + Django web applications.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;example-case-move-a-django-model-to-another-app&quot;&gt;Example Case: Move a Django Model to Another App&lt;/h2&gt;
&lt;p&gt;Throughout this tutorial, you’re going work on a store app. Your store is going to start with two Django apps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;catalog&lt;/code&gt;&lt;/strong&gt;: This app is for storing data on products and product categories.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;sale&lt;/code&gt;&lt;/strong&gt;: This app is for recording and tracking product sales.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;After you finish setting up these two apps, you’re going to move a Django model called &lt;code&gt;Product&lt;/code&gt; to a new app called &lt;code&gt;product&lt;/code&gt;. In the process, you’ll face the following challenges:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The model being moved has foreign key relationships with other models.&lt;/li&gt;
&lt;li&gt;Other models have foreign key relationships with the model being moved.&lt;/li&gt;
&lt;li&gt;The model being moved has an index on one of the fields (besides the primary key).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These challenges are inspired by real-life refactoring processes. After you overcome them, you’ll be ready to plan a similar migration process for your specific use case.&lt;/p&gt;
&lt;h2 id=&quot;setup-prepare-your-environment&quot;&gt;Setup: Prepare Your Environment&lt;/h2&gt;
&lt;p&gt;Before you start moving things around, you need to set up the initial state of your project. This tutorial uses Django 3 running on Python 3.8, but you can use similar techniques in other versions.&lt;/p&gt;
&lt;h3 id=&quot;set-up-a-python-virtual-environment&quot;&gt;Set Up a Python Virtual Environment&lt;/h3&gt;
&lt;p&gt;First, create your virtual environment in a new directory:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; mkdir django-move-model-experiment
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; django-move-model-experiment
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; python -m venv venv
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;For step-by-step instructions on creating a virtual environment, check out &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;Python Virtual Environments: A Primer&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;create-a-django-project&quot;&gt;Create a Django Project&lt;/h3&gt;
&lt;p&gt;In your terminal, activate the virtual environment and install Django:&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; &lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; venv/bin/activate
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; pip install django
&lt;span class=&quot;go&quot;&gt;Collecting django&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Collecting pytz (from django)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Collecting asgiref~=3.2 (from django)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Collecting sqlparse&amp;gt;=0.2.2 (from django)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Installing collected packages: pytz, asgiref, sqlparse, django&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Successfully installed asgiref-3.2.3 django-3.0.4 pytz-2019.3 sqlparse-0.3.1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You’re now ready to create your Django project. Use &lt;code&gt;django-admin startproject&lt;/code&gt; to create a project called &lt;code&gt;django-move-model-experiment&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; django-admin startproject django-move-model-experiment
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; django-move-model-experiment
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After running this command, you’ll see that Django created new files and directories. For more about how to start a new Django project, check out &lt;a href=&quot;https://realpython.com/django-setup/&quot;&gt;Starting a Django Project&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;create-django-apps&quot;&gt;Create Django Apps&lt;/h3&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/move-django-model/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/move-django-model/ »&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 Python print() Function: Go Beyond the Basics</title>
      <id>https://realpython.com/courses/python-print/</id>
      <link href="https://realpython.com/courses/python-print/"/>
      <updated>2020-05-05T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn about the print() function in Python and discover some of its lesser-known features. Avoid common mistakes, take your &quot;hello world&quot; to the next level, and know when to use a better alternative.</summary>
      <content type="html">
        &lt;p&gt;If you&amp;rsquo;re like most Python users, including us, then you probably started your Python journey by learning about &lt;strong&gt;&lt;code&gt;print()&lt;/code&gt;&lt;/strong&gt;. It helped you write your very own &lt;code&gt;Hello Horld&lt;/code&gt; one-liner. You can use it to display formatted messages onto the screen and perhaps find some bugs. But if you think that&amp;rsquo;s all there is to know about Python&amp;rsquo;s &lt;code&gt;print()&lt;/code&gt;, then you&amp;rsquo;re missing out on a lot!&lt;/p&gt;
&lt;p&gt;Keep reading to take full advantage of this underappreciated little function. This course will get you up to speed with using Python &lt;code&gt;print()&lt;/code&gt; effectively. Prepare for a deep dive as you go through the sections. You may be surprised how much &lt;code&gt;print()&lt;/code&gt; has to offer!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll know how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Avoid common mistakes with Python&amp;rsquo;s &lt;code&gt;print()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Deal with newlines, character encodings, and buffering&lt;/li&gt;
&lt;li&gt;Write text to files&lt;/li&gt;
&lt;li&gt;Mock &lt;code&gt;print()&lt;/code&gt; in unit tests&lt;/li&gt;
&lt;li&gt;Build advanced user interfaces in the terminal&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; &lt;code&gt;print()&lt;/code&gt; was a major addition to Python 3, in which it replaced the old &lt;code&gt;print&lt;/code&gt; statement available in Python 2.&lt;/p&gt;
&lt;p&gt;There were a number of good reasons for that, as you&amp;rsquo;ll see shortly. Although this tutorial focuses on Python 3, it does show the old way of printing in Python for reference.&lt;/p&gt;
&lt;/div&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using Python datetime to Work With Dates and Times</title>
      <id>https://realpython.com/python-datetime/</id>
      <link href="https://realpython.com/python-datetime/"/>
      <updated>2020-05-04T14:00:00+00:00</updated>
      <summary>Have you ever wondered about working with dates and times in Python? In this tutorial, you&#x27;ll learn all about the built-in Python datetime library. You&#x27;ll also learn about how to manage time zones and daylight saving time, and how to do accurate arithmetic on dates and times.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Working with dates and times is one of the biggest challenges in programming. Between dealing with time zones, daylight saving time, and different written date formats, it can be tough to keep track of which days and times you’re referencing. Fortunately, the built-in Python &lt;strong&gt;&lt;code&gt;datetime&lt;/code&gt;&lt;/strong&gt; module can help you manage the complex nature of dates and times.&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;Why programming with &lt;strong&gt;dates and times&lt;/strong&gt; is such a challenge&lt;/li&gt;
&lt;li&gt;Which functions are available in the &lt;strong&gt;Python &lt;code&gt;datetime&lt;/code&gt;&lt;/strong&gt; module&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;print or read a date and time&lt;/strong&gt; in a specific format&lt;/li&gt;
&lt;li&gt;How to do &lt;strong&gt;arithmetic&lt;/strong&gt; with dates and times&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Plus, you’re going to develop a neat application to count down the time remaining until the next PyCon US! &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;p&gt;Let’s get started!&lt;/p&gt;
&lt;h2 id=&quot;programming-with-dates-and-times&quot;&gt;Programming With Dates and Times&lt;/h2&gt;
&lt;p&gt;If you’ve ever worked on software that needed to keep track of times across several geographic areas, then you probably have a sense of why programming with time can be such a pain. The fundamental disconnect is that computer programs prefer events that are perfectly ordered and regular, but the way in which most humans use and refer to time is highly irregular.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If you want to learn more about why time can be so complicated to deal with, then there are many great resources available on the web. Here are a few good places to start:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=-5wpm-gesOY&quot;&gt;Computerphile: The Problem With Time &amp;amp; Timezones&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=rz3D8VG_2TY&quot;&gt;Working With Time Zones: Everything You Wish You Didn’t Need to Know&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.mojotech.com/blog/the-complexity-of-time-data-programming/&quot;&gt;The Complexity of Time Data Programming&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;One great example of this irregularity is &lt;a href=&quot;https://en.wikipedia.org/wiki/Daylight_saving_time&quot;&gt;&lt;strong&gt;daylight saving time&lt;/strong&gt;&lt;/a&gt;. In the United States and Canada, clocks are set forward by one hour on the second Sunday in March and set back by one hour on the first Sunday in November. However, this has only been the case &lt;a href=&quot;https://www.nist.gov/pml/time-and-frequency-division/popular-links/daylight-saving-time-dst&quot;&gt;since 2007&lt;/a&gt;. Prior to 2007, clocks were set forward on the first Sunday in April and set back on the last Sunday in October.&lt;/p&gt;
&lt;p&gt;Things get even more complicated when you consider &lt;a href=&quot;https://en.wikipedia.org/wiki/Time_zone&quot;&gt;&lt;strong&gt;time zones&lt;/strong&gt;&lt;/a&gt;. Ideally, time zone boundaries would follow lines of longitude exactly. However, for historical and political reasons, time zone lines are rarely straight. Often, areas that are separated by large distances find themselves in the same time zone, and adjacent areas are in different time zones. There are some time zones out there with &lt;a href=&quot;https://upload.wikimedia.org/wikipedia/commons/8/88/World_Time_Zones_Map.png&quot;&gt;pretty funky shapes&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;how-computers-count-time&quot;&gt;How Computers Count Time&lt;/h3&gt;
&lt;p&gt;Nearly all computers count time from an instant called the &lt;a href=&quot;https://en.wikipedia.org/wiki/Unix_time&quot;&gt;&lt;strong&gt;Unix epoch&lt;/strong&gt;&lt;/a&gt;. This occurred on January 1, 1970, at 00:00:00 UTC. UTC stands for &lt;a href=&quot;https://en.wikipedia.org/wiki/Coordinated_Universal_Time&quot;&gt;&lt;strong&gt;Coordinated Universal Time&lt;/strong&gt;&lt;/a&gt; and refers to the time at a longitude of 0°. UTC is often also called &lt;a href=&quot;https://en.wikipedia.org/wiki/Greenwich_Mean_Time&quot;&gt;Greenwich Mean Time&lt;/a&gt;, or GMT. UTC is not adjusted for daylight saving time, so it consistently keeps twenty-four hours in every day.&lt;/p&gt;
&lt;p&gt;By definition, Unix time elapses at the same rate as UTC, so a one-second step in UTC corresponds to a one-second step in Unix time. You can usually figure out the date and time in UTC of any given instant since January 1, 1970, by counting the number of seconds since the Unix epoch, with the exception of &lt;a href=&quot;https://www.youtube.com/watch?v=Uqjg8Kk1HXo&quot;&gt;&lt;strong&gt;leap seconds&lt;/strong&gt;&lt;/a&gt;. Leap seconds are occasionally added to UTC to account for the slowing of the Earth’s rotation but are not added to Unix time.&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’s an interesting bug associated with Unix time. Since many older operating systems are 32-bit, they store the Unix time in a 32-bit signed integer.&lt;/p&gt;
&lt;p&gt;This means that at 03:14:07 on January 19, 2038, the integer will overflow, resulting in what’s known as the &lt;a href=&quot;https://en.wikipedia.org/wiki/Year_2038_problem&quot;&gt;Year 2038 problem&lt;/a&gt;, or Y2038. Similar to the &lt;a href=&quot;https://en.wikipedia.org/wiki/Year_2000_problem&quot;&gt;Y2K problem&lt;/a&gt;, Y2038 will need to be corrected to avoid catastrophic consequences for critical systems.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Nearly all programming languages, including &lt;a href=&quot;https://docs.python.org/3/library/time.html&quot;&gt;Python&lt;/a&gt;, incorporate the concept of Unix time. Python’s standard library includes a module called &lt;code&gt;time&lt;/code&gt; that can print the number of seconds since the Unix epoch:&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;time&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;time&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1579718137.550164&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In this example, you &lt;a href=&quot;https://realpython.com/lessons/import-statement/&quot;&gt;import&lt;/a&gt; the &lt;code&gt;time&lt;/code&gt; module and execute &lt;a href=&quot;https://docs.python.org/3/library/time.html#time.time&quot;&gt;&lt;code&gt;time()&lt;/code&gt;&lt;/a&gt; to print the Unix time, or number of seconds (excluding leap seconds) since the epoch.&lt;/p&gt;
&lt;p&gt;In addition to Unix time, computers need a way to convey time information to users. As you saw in the last example, Unix time is nearly impossible for a human to parse. Instead, Unix time is typically converted to UTC, which can then be converted into a local time using &lt;strong&gt;time zone offsets&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Internet Assigned Numbers Authority (IANA)&lt;/strong&gt; maintains a &lt;a href=&quot;https://www.iana.org/time-zones&quot;&gt;database&lt;/a&gt; of all of the values of time zone offsets. IANA also releases regular updates that include any changes in time zone offsets. This database is often included with your operating system, although certain applications may include an updated copy.&lt;/p&gt;
&lt;p&gt;The database contains a copy of all the designated time zones and how many hours and minutes they’re offset from UTC. So, during the winter, when daylight saving time is not in effect, the US Eastern time zone has an offset of -05:00, or negative five hours from UTC. Other regions have different offsets, which may not be integer hours. The UTC offset for Nepal, for example, is +05:45, or positive five hours and forty-five minutes from UTC.&lt;/p&gt;
&lt;h3 id=&quot;how-standard-dates-can-be-reported&quot;&gt;How Standard Dates Can Be Reported&lt;/h3&gt;
&lt;p&gt;Unix time is how computers count time, but it would be incredibly inefficient for humans to determine the time by calculating the number of seconds from an arbitrary date. Instead, we work in terms of years, months, days, and so forth. But even with these conventions in place, another layer of complexity stems from the fact that different languages and cultures have different ways of writing the date.&lt;/p&gt;
&lt;p&gt;For instance, in the United States, dates are usually written starting with the month, then the day, then the year. This means that January 31, 2020, is written as &lt;strong&gt;01-31-2020&lt;/strong&gt;. This closely matches the long-form written version of the date.&lt;/p&gt;
&lt;p&gt;However, most of Europe and many other areas write the date starting with the day, then the month, then the year. This means that January 31, 2020, is written as &lt;strong&gt;31-01-2020&lt;/strong&gt;. These differences can cause all sorts of confusion when communicating across cultures.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-datetime/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-datetime/ »&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 #7: AsyncIO + Music, Origins of Black, and Managing Python Releases</title>
      <id>https://realpython.com/podcasts/rpp/7/</id>
      <link href="https://realpython.com/podcasts/rpp/7/"/>
      <updated>2020-05-01T12:00:00+00:00</updated>
      <summary>Want to learn more about AsyncIO in Python, with an example where you can see and hear events being triggered in real-time? This week we have Łukasz Langa on the show. Łukasz has created a talk for PyCon 2020 online about using AsyncIO with Music.</summary>
      <content type="html">
        &lt;p&gt;Want to learn more about AsyncIO in Python, with an example where you can see and hear events being triggered in real-time? This week we have Łukasz Langa on the show. Łukasz has created a talk for PyCon 2020 online about using AsyncIO with Music.&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>Regular Expressions: Regexes in Python, Part 1</title>
      <id>https://realpython.com/regex-python/</id>
      <link href="https://realpython.com/regex-python/"/>
      <updated>2020-04-29T14:00:00+00:00</updated>
      <summary>In previous tutorials in this series, you&#x27;ve seen several different ways to compare string values with direct character-by-character comparison. In this tutorial, you&#x27;ll learn how to perform more complex string pattern matching using regular expressions, or regexes, in Python.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In this tutorial, you’ll explore &lt;strong&gt;regular expressions&lt;/strong&gt;, also known as &lt;strong&gt;regexes&lt;/strong&gt;, in Python. A regex is a special sequence of characters that defines a pattern for complex string-matching functionality.&lt;/p&gt;
&lt;p&gt;Earlier in this series, in the tutorial &lt;a href=&quot;https://realpython.com/python-strings&quot;&gt;Strings and Character Data in Python&lt;/a&gt;, you learned how to define and manipulate string objects. Since then, you’ve seen some ways to determine whether two strings match each other:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;You can test whether two strings are equal using the &lt;a href=&quot;https://realpython.com/python-operators-expressions/#comparison-operators&quot;&gt;equality (&lt;code&gt;==&lt;/code&gt;)&lt;/a&gt; operator.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You can test whether one string is a substring of another with the &lt;a href=&quot;https://realpython.com/python-strings/#string-operators&quot;&gt;&lt;code&gt;in&lt;/code&gt;&lt;/a&gt; operator or the &lt;a href=&quot;https://realpython.com/python-strings/#built-in-string-methods&quot;&gt;built-in string methods&lt;/a&gt; &lt;code&gt;.find()&lt;/code&gt; and &lt;code&gt;.index()&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;String matching like this is a common task in programming, and you can get a lot done with string operators and built-in methods. At times, though, you may need more sophisticated pattern-matching capabilities.&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 to access the &lt;strong&gt;&lt;code&gt;re&lt;/code&gt; module&lt;/strong&gt;, which implements regex matching in Python&lt;/li&gt;
&lt;li&gt;How to use &lt;strong&gt;&lt;code&gt;re.search()&lt;/code&gt;&lt;/strong&gt; to match a pattern against a string&lt;/li&gt;
&lt;li&gt;How to create complex matching pattern with regex &lt;strong&gt;metacharacters&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Fasten your seat belt! Regex syntax takes a little getting used to. But once you get comfortable with it, you’ll find regexes almost indispensable in your Python programming.&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;https://realpython.com/bonus/python-tricks-sample/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-tricks-sample&quot; data-focus=&quot;false&quot;&gt;Click here to get access to a chapter from Python Tricks: The Book&lt;/a&gt; that shows you Python&#x27;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;regexes-in-python-and-their-uses&quot;&gt;Regexes in Python and Their Uses&lt;/h2&gt;
&lt;p&gt;Imagine you have a string object &lt;code&gt;s&lt;/code&gt;. Now suppose you need to write Python code to find out whether &lt;code&gt;s&lt;/code&gt; contains the substring &lt;code&gt;&#x27;123&#x27;&lt;/code&gt;. There are at least a couple ways to do this. You could use the &lt;code&gt;in&lt;/code&gt; operator:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;foo123bar&#x27;&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27;123&#x27;&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&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;If you want to know not only &lt;em&gt;whether&lt;/em&gt; &lt;code&gt;&#x27;123&#x27;&lt;/code&gt; exists in &lt;code&gt;s&lt;/code&gt; but also &lt;em&gt;where&lt;/em&gt; it exists, then you can use &lt;code&gt;.find()&lt;/code&gt; or &lt;code&gt;.index()&lt;/code&gt;. Each of these returns the character position within &lt;code&gt;s&lt;/code&gt; where the substring resides:&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;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;foo123bar&#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;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27;123&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;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;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27;123&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;In these examples, the matching is done by a straightforward character-by-character comparison. That will get the job done in many cases. But sometimes, the problem is more complicated than that.&lt;/p&gt;
&lt;p&gt;For example, rather than searching for a fixed substring like &lt;code&gt;&#x27;123&#x27;&lt;/code&gt;, suppose you wanted to determine whether a string contains &lt;em&gt;any&lt;/em&gt; three consecutive decimal digit characters, as in the strings &lt;code&gt;&#x27;foo123bar&#x27;&lt;/code&gt;, &lt;code&gt;&#x27;foo456bar&#x27;&lt;/code&gt;, &lt;code&gt;&#x27;234baz&#x27;&lt;/code&gt;, and &lt;code&gt;&#x27;qux678&#x27;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Strict character comparisons won’t cut it here. This is where regexes in Python come to the rescue.&lt;/p&gt;
&lt;h3 id=&quot;a-very-brief-history-of-regular-expressions&quot;&gt;A (Very Brief) History of Regular Expressions&lt;/h3&gt;
&lt;p&gt;In 1951, mathematician Stephen Cole Kleene described the concept of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Regular_language&quot;&gt;regular language&lt;/a&gt;, a language that is recognizable by a finite automaton and formally expressible using &lt;a href=&quot;https://en.wikipedia.org/wiki/Regular_expression&quot;&gt;regular expressions&lt;/a&gt;. In the mid-1960s, computer science pioneer &lt;a href=&quot;https://en.wikipedia.org/wiki/Ken_Thompson&quot;&gt;Ken Thompson&lt;/a&gt;, one of the original designers of Unix, implemented pattern matching in the &lt;a href=&quot;https://en.wikipedia.org/wiki/QED_(text_editor)&quot;&gt;QED text editor&lt;/a&gt; using Kleene’s notation.&lt;/p&gt;
&lt;p&gt;Since then, regexes have appeared in many programming languages, editors, and other tools as a means of determining whether a string matches a specified pattern. Python, Java, and Perl all support regex functionality, as do most Unix tools and many text editors.&lt;/p&gt;
&lt;h3 id=&quot;the-re-module&quot;&gt;The &lt;code&gt;re&lt;/code&gt; Module&lt;/h3&gt;
&lt;p&gt;Regex functionality in Python resides in a module named &lt;code&gt;re&lt;/code&gt;. The &lt;code&gt;re&lt;/code&gt; module contains many useful functions and methods, most of which you’ll learn about in the next tutorial in this series.&lt;/p&gt;
&lt;p&gt;For now, you’ll focus predominantly on one function, &lt;code&gt;re.search()&lt;/code&gt;.&lt;/p&gt;
&lt;p class=&quot;h4 mt-4&quot;&gt;&lt;code&gt;re.search(&amp;lt;regex&amp;gt;, &amp;lt;string&amp;gt;)&lt;/code&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Scans a string for a regex match.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;code&gt;re.search(&amp;lt;regex&amp;gt;, &amp;lt;string&amp;gt;)&lt;/code&gt; scans &lt;code&gt;&amp;lt;string&amp;gt;&lt;/code&gt; looking for the first location where the pattern &lt;code&gt;&amp;lt;regex&amp;gt;&lt;/code&gt; matches. If a match is found, then &lt;code&gt;re.search()&lt;/code&gt; returns a &lt;strong&gt;match object&lt;/strong&gt;. Otherwise, it returns &lt;a href=&quot;https://realpython.com/null-in-python/&quot;&gt;&lt;code&gt;None&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/regex-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/regex-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>Structuring a Python Application</title>
      <id>https://realpython.com/courses/structuring-python-application/</id>
      <link href="https://realpython.com/courses/structuring-python-application/"/>
      <updated>2020-04-28T14:00:00+00:00</updated>
      <summary>This course is a reference guide to common Python application layouts and project structures for command-line applications, web applications, and more.</summary>
      <content type="html">
        &lt;p&gt;Python, though opinionated on syntax and style, is surprisingly flexible when it comes to &lt;strong&gt;structuring your applications&lt;/strong&gt;. On the one hand, this flexibility is great: it allows different use cases to use structures that are necessary for those use cases. On the other hand, though, it can be very confusing to the new developer. The Internet isn&amp;rsquo;t a lot of help either. There are as many opinions as there are Python blogs!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Walk through a dependable &lt;strong&gt;Python application layout reference guide&lt;/strong&gt; that you can refer to for most use cases&lt;/li&gt;
&lt;li&gt;See examples of common Python application structures, including &lt;strong&gt;command-line applications&lt;/strong&gt; (CLI apps), one-off &lt;strong&gt;scripts&lt;/strong&gt;, installable &lt;strong&gt;packages&lt;/strong&gt;, and web application layouts with &lt;strong&gt;popular frameworks&lt;/strong&gt; like &lt;a href=&quot;https://realpython.com/tutorials/flask/&quot;&gt;Flask&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/tutorials/django/&quot;&gt;Django&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Python pickle Module: How to Persist Objects in Python</title>
      <id>https://realpython.com/python-pickle-module/</id>
      <link href="https://realpython.com/python-pickle-module/"/>
      <updated>2020-04-27T14:00:00+00:00</updated>
      <summary>In this tutorial, 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;div&gt;&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 tutorial, you’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;p&gt;Let’s get pickling!&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;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;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you&#x27;ll need to take your Python skills to the next level.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;serialization-in-python&quot;&gt;Serialization in Python&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;serialization&lt;/strong&gt; process is a way to convert a data structure into a linear form that can be stored or transmitted over a network. &lt;/p&gt;
&lt;p&gt;In Python, serialization allows you to take a complex object structure and transform it into a stream of bytes that can be saved to a disk or sent over a network. You may also see this process referred to as &lt;strong&gt;marshalling&lt;/strong&gt;. The reverse process, which takes a stream of bytes and converts it back into a data structure, is called &lt;strong&gt;deserialization&lt;/strong&gt; or &lt;strong&gt;unmarshalling&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Serialization can be used in a lot of different situations. One of the most common uses is saving the state of a neural network after the training phase so that you can use it later without having to redo the training.&lt;/p&gt;
&lt;p&gt;Python offers three different modules in the standard library that allow you to serialize and deserialize objects:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;a href=&quot;https://docs.python.org/3/library/marshal.html&quot;&gt;&lt;code&gt;marshal&lt;/code&gt;&lt;/a&gt; module&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;https://docs.python.org/3/library/json.html&quot;&gt;&lt;code&gt;json&lt;/code&gt;&lt;/a&gt; module&lt;/li&gt;
&lt;li&gt;The &lt;a href=&quot;https://docs.python.org/3/library/pickle.html&quot;&gt;&lt;code&gt;pickle&lt;/code&gt;&lt;/a&gt; module&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In addition, Python supports &lt;a href=&quot;https://www.xml.com/axml/axml.html&quot;&gt;XML&lt;/a&gt;, which you can also use to serialize objects.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;marshal&lt;/code&gt; module is the oldest of the three listed above. It exists mainly to read and write the compiled bytecode of Python modules, or the &lt;code&gt;.pyc&lt;/code&gt; files you get when the interpreter imports a Python module. So, even though you can use &lt;code&gt;marshal&lt;/code&gt; to serialize some of your objects, it’s not recommended.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;json&lt;/code&gt; module is the newest of the three. It allows you to work with standard JSON files. JSON is a very convenient and widely used format for data exchange.&lt;/p&gt;
&lt;p&gt;There are several reasons to choose the &lt;a href=&quot;https://realpython.com/lessons/serializing-json-data/&quot;&gt;JSON format&lt;/a&gt;: It’s &lt;strong&gt;human readable&lt;/strong&gt; and &lt;strong&gt;language independent&lt;/strong&gt;, and it’s lighter than XML. With the &lt;code&gt;json&lt;/code&gt; module, you can serialize and deserialize several standard Python types:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/lessons/booleans/&quot;&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/dictionaries-python/&quot;&gt;&lt;code&gt;dict&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/lessons/integers/&quot;&gt;&lt;code&gt;int&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/lessons/floats/&quot;&gt;&lt;code&gt;float&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/lists-tuples-python/&quot;&gt;&lt;code&gt;list&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/python-strings/&quot;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/lists-tuples-python/&quot;&gt;&lt;code&gt;tuple&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/null-in-python/&quot;&gt;&lt;code&gt;None&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The Python &lt;code&gt;pickle&lt;/code&gt; module is another way to serialize and deserialize objects in Python. It differs from the &lt;code&gt;json&lt;/code&gt; module in that it serializes objects in a binary format, which means the result is not human readable. However, it’s also faster and it works with many more Python types right out of the box, including your custom-defined objects.&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; From now on, you’ll see the terms &lt;strong&gt;pickling&lt;/strong&gt; and &lt;strong&gt;unpickling&lt;/strong&gt; used to refer to serializing and deserializing with the Python &lt;code&gt;pickle&lt;/code&gt; module.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;So, you have several different ways to serialize and deserialize objects in Python. But which one should you use? The short answer is that there’s no one-size-fits-all solution. It all depends on your use case.&lt;/p&gt;
&lt;p&gt;Here are three general guidelines for deciding which approach to use:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Don’t use the &lt;code&gt;marshal&lt;/code&gt; module. It’s used mainly by the interpreter, and the official documentation warns that the Python maintainers may modify the format in backward-incompatible ways.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;json&lt;/code&gt; module and XML are good choices if you need interoperability with different languages or a human-readable format.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The Python &lt;code&gt;pickle&lt;/code&gt; module is a better choice for all the remaining use cases. If you don’t need a human-readable format or a standard interoperable format, or if you need to serialize custom objects, then go with &lt;code&gt;pickle&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;inside-the-python-pickle-module&quot;&gt;Inside the Python &lt;code&gt;pickle&lt;/code&gt; Module&lt;/h2&gt;
&lt;p&gt;The Python &lt;code&gt;pickle&lt;/code&gt; module basically consists of four methods:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;pickle.dump(obj, file, protocol=None, *, fix_imports=True, buffer_callback=None)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pickle.dumps(obj, protocol=None, *, fix_imports=True, buffer_callback=None)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pickle.load(file, *, fix_imports=True, encoding=&quot;ASCII&quot;, errors=&quot;strict&quot;, buffers=None)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pickle.loads(bytes_object, *, fix_imports=True, encoding=&quot;ASCII&quot;, errors=&quot;strict&quot;, buffers=None)&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The first two methods are used during the pickling process, and the other two are used during unpickling. The only difference between &lt;code&gt;dump()&lt;/code&gt; and &lt;code&gt;dumps()&lt;/code&gt; is that the first creates a file containing the serialization result, whereas the second returns a string.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-pickle-module/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-pickle-module/ »&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 #6: Python REST APIs and The Well-Grounded Python Developer</title>
      <id>https://realpython.com/podcasts/rpp/6/</id>
      <link href="https://realpython.com/podcasts/rpp/6/"/>
      <updated>2020-04-24T12:00:00+00:00</updated>
      <summary>Are you interested in building REST APIs with Flask and SQLAlchemy? This week we have Doug Farrell on the show. We talk about his four-part Real Python article series on Python REST APIs.</summary>
      <content type="html">
        &lt;p&gt;Are you interested in building REST APIs with Flask and SQLAlchemy? This week we have Doug Farrell on the show. We talk about his four-part Real Python article series on Python REST APIs.&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 Pandas DataFrame: Make Working With Data Delightful</title>
      <id>https://realpython.com/pandas-dataframe/</id>
      <link href="https://realpython.com/pandas-dataframe/"/>
      <updated>2020-04-22T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll get started with Pandas DataFrames, which are powerful and widely used two-dimensional data structures. You&#x27;ll learn how to perform basic operations with data, handle missing values, work with time-series data, and visualize data from a Pandas DataFrame.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;The &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/reference/frame.html&quot;&gt;&lt;strong&gt;Pandas DataFrame&lt;/strong&gt;&lt;/a&gt; is a &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html&quot;&gt;structure&lt;/a&gt; that contains &lt;strong&gt;two-dimensional data&lt;/strong&gt; and its corresponding &lt;strong&gt;labels&lt;/strong&gt;. DataFrames are widely used in &lt;a href=&quot;https://realpython.com/tutorials/data-science/&quot;&gt;data science&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/tutorials/machine-learning/&quot;&gt;machine learning&lt;/a&gt;, scientific computing, and many other data-intensive fields.&lt;/p&gt;
&lt;p&gt;DataFrames are similar to SQL tables or the spreadsheets that you work with in Excel or Calc. In many cases, DataFrames are faster, easier to use, and more powerful than tables or spreadsheets because they’re an integral part of the &lt;a href=&quot;https://www.python.org/about/&quot;&gt;Python&lt;/a&gt; and &lt;a href=&quot;https://numpy.org/#&quot;&gt;NumPy&lt;/a&gt; ecosystems.&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 a &lt;strong&gt;Pandas DataFrame&lt;/strong&gt; is and how to create one&lt;/li&gt;
&lt;li&gt;How to &lt;strong&gt;access, modify, add, sort, filter, and delete&lt;/strong&gt; data&lt;/li&gt;
&lt;li&gt;How to handle &lt;strong&gt;missing values&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to work with &lt;strong&gt;time-series data&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to quickly &lt;strong&gt;visualize&lt;/strong&gt; data&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It’s time to get started with Pandas DataFrames!&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;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;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you&#x27;ll need to take your Python skills to the next level.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;introducing-the-pandas-dataframe&quot;&gt;Introducing the Pandas DataFrame&lt;/h2&gt;
&lt;p&gt;Pandas DataFrames are data structures that contain:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Data&lt;/strong&gt; organized in &lt;strong&gt;two dimensions&lt;/strong&gt;, rows and columns&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Labels&lt;/strong&gt; that correspond to the &lt;strong&gt;rows&lt;/strong&gt; and &lt;strong&gt;columns&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can start working with DataFrames by &lt;a href=&quot;https://realpython.com/courses/python-imports-101/&quot;&gt;importing&lt;/a&gt; Pandas:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pandas&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now that you have Pandas imported, you can work with DataFrames.&lt;/p&gt;
&lt;p&gt;Imagine you’re using Pandas to analyze data about job candidates for a position developing &lt;a href=&quot;https://realpython.com/tutorials/web-dev/&quot;&gt;web applications with Python&lt;/a&gt;. Say you’re interested in the candidates’ names, cities, ages, and scores on a Python programming test, or &lt;code&gt;py-score&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;table-responsive&quot;&gt;
&lt;table class=&quot;table table-hover&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;name&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;city&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;age&lt;/code&gt;&lt;/th&gt;
&lt;th&gt;&lt;code&gt;py-score&lt;/code&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;101&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Xavier&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Mexico City&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;41&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;88.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;102&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Ann&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Toronto&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;28&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;79.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;103&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Jana&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Prague&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;33&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;81.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;104&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Yi&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Shanghai&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;34&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;80.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;105&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Robin&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Manchester&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;38&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;68.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;106&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Amal&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Cairo&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;31&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;61.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;107&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Nori&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Osaka&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;37&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;84.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;In this table, the first row contains the &lt;strong&gt;column labels&lt;/strong&gt; (&lt;code&gt;name&lt;/code&gt;, &lt;code&gt;city&lt;/code&gt;, &lt;code&gt;age&lt;/code&gt;, and &lt;code&gt;py-score&lt;/code&gt;). The first column holds the &lt;strong&gt;row labels&lt;/strong&gt; (&lt;code&gt;101&lt;/code&gt;, &lt;code&gt;102&lt;/code&gt;, and so on). All other cells are filled with the &lt;strong&gt;data values&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;Now you have everything you need to create a Pandas DataFrame.&lt;/p&gt;
&lt;p&gt;There are several ways to create a Pandas DataFrame. In most cases, you’ll use the &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html&quot;&gt;&lt;code&gt;DataFrame&lt;/code&gt; constructor&lt;/a&gt; and provide the data, labels, and other information. You can pass the data as a two-dimensional &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;list, tuple,&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/numpy-array-programming/&quot;&gt;NumPy array&lt;/a&gt;. You can also pass it as a &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt; or &lt;a href=&quot;https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html#series&quot;&gt;Pandas &lt;code&gt;Series&lt;/code&gt;&lt;/a&gt; instance, or as one of several other data types not covered in this tutorial.&lt;/p&gt;
&lt;p&gt;For this example, assume you’re using a &lt;a href=&quot;https://docs.python.org/3/tutorial/datastructures.html#dictionaries&quot;&gt;dictionary&lt;/a&gt; to pass the data:&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;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;s1&quot;&gt;&#x27;name&#x27;&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;s1&quot;&gt;&#x27;Xavier&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;Ann&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;Jana&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;Yi&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;Robin&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;Amal&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;Nori&#x27;&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;s1&quot;&gt;&#x27;city&#x27;&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;s1&quot;&gt;&#x27;Mexico City&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;Toronto&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;Prague&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;Shanghai&#x27;&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;s1&quot;&gt;&#x27;Manchester&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;Cairo&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&#x27;Osaka&#x27;&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;s1&quot;&gt;&#x27;age&#x27;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;41&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;33&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;38&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;31&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;37&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;s1&quot;&gt;&#x27;py-score&#x27;&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;mf&quot;&gt;88.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;79.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;81.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;80.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;68.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;61.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;84.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;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;row_labels&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;101&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;102&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;103&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;104&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;105&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;106&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;107&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;&lt;code&gt;data&lt;/code&gt; is a &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;Python variable&lt;/a&gt; that refers to the dictionary that holds your candidate data. It also contains the labels of the columns: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&#x27;name&#x27;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&#x27;city&#x27;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&#x27;age&#x27;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&#x27;py-score&#x27;&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Finally, &lt;code&gt;row_labels&lt;/code&gt; refers to a list that contains the labels of the rows, which are numbers ranging from &lt;code&gt;101&lt;/code&gt; to &lt;code&gt;107&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now you’re ready to create a Pandas DataFrame:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DataFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row_labels&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;df&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;       name         city  age  py-score&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;101  Xavier  Mexico City   41      88.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;102     Ann      Toronto   28      79.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;103    Jana       Prague   33      81.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;104      Yi     Shanghai   34      80.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;105   Robin   Manchester   38      68.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;106    Amal        Cairo   31      61.0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;107    Nori        Osaka   37      84.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;That’s it! &lt;code&gt;df&lt;/code&gt; is a variable that holds the reference to your Pandas DataFrame. This Pandas DataFrame looks just like the candidate table above and has the following features:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/pandas-dataframe/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/pandas-dataframe/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python Coding Interviews: Tips &amp; Best Practices</title>
      <id>https://realpython.com/courses/python-coding-interviews-tips-best-practices/</id>
      <link href="https://realpython.com/courses/python-coding-interviews-tips-best-practices/"/>
      <updated>2020-04-21T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn how to take your Python coding interview skills to the next level and use Python&#x27;s built-in functions and modules to solve problems faster and more easily.</summary>
      <content type="html">
        &lt;p&gt;You&amp;rsquo;ve made it past the phone call with the recruiter, and now it&amp;rsquo;s time to show that you know how to solve problems with actual code. Whether it&amp;rsquo;s a HackerRank exercise, a take-home assignment, or an onsite whiteboard interview, this is your moment to prove your &lt;strong&gt;coding interview&lt;/strong&gt; skills.&lt;/p&gt;
&lt;p&gt;But interviews aren&amp;rsquo;t just about solving problems: they&amp;rsquo;re also about showing that you can write &lt;strong&gt;clean production code&lt;/strong&gt;. This means that you have a deep knowledge of &lt;strong&gt;Python&amp;rsquo;s built-in functionality and libraries&lt;/strong&gt;. This knowledge shows companies that you can move quickly and won&amp;rsquo;t duplicate functionality that comes with the language just because you don&amp;rsquo;t know it exists.&lt;/p&gt;
&lt;p&gt;At &lt;em&gt;Real Python&lt;/em&gt;, we&amp;rsquo;ve put our heads together and discussed what tools we&amp;rsquo;re always impressed to see in coding interviews. This course will walk you through the best of that functionality, starting with Python built-ins, then Python&amp;rsquo;s native support for &lt;strong&gt;data structures&lt;/strong&gt;, and finally Python&amp;rsquo;s powerful (and often underappreciated) &lt;strong&gt;standard library&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;&lt;code&gt;enumerate()&lt;/code&gt;&lt;/strong&gt; to iterate over both indices and values&lt;/li&gt;
&lt;li&gt;Debug problematic code with &lt;strong&gt;&lt;code&gt;breakpoint()&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Format strings effectively with &lt;strong&gt;f-strings&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Sort lists with &lt;strong&gt;custom arguments&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;generators&lt;/strong&gt; instead of list comprehensions to conserve memory&lt;/li&gt;
&lt;li&gt;Define &lt;strong&gt;default values&lt;/strong&gt; when looking up dictionary keys&lt;/li&gt;
&lt;li&gt;Count hashable objects with the &lt;strong&gt;&lt;code&gt;collections.Counter&lt;/code&gt;&lt;/strong&gt; class&lt;/li&gt;
&lt;li&gt;Use the standard library to get lists of &lt;strong&gt;permutations and combinations&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>Effective Python Testing With Pytest</title>
      <id>https://realpython.com/pytest-python-testing/</id>
      <link href="https://realpython.com/pytest-python-testing/"/>
      <updated>2020-04-20T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to take your testing to the next level with pytest. You&#x27;ll cover intermediate and advanced pytest features such as fixtures, marks, parameters, and plugins. With pytest, you can make your test suites fast, effective, and less painful to maintain.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;a href=&quot;https://realpython.com/python-testing/&quot;&gt;Testing your code&lt;/a&gt; brings a wide variety of benefits. It increases your confidence that the code behaves as you expect and ensures that changes to your code won’t cause regressions. Writing and maintaining tests is hard work, so you should leverage all the tools at your disposal to make it as painless as possible. &lt;a href=&quot;https://docs.pytest.org/&quot;&gt;&lt;code&gt;pytest&lt;/code&gt;&lt;/a&gt; is one of the best tools you can use to boost your testing productivity.&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;benefits&lt;/strong&gt; &lt;code&gt;pytest&lt;/code&gt; offers&lt;/li&gt;
&lt;li&gt;How to ensure your tests are &lt;strong&gt;stateless&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to make repetitious tests more &lt;strong&gt;comprehensible&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to run &lt;strong&gt;subsets&lt;/strong&gt; of tests by name or custom groups&lt;/li&gt;
&lt;li&gt;How to create and maintain &lt;strong&gt;reusable&lt;/strong&gt; testing utilities&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;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;&gt;5 Thoughts On Python Mastery&lt;/a&gt;, a free course for Python developers that shows you the roadmap and the mindset you&#x27;ll need to take your Python skills to the next level.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;how-to-install-pytest&quot;&gt;How to Install &lt;code&gt;pytest&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;To follow along with some of the examples in this tutorial, you’ll need to install &lt;code&gt;pytest&lt;/code&gt;. As with most Python packages, you can install &lt;code&gt;pytest&lt;/code&gt; in a &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt; from &lt;a href=&quot;https://realpython.com/pypi-publish-python-package/&quot;&gt;PyPI&lt;/a&gt; using &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; python -m pip install pytest
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;pytest&lt;/code&gt; command will now be available in your installation environment.&lt;/p&gt;
&lt;h2 id=&quot;what-makes-pytest-so-useful&quot;&gt;What Makes &lt;code&gt;pytest&lt;/code&gt; So Useful?&lt;/h2&gt;
&lt;p&gt;If you’ve written unit tests for your Python code before, then you may have used Python’s built-in &lt;strong&gt;&lt;code&gt;unittest&lt;/code&gt;&lt;/strong&gt; module. &lt;code&gt;unittest&lt;/code&gt; provides a solid base on which to build your test suite, but it has a few shortcomings. &lt;/p&gt;
&lt;p&gt;A number of third-party testing frameworks attempt to address some of the issues with &lt;code&gt;unittest&lt;/code&gt;, and &lt;a href=&quot;https://realpython.com/courses/test-driven-development-pytest/&quot;&gt;&lt;code&gt;pytest&lt;/code&gt; has proven to be one of the most popular&lt;/a&gt;. &lt;code&gt;pytest&lt;/code&gt; is a feature-rich, plugin-based ecosystem for testing your Python code.&lt;/p&gt;
&lt;p&gt;If you haven’t had the pleasure of using &lt;code&gt;pytest&lt;/code&gt; yet, then you’re in for a treat! Its philosophy and features will make your testing experience more productive and enjoyable. With &lt;code&gt;pytest&lt;/code&gt;, common tasks require less code and advanced tasks can be achieved through a variety of time-saving commands and plugins. It will even run your existing tests out of the box, including those written with &lt;code&gt;unittest&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;As with most frameworks, some development patterns that make sense when you first start using &lt;code&gt;pytest&lt;/code&gt; can start causing pains as your test suite grows. This tutorial will help you understand some of the tools &lt;code&gt;pytest&lt;/code&gt; provides to keep your testing efficient and effective even as it scales.&lt;/p&gt;
&lt;h3 id=&quot;less-boilerplate&quot;&gt;Less Boilerplate&lt;/h3&gt;
&lt;p&gt;Most functional tests follow the Arrange-Act-Assert model:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Arrange&lt;/strong&gt;, or set up, the conditions for the test&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Act&lt;/strong&gt; by calling some function or method&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Assert&lt;/strong&gt; that some end condition is true&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Testing frameworks typically hook into your test’s &lt;a href=&quot;https://realpython.com/lessons/assertions-and-tryexcept/&quot;&gt;assertions&lt;/a&gt; so that they can provide information when an assertion fails. &lt;code&gt;unittest&lt;/code&gt;, for example, provides a number of helpful assertion utilities out of the box. However, even a small set of tests requires a fair amount of &lt;a href=&quot;https://en.wikipedia.org/wiki/Boilerplate_code&quot;&gt;boilerplate code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Imagine you’d like to write a test suite just to make sure &lt;code&gt;unittest&lt;/code&gt; is working properly in your project. You might want to write one test that always passes and one that always fails:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# test_with_unittest.py&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;unittest&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TestCase&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TryTesting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TestCase&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;test_always_passes&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;assertTrue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;test_always_fails&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;assertTrue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You can then run those tests from the command line using the &lt;code&gt;discover&lt;/code&gt; option of &lt;code&gt;unittest&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight sh&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt; python -m unittest discover
&lt;span class=&quot;go&quot;&gt;F.&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;============================================================&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;FAIL: test_always_fails (test_with_unittest.TryTesting)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;------------------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;  File &quot;/.../test_with_unittest.py&quot;, line 9, in test_always_fails&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;    self.assertTrue(False)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;AssertionError: False is not True&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;------------------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Ran 2 tests in 0.001s&lt;/span&gt;

&lt;span class=&quot;go&quot;&gt;FAILED (failures=1)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As expected, one test passed and one failed. You’ve proven that &lt;code&gt;unittest&lt;/code&gt; is working, but look at what you had to do:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Import the &lt;code&gt;TestCase&lt;/code&gt; class from &lt;code&gt;unittest&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Create &lt;code&gt;TryTesting&lt;/code&gt;, a &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;subclass&lt;/a&gt; of &lt;code&gt;TestCase&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Write a method in &lt;code&gt;TryTesting&lt;/code&gt; for each test&lt;/li&gt;
&lt;li&gt;Use one of the &lt;code&gt;self.assert*&lt;/code&gt; methods from &lt;code&gt;unittest.TestCase&lt;/code&gt; to make assertions&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That’s a significant amount of code to write, and because it’s the minimum you need for &lt;em&gt;any&lt;/em&gt; test, you’d end up writing the same code over and over. &lt;code&gt;pytest&lt;/code&gt; simplifies this workflow by allowing you to use Python’s &lt;code&gt;assert&lt;/code&gt; keyword directly:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# test_with_pytest.py&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;test_always_passes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;True&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;test_always_fails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;assert&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;False&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/pytest-python-testing/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/pytest-python-testing/ »&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 #5: Exploring CircuitPython</title>
      <id>https://realpython.com/podcasts/rpp/5/</id>
      <link href="https://realpython.com/podcasts/rpp/5/"/>
      <updated>2020-04-17T12:00:00+00:00</updated>
      <summary>Have you ever wanted to explore using Python with electronics? CircuitPython is a great platform to get started with. This week we have Thea Flowers on the show. Thea has been creating several hardware projects based around CircuitPython, and she talks about getting started on the platform.</summary>
      <content type="html">
        &lt;p&gt;Have you ever wanted to explore using Python with electronics? CircuitPython is a great platform to get started with. This week we have Thea Flowers on the show. Thea has been creating several hardware projects based around CircuitPython, and she talks about getting started on the platform.&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>Sorting Algorithms in Python</title>
      <id>https://realpython.com/sorting-algorithms-python/</id>
      <link href="https://realpython.com/sorting-algorithms-python/"/>
      <updated>2020-04-15T14:00:00+00:00</updated>
      <summary>In this tutorial, 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;div&gt;&lt;p&gt;&lt;strong&gt;Sorting&lt;/strong&gt; is a basic building block that many other algorithms are built upon. It’s related to several exciting ideas that you’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 tutorial, you’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’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;How to measure the efficiency of an algorithm using &lt;strong&gt;Big O notation&lt;/strong&gt; and &lt;strong&gt;Python’s &lt;code&gt;timeit&lt;/code&gt; module&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By the end of this tutorial, you’ll understand sorting algorithms from both a theoretical and a practical standpoint. More importantly, you’ll have a deeper understanding of different algorithm design techniques that you can apply to other areas of your work. Let’s get started!&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;https://realpython.com/bonus/python-tricks-sample/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-tricks-sample&quot; data-focus=&quot;false&quot;&gt;Click here to get access to a chapter from Python Tricks: The Book&lt;/a&gt; that shows you Python&#x27;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;the-importance-of-sorting-algorithms-in-python&quot;&gt;The Importance of Sorting Algorithms in Python&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://docs.python.org/3/howto/sorting.html&quot;&gt;Sorting&lt;/a&gt; is one of the most thoroughly studied algorithms in computer science. There are dozens of different sorting implementations and applications that you can use to make your code more efficient and effective.&lt;/p&gt;
&lt;p&gt;You can use sorting to solve a wide range of problems:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Searching:&lt;/strong&gt; Searching for an item on a list works much faster if the list is sorted.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Selection:&lt;/strong&gt; Selecting items from a list based on their relationship to the rest of the items is easier with sorted data. For example, finding the &lt;em&gt;k&lt;sup&gt;th&lt;/sup&gt;&lt;/em&gt;-largest or smallest value, or finding the median value of the list, is much easier when the values are in ascending or descending order.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Duplicates:&lt;/strong&gt; Finding duplicate values on a list can be done very quickly when the list is sorted.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Distribution:&lt;/strong&gt; Analyzing the frequency distribution of items on a list is very fast if the list is sorted. For example, finding the element that appears most or least often is relatively straightforward with a sorted list.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;From commercial applications to academic research and everywhere in between, there are countless ways you can use sorting to save yourself time and effort.&lt;/p&gt;
&lt;h2 id=&quot;pythons-built-in-sorting-algorithm&quot;&gt;Python’s Built-In Sorting Algorithm&lt;/h2&gt;
&lt;p&gt;The Python language, like many other high-level programming languages, offers the ability to sort data out of the box using &lt;code&gt;sorted()&lt;/code&gt;. Here’s an example of sorting an integer array:&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;array&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;8&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;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sorted&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[2, 4, 5, 6, 8]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You can use &lt;code&gt;sorted()&lt;/code&gt; to sort any list as long as the values inside are comparable.&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 deeper dive into how Python’s built-in sorting functionality works, check out &lt;a href=&quot;https://realpython.com/python-sort/&quot;&gt;How to Use sorted() and sort() in Python&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/courses/python-sorting-data/&quot;&gt;Sorting Data With Python&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;the-significance-of-time-complexity&quot;&gt;The Significance of Time Complexity&lt;/h2&gt;
&lt;p&gt;This tutorial covers two different ways to measure the &lt;strong&gt;runtime&lt;/strong&gt; of sorting algorithms:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;For a practical point of view, you’ll measure the runtime of the implementations using the &lt;code&gt;timeit&lt;/code&gt; module.&lt;/li&gt;
&lt;li&gt;For a more theoretical perspective, you’ll measure the &lt;strong&gt;runtime complexity&lt;/strong&gt; of the algorithms using &lt;a href=&quot;https://en.wikipedia.org/wiki/Big_O_notation&quot;&gt;&lt;strong&gt;Big O notation&lt;/strong&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;timing-your-code&quot;&gt;Timing Your Code&lt;/h3&gt;
&lt;p&gt;When comparing two sorting algorithms in Python, it’s always informative to look at how long each one takes to run. The specific time each algorithm takes will be partly determined by your hardware, but you can still use the proportional time between executions to help you decide which implementation is more time efficient. &lt;/p&gt;
&lt;p&gt;In this section, you’ll focus on a practical way to measure the actual time it takes to run to your sorting algorithms using the &lt;code&gt;timeit&lt;/code&gt; module. For more information on the different ways you can time the execution of code in Python, check out &lt;a href=&quot;https://realpython.com/python-timer/&quot;&gt;Python Timer Functions: Three Ways to Monitor Your Code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here’s a function you can use to time your algorithms:&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;lineno&quot;&gt; 1 &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;random&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;randint&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 2 &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;timeit&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repeat&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 3 &lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 4 &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;run_sorting_algorithm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;algorithm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 5 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# Set up the context and prepare the call to the specified&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 6 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# algorithm using the supplied array. Only import the&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 7 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# algorithm function if it&#x27;s not the built-in `sorted()`.&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt; 8 &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;setup_code&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;from __main__ import &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;algorithm&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;lineno&quot;&gt; 9 &lt;/span&gt;        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;algorithm&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;sorted&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;10 &lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;11 &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;stmt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;algorithm&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;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;array&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;lineno&quot;&gt;12 &lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;13 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# Execute the code ten different times and return the time&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;14 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# in seconds that each execution took&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;15 &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repeat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setup_code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;stmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stmt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;repeat&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;16 &lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;17 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# Finally, display the name of the algorithm and the&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;18 &lt;/span&gt;    &lt;span class=&quot;c1&quot;&gt;# minimum time it took to run&lt;/span&gt;
&lt;span class=&quot;lineno&quot;&gt;19 &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Algorithm: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;algorithm&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;. Minimum execution time: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;times&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&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;In this example, &lt;code&gt;run_sorting_algorithm()&lt;/code&gt; receives the name of the algorithm and the input array that needs to be sorted. Here’s a line-by-line explanation of how it works: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Line 8&lt;/strong&gt; imports the name of the algorithm using the magic of &lt;a href=&quot;https://realpython.com/python-f-strings/&quot;&gt;Python’s f-strings&lt;/a&gt;. This is so that &lt;code&gt;timeit.repeat()&lt;/code&gt; knows where to call the algorithm from. Note that this is only necessary for the custom implementations used in this tutorial. If the algorithm specified is the built-in &lt;code&gt;sorted()&lt;/code&gt;, then nothing will be imported.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Line 11&lt;/strong&gt; prepares the call to the algorithm with the supplied array. This is the statement that will be executed and timed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Line 15&lt;/strong&gt; calls &lt;code&gt;timeit.repeat()&lt;/code&gt; with the setup code and the statement. This will call the specified sorting algorithm ten times, returning the number of seconds each one of these executions took.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Line 19&lt;/strong&gt; identifies the shortest time returned and prints it along with the name of the algorithm.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/sorting-algorithms-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/sorting-algorithms-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>Inheritance and Composition: A Python OOP Guide</title>
      <id>https://realpython.com/courses/inheritance-composition-python/</id>
      <link href="https://realpython.com/courses/inheritance-composition-python/"/>
      <updated>2020-04-14T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn about inheritance and composition in Python. You&#x27;ll improve your object-oriented programming (OOP) skills by understanding how to use inheritance and composition and how to leverage them in their design.</summary>
      <content type="html">
        &lt;p&gt;In this course, you&amp;rsquo;ll explore &lt;strong&gt;inheritance&lt;/strong&gt; and &lt;strong&gt;composition&lt;/strong&gt; in Python. &lt;a href=&quot;https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)&quot;&gt;Inheritance&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Object_composition&quot;&gt;composition&lt;/a&gt; are two important concepts in object oriented programming that model the relationship between two classes. They are the building blocks of &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object oriented design&lt;/a&gt;, and they help programmers to write reusable code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll know how to&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use inheritance in Python&lt;/li&gt;
&lt;li&gt;Model class hierarchies using inheritance&lt;/li&gt;
&lt;li&gt;Use multiple inheritance in Python and understand its drawbacks&lt;/li&gt;
&lt;li&gt;Use composition to create complex objects&lt;/li&gt;
&lt;li&gt;Reuse existing code by applying composition&lt;/li&gt;
&lt;li&gt;Change application behavior at run-time through composition&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 #4: Learning Python Through Errors</title>
      <id>https://realpython.com/podcasts/rpp/4/</id>
      <link href="https://realpython.com/podcasts/rpp/4/"/>
      <updated>2020-04-10T12:00:00+00:00</updated>
      <summary>Do you get upset and frustrated when you experience errors running your Python code? This week we have Martin Breuss on the show. We discuss how to learn Python *through* errors, and how errors really are your friends.</summary>
      <content type="html">
        &lt;p&gt;Do you get upset and frustrated when you experience errors running your Python code? This week we have Martin Breuss on the show. We discuss how to learn Python *through* errors, and how errors really are your friends.&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>Arduino With Python: How to Get Started</title>
      <id>https://realpython.com/courses/arduino-python/</id>
      <link href="https://realpython.com/courses/arduino-python/"/>
      <updated>2020-04-07T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll discover how to use Arduino microcontrollers with Python to develop your own electronic projects. You&#x27;ll learn how to set up circuits and write applications with the Firmata protocol. You&#x27;ll control Arduino inputs and outputs and integrate the board with higher-level apps.</summary>
      <content type="html">
        &lt;p&gt;&lt;a href=&quot;http://www.circuitstoday.com/microcontroller-invention-history&quot;&gt;Microcontrollers&lt;/a&gt; have been around for a long time, and they&amp;rsquo;re used in everything from complex machinery to common household appliances. However, working with them has traditionally been reserved for those with formal technical training, such as technicians and electrical engineers.&lt;/p&gt;
&lt;p&gt;The emergence of &lt;strong&gt;Arduino&lt;/strong&gt; has made electronic application design much more accessible to all developers. In this course, you&amp;rsquo;ll discover how to use Arduino with Python to develop your own electronic projects.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;You&amp;rsquo;ll cover the basics of Arduino with Python and learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up electronic circuits&lt;/li&gt;
&lt;li&gt;Set up the Firmata protocol on Arduino&lt;/li&gt;
&lt;li&gt;Write basic applications for Arduino in Python&lt;/li&gt;
&lt;li&gt;Control analog and digital inputs and outputs&lt;/li&gt;
&lt;li&gt;Integrate Arduino sensors and switches with higher-level apps&lt;/li&gt;
&lt;li&gt;Trigger notifications on your PC and send emails using Arduino&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 #3: Effective Python and Python at Google Scale</title>
      <id>https://realpython.com/podcasts/rpp/3/</id>
      <link href="https://realpython.com/podcasts/rpp/3/"/>
      <updated>2020-04-03T12:00:00+00:00</updated>
      <summary>Have you been using Python for a while, but want to be more effective with your code?  This week we have Brett Slatkin on the show. We talk about the 2nd edition of his book Effective Python.</summary>
      <content type="html">
        &lt;p&gt;Have you been using Python for a while, but want to be more effective with your code?  This week we have Brett Slatkin on the show. We talk about the 2nd edition of his book Effective Python.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Comparing Python Objects the Right Way: &quot;is&quot; vs &quot;==&quot;</title>
      <id>https://realpython.com/courses/python-is-identity-vs-equality/</id>
      <link href="https://realpython.com/courses/python-is-identity-vs-equality/"/>
      <updated>2020-03-31T14:00:00+00:00</updated>
      <summary>In this quick and practical course, you&#x27;ll learn when to use the Python is, is not, == and != operators. You&#x27;ll see what these comparison operators do under the hood, dive into some quirks of object identity and interning, and define a custom class.</summary>
      <content type="html">
        &lt;p&gt;There&amp;rsquo;s a subtle difference between the Python identity operator (&lt;code&gt;is&lt;/code&gt;) and the equality operator (&lt;code&gt;==&lt;/code&gt;). Your code can run fine when you use the Python &lt;strong&gt;&lt;code&gt;is&lt;/code&gt; operator&lt;/strong&gt; to compare numbers, until it suddenly &lt;a href=&quot;https://medium.com/peloton-engineering/the-dangers-of-using-is-in-python-f42941124027&quot;&gt;doesn&amp;rsquo;t&lt;/a&gt;. You might have heard somewhere that the Python &lt;code&gt;is&lt;/code&gt; operator is faster than the &lt;strong&gt;&lt;code&gt;==&lt;/code&gt; operator&lt;/strong&gt;, or you may feel that it looks more &lt;a href=&quot;https://realpython.com/tutorials/best-practices/&quot;&gt;Pythonic&lt;/a&gt;. However, it&amp;rsquo;s crucial to keep in mind that these operators don&amp;rsquo;t behave quite the same.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;==&lt;/code&gt; operator compares the value or &lt;strong&gt;equality&lt;/strong&gt; of two objects, whereas the Python &lt;code&gt;is&lt;/code&gt; operator checks whether two variables point to the same object in memory. In the vast majority of cases, this means you should use the equality operators &lt;code&gt;==&lt;/code&gt; and &lt;code&gt;!=&lt;/code&gt;, except when you&amp;rsquo;re comparing to &lt;code&gt;None&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course, you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What the difference is between &lt;strong&gt;object equality and identity&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;When to use equality and identity operators to &lt;strong&gt;compare objects&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What these &lt;strong&gt;Python operators&lt;/strong&gt; do under the hood&lt;/li&gt;
&lt;li&gt;Why using &lt;code&gt;is&lt;/code&gt; and &lt;code&gt;is not&lt;/code&gt; to compare values leads to &lt;strong&gt;unexpected behavior&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to write a &lt;strong&gt;custom &lt;code&gt;__eq__()&lt;/code&gt; class method&lt;/strong&gt; to define equality operator behavior&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 #2: Learn Python Skills While Creating Games</title>
      <id>https://realpython.com/podcasts/rpp/2/</id>
      <link href="https://realpython.com/podcasts/rpp/2/"/>
      <updated>2020-03-27T12:00:00+00:00</updated>
      <summary>Is game programming a good way to develop your Python programming skills? This week we have Jon Fincher on the show. Jon is an author on the Real Python team, and we talk about his recent articles on PyGame and Arcade.</summary>
      <content type="html">
        &lt;p&gt;Is game programming a good way to develop your Python programming skills? This week we have Jon Fincher on the show. Jon is an author on the Real Python team, and we talk about his recent articles on PyGame and Arcade.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using NumPy&#x27;s np.arange() Effectively</title>
      <id>https://realpython.com/courses/numpy-arange/</id>
      <link href="https://realpython.com/courses/numpy-arange/"/>
      <updated>2020-03-24T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn how to use the NumPy arange() function, which is one of the routines for array creation based on numerical ranges. np.arange() returns arrays with evenly spaced values</summary>
      <content type="html">
        &lt;p&gt;&lt;strong&gt;NumPy&lt;/strong&gt; is the fundamental Python library for numerical computing. Its most important type is an &lt;strong&gt;array type&lt;/strong&gt; called &lt;code&gt;ndarray&lt;/code&gt;. NumPy offers a lot of &lt;a href=&quot;https://docs.scipy.org/doc/numpy/reference/routines.array-creation.html&quot;&gt;array creation routines&lt;/a&gt; for different circumstances. &lt;strong&gt;&lt;code&gt;arange()&lt;/code&gt;&lt;/strong&gt; is one such function based on &lt;strong&gt;numerical ranges&lt;/strong&gt;. It&amp;rsquo;s often referred to as &lt;code&gt;np.arange()&lt;/code&gt; because &lt;code&gt;np&lt;/code&gt; is a widely used abbreviation for NumPy.&lt;/p&gt;
&lt;p&gt;Creating NumPy arrays is important when you&amp;rsquo;re working with other Python libraries that rely on them, like SciPy, Pandas, Matplotlib, scikit-learn, and more. NumPy is suitable for creating and working with arrays because it offers &lt;a href=&quot;https://docs.scipy.org/doc/numpy/reference/routines.html&quot;&gt;useful routines&lt;/a&gt;, enables &lt;a href=&quot;https://realpython.com/numpy-tensorflow-performance/&quot;&gt;performance boosts&lt;/a&gt;, and allows you to write &lt;a href=&quot;https://realpython.com/numpy-array-programming/&quot;&gt;concise code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll know:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What &lt;code&gt;np.arange()&lt;/code&gt; is&lt;/li&gt;
&lt;li&gt;How to use &lt;code&gt;np.arange()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;How &lt;code&gt;np.arange()&lt;/code&gt; compares to the Python built-in class &lt;a href=&quot;https://realpython.com/python-range/&quot;&gt;&lt;code&gt;range&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Which routines are similar to &lt;code&gt;np.arange()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let&amp;rsquo;s see &lt;strong&gt;&lt;code&gt;np.arange()&lt;/code&gt;&lt;/strong&gt; in action!&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #1: Python Decorators and Writing for Real Python</title>
      <id>https://realpython.com/podcasts/rpp/1/</id>
      <link href="https://realpython.com/podcasts/rpp/1/"/>
      <updated>2020-03-20T14:00:00+00:00</updated>
      <summary>Do you want to learn more about Python decorators? Have you ever wondered what goes on behind the scenes to create a Real Python article? In this first episode, We have Geir Arne Hjelle from the Real Python team on the show.</summary>
      <content type="html">
        &lt;p&gt;Do you want to learn more about Python decorators? Have you ever wondered what goes on behind the scenes to create a Real Python article? In this first episode, We have Geir Arne Hjelle from the Real Python team on the show.&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>Make a 2D Side-Scroller Game With PyGame</title>
      <id>https://realpython.com/courses/pygame-primer/</id>
      <link href="https://realpython.com/courses/pygame-primer/"/>
      <updated>2020-03-17T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn how to use PyGame. This library allows you to create games and rich multimedia programs in Python. You&#x27;ll learn how to draw items on your screen, implement collision detection, handle user input, and much more!</summary>
      <content type="html">
        &lt;p&gt;In this course, you&amp;rsquo;ll learn about creating games using Python and the library &lt;strong&gt;PyGame&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll be able to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Draw items on your screen&lt;/li&gt;
&lt;li&gt;Play sound effects and music&lt;/li&gt;
&lt;li&gt;Handle user input&lt;/li&gt;
&lt;li&gt;Implement event loops&lt;/li&gt;
&lt;li&gt;Describe how game programming differs from standard procedural Python programming&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This primer assumes you have a &lt;a href=&quot;https://realpython.com/learning-paths/python3-introduction/&quot;&gt;basic understanding of writing Python programs&lt;/a&gt;, including user-defined functions, &lt;a href=&quot;https://realpython.com/courses/python-imports-101/&quot;&gt;imports&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/courses/mastering-while-loops/&quot;&gt;loops&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/courses/python-conditional-statements/&quot;&gt;conditionals&lt;/a&gt;. You should also be familiar with &lt;a href=&quot;https://realpython.com/read-write-files-python/&quot;&gt;how to open files&lt;/a&gt; on your platform. A &lt;a href=&quot;https://realpython.com/learning-paths/object-oriented-programming-oop-python/&quot;&gt;basic understanding of object-oriented Python&lt;/a&gt; is helpful as well. &lt;code&gt;pygame&lt;/code&gt; works with most versions of Python, but Python 3.6 is recommended and used throughout this article.&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>Defining Main Functions in Python</title>
      <id>https://realpython.com/courses/python-main-function/</id>
      <link href="https://realpython.com/courses/python-main-function/"/>
      <updated>2020-03-10T14:00:00+00:00</updated>
      <summary>In this step-by-step course, you&#x27;ll learn how Python main functions are used and some best practices to organize your code so it can be executed as a script and imported from another module.</summary>
      <content type="html">
        &lt;p&gt;Many programming languages have a special function that is automatically executed when an operating system starts to run a program. This function is usually called &lt;strong&gt;&lt;code&gt;main()&lt;/code&gt;&lt;/strong&gt; and must have a specific return type and arguments according to the language standard. On the other hand, the Python interpreter executes scripts starting at the top of the file, and there is no specific function that Python automatically executes.&lt;/p&gt;
&lt;p&gt;Nevertheless, having a defined starting point for the execution of a program is useful for understanding how a program works. Python programmers have come up with several conventions to define this starting point.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this course, you&amp;rsquo;ll understand:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What the special &lt;code&gt;__name__&lt;/code&gt; variable is and how Python defines it&lt;/li&gt;
&lt;li&gt;Why you would want to use a &lt;code&gt;main()&lt;/code&gt; in Python&lt;/li&gt;
&lt;li&gt;What conventions there are for defining &lt;code&gt;main()&lt;/code&gt; in Python &lt;/li&gt;
&lt;li&gt;What the best practices are for what code to put into your &lt;code&gt;main()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #0: About the Show</title>
      <id>https://realpython.com/podcasts/rpp/0/</id>
      <link href="https://realpython.com/podcasts/rpp/0/"/>
      <updated>2020-03-06T00:00:00+00:00</updated>
      <summary>A weekly Python podcast hosted by Christopher Bailey with interviews, coding tips, and conversation with guests from the Python community.</summary>
      <content type="html">
        &lt;p&gt;A weekly Python podcast hosted by Christopher Bailey with interviews, coding tips, and conversation with guests from the Python community.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  

</feed>
