<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Renan Moura</title>
    <description>The latest articles on DEV Community by Renan Moura (@renanmouraf).</description>
    <link>https://dev.to/renanmouraf</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F319546%2F3be134db-999a-4c99-ab4a-86dbf266a3d6.jpeg</url>
      <title>DEV Community: Renan Moura</title>
      <link>https://dev.to/renanmouraf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/renanmouraf"/>
    <language>en</language>
    <item>
      <title>Beware of excess of "best practices"</title>
      <dc:creator>Renan Moura</dc:creator>
      <pubDate>Thu, 20 Jan 2022 12:58:14 +0000</pubDate>
      <link>https://dev.to/renanmouraf/beware-of-excess-of-best-practices-5bed</link>
      <guid>https://dev.to/renanmouraf/beware-of-excess-of-best-practices-5bed</guid>
      <description>&lt;p&gt;Unlike other disciplines that are more rigid and regulated like Civil Engineering, Software Engineering doesn't have a set of rules to follow by law enforcement.&lt;/p&gt;

&lt;p&gt;You won't go to jail if you don't do TDD (Test-Driven Design), or even write tests for your code.&lt;/p&gt;

&lt;p&gt;Your system can work just fine if you don't follow any agile method.&lt;/p&gt;

&lt;p&gt;You could deploy your next app in a bare-metal Linux machine instead of setting up Kubernetes on a cloud provider to auto-scale your pods, and no one will complain about performance and such.&lt;/p&gt;

&lt;p&gt;We have all read Clean Code, Clean Architecture, and some other "bibles" of the software development world which tell us what are the "best practices".&lt;/p&gt;

&lt;p&gt;We have all spent hours learning about Scrum or some similar methodology to manage a software project as opposed to old-fashioned cascade-like project management because that's what works "best".&lt;/p&gt;

&lt;p&gt;We do tons of meetings, in Scrum alone we have: sprint planning, daily scrum, sprint review, and sprint retrospective.&lt;/p&gt;

&lt;p&gt;There are days when I wonder if I attend meetings for a living instead of developing software.&lt;/p&gt;

&lt;p&gt;So, what is all this rant about?&lt;/p&gt;

&lt;p&gt;It is about not following blindly the so-called "best practices".&lt;/p&gt;

&lt;p&gt;I do X because Google does, I use Y because Facebook uses it.&lt;/p&gt;

&lt;p&gt;This is a silly reason to do or use anything.&lt;/p&gt;

&lt;p&gt;If you are not working with lots of people, in a huge project, with thousands of simultaneous users, following all the "best practices" can be a drawback instead of an advantage.&lt;/p&gt;

&lt;p&gt;If you are working alone, in a small app with a handful of users, it is ok to commit directly into the main branch in your GitHub repo.&lt;/p&gt;

&lt;p&gt;If your project is not database intensive, or only has to deal with very little data, you can use an embedded H2 database stored directly in your file system and it will work more than fine.&lt;/p&gt;

&lt;p&gt;There are projects and teams where it makes sense to follow every single piece of advanced architecture and people management processes there are, but that's totally not the case for your startup of three people.&lt;/p&gt;

&lt;p&gt;It is easy to be misled by reading about the latest tech and thinking "everybody is using this", when in fact they are not.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://renanmf.com/fomo-fear-of-missing-out-as-a-developer/"&gt;FOMO (Fear Of Missing Out) as a Developer&lt;/a&gt; is real and you should be aware of this.&lt;/p&gt;

&lt;p&gt;Choose the right tech for the right context in a rational way.&lt;/p&gt;

&lt;p&gt;Choose the right project methodology for the right context in a rational way.&lt;/p&gt;

&lt;p&gt;You don't have to ditch Scrum in its entirety, you can adapt it and do only 2 of the meetings described instead of all of them.&lt;/p&gt;

&lt;p&gt;You can spawn a cheap Linux VM and deploy your app by hand instead of spending hours setting up CI/CD for something you can do manually in 2 minutes.&lt;/p&gt;

&lt;p&gt;If your app screen is a simple feature with one text field and a button (like Google's home page), React/Angular/Vue is an overkill.&lt;/p&gt;

&lt;p&gt;Learn all of those things, read the books, but use your best judgment to adapt the "best practices" to take advantage of what makes sense to your project and team, and not just because someone else said you should use it.&lt;/p&gt;

&lt;p&gt;You also can &lt;a href="https://renanmf.com/newsletter/"&gt;subscribe to my newsletter&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>python</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Learning Programming is Non-Linear</title>
      <dc:creator>Renan Moura</dc:creator>
      <pubDate>Sat, 20 Nov 2021 12:28:14 +0000</pubDate>
      <link>https://dev.to/renanmouraf/learning-programming-is-non-linear-469c</link>
      <guid>https://dev.to/renanmouraf/learning-programming-is-non-linear-469c</guid>
      <description>&lt;p&gt;Learning is by no means a linear process, even in hard sciences like Math.&lt;/p&gt;

&lt;p&gt;It is very common to see people asking in groups, Reddit, and other forum-like places "What path should I take to become a Software Developer".&lt;/p&gt;

&lt;p&gt;Unfortunately, learning programming is not linear.&lt;/p&gt;

&lt;p&gt;You will find many lists and articles giving you a path like: learn HTML, CSS, JavaScript...&lt;/p&gt;

&lt;p&gt;They are not wrong in the sense that you should learn JavaScript before React, but they don't warn you that you should not worry about mastering the previous topic before jumping to the next.&lt;/p&gt;

&lt;p&gt;Those topics are all interconnected, which means they will "click" in your head only after you have some knowledge of each topic.&lt;/p&gt;

&lt;p&gt;Learn some JavaScript and then some React.&lt;/p&gt;

&lt;p&gt;If you decide to "master" Python before trying Django, good luck, you will never get to Django.&lt;/p&gt;

&lt;p&gt;Python is a massive language, you can learn the basics very quickly, but mastering it is another matter.&lt;/p&gt;

&lt;p&gt;That is what I had in mind when I wrote &lt;a href="https://renanmf.com/python-guide-beginners/"&gt;The Python Guide for Beginners&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can learn the core of the language as fast as possible, and then move on to dive into Web Development, Data Science, or general use of Python as a programming language to automate your everyday tasks.&lt;/p&gt;

&lt;p&gt;If you choose, say, Machine Learning, you will need to understand some details of the language specifically for some tasks, but you will have enough knowledge of the basics to google yourself out of any situation.&lt;/p&gt;

&lt;p&gt;The "click" also happens as you expand your arsenal of tools.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://renanmf.com/learn-more-than-one-programming-language/"&gt;Learn More Than One Programming Language&lt;/a&gt; and some concepts that you learned in language X will make much more sense after you learn language Y.&lt;/p&gt;

&lt;p&gt;I'm challenging myself at the moment to dive more into web3, which is a new realm of software development and solutions revolving around blockchain and the crypto space.&lt;/p&gt;

&lt;p&gt;Adaptation is &lt;a href="https://renanmf.com/the-top-skill-for-a-software-developer/"&gt;The Top Skill for a Software Developer&lt;/a&gt; and you have to keep improving yourself as new opportunities arise.&lt;/p&gt;

&lt;p&gt;This means I won't waste hundreds of hours to learn Solidity or understand every single concept about Smart Contracts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://renanmf.com/the-only-way-to-learn-programming/"&gt;The Only Way To Learn Programming&lt;/a&gt; is to take action with what you know.&lt;/p&gt;

&lt;p&gt;So I will learn some things, apply them to a project and then I will be able to adapt myself to any situation that comes to me.&lt;/p&gt;

&lt;p&gt;If you wait until you are 100% prepared, you will be already too late to take the best opportunities.&lt;/p&gt;

&lt;p&gt;You also can &lt;a href="https://renanmf.com/newsletter/"&gt;subscribe to my newsletter&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>python</category>
      <category>javascript</category>
    </item>
    <item>
      <title>State of Data Science 2021: Popularity of Python</title>
      <dc:creator>Renan Moura</dc:creator>
      <pubDate>Sat, 04 Sep 2021 18:00:09 +0000</pubDate>
      <link>https://dev.to/renanmouraf/state-of-data-science-2021-popularity-of-python-4ppj</link>
      <guid>https://dev.to/renanmouraf/state-of-data-science-2021-popularity-of-python-4ppj</guid>
      <description>&lt;p&gt;Python continues to be an excellent choice if you are entering the data science field.&lt;/p&gt;

&lt;p&gt;Python still dominates and is the most popular language, particularly among younger generations.&lt;/p&gt;

&lt;p&gt;88% of students surveyed are learning Python in preparation for a data science career.&lt;/p&gt;

&lt;p&gt;63% of the respondents said they use it frequently or always.&lt;/p&gt;

&lt;p&gt;71% of educators are teaching Python.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WPeUleZK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x93qax1o7ttq0lhmo8ts.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WPeUleZK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x93qax1o7ttq0lhmo8ts.jpeg" alt="Most used programming languages"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is also interesting to notice SQL raking 2nd place right after Python.&lt;/p&gt;

&lt;p&gt;Most structured data is still in relational databases, so a good knowledge of both Python and SQL are a must to deal with data.&lt;/p&gt;

&lt;p&gt;The good news is that they are both very accessible and good to begin working with code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Comments about the other languages
&lt;/h2&gt;

&lt;p&gt;R is an alternative to Python, but I don't see any advantage in learning it if you are already in the Python path since R won't bring anything to the table that Python doesn't.&lt;/p&gt;

&lt;p&gt;Then we have JavaScript and HTML/CSS, which makes sense since your results won't live in a Word document on your computer, a good way to display them is on the web with nice interactivity.&lt;/p&gt;

&lt;p&gt;Bash/Shell are super useful, the command line is one of the most powerful tools in a coder's tool belt, not only that, but many tools that deal with data engineering like Hadoop rely heavily on the command line interfaces that can be easily automated with a nice shell script.&lt;/p&gt;

&lt;p&gt;If you are wondering why Java ranks so high in this list, Hadoop, Hive, HDFS, etc. are made in Java, for instance, and many data pipelines depend on JVM powered tools like Kafka.&lt;/p&gt;

&lt;p&gt;So while you may never touch Java as a Data Scientist, you will most probably have to deal with it as Data Engineer at some point.&lt;/p&gt;

&lt;p&gt;C/C++ ranks high due to the number of libraries coded in these languages for high performance.&lt;/p&gt;

&lt;p&gt;Python's most used Machine Learning frameworks and libraries like Pandas are implemented in C/C++ while Python just provides a nicer API to work with.&lt;/p&gt;

&lt;p&gt;The other languages (C#, TypeScript, PHP, Rust, Julia and Go), although they have their place, of course, would not be the subject of further studies from my point of view at the moment.&lt;/p&gt;

&lt;p&gt;They are used for more specific use cases or simply fall into "that's what I and my team knows best".&lt;/p&gt;

&lt;p&gt;The best contender here would be Julia to replace Python, but it still has ways to go before deserving the time and energy to learn it.&lt;/p&gt;

&lt;p&gt;Go would be the high level performant alternative to Java, but it doesn't have the ecosystem with as many tools behind it yet.&lt;/p&gt;

&lt;p&gt;So, out of this list, the ones I think will pay you the most dividends for your investment in time and effort are Python, SQL, JavaScript, HTML/CSS, Bash/Shell, and Java.&lt;/p&gt;

&lt;p&gt;These languages are more than enough to put you in any stage of a Data Science project or pipeline.&lt;/p&gt;

&lt;p&gt;You can read the full report on &lt;a href="https://www.anaconda.com/state-of-data-science-2021"&gt;State of Data Science 2021&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read this article directly on my &lt;a href="https://renanmf.com/state-of-data-science-2021-popularity-of-python/"&gt;blog&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>datascience</category>
      <category>machinelearning</category>
      <category>career</category>
    </item>
    <item>
      <title>Edge Cases are the hardest parts of a Developer's job</title>
      <dc:creator>Renan Moura</dc:creator>
      <pubDate>Sun, 29 Aug 2021 18:46:04 +0000</pubDate>
      <link>https://dev.to/renanmouraf/edge-cases-are-the-hardest-parts-of-a-developer-s-job-6h9</link>
      <guid>https://dev.to/renanmouraf/edge-cases-are-the-hardest-parts-of-a-developer-s-job-6h9</guid>
      <description>&lt;p&gt;If you are a developer with not much experience you might feel like a lot of the parts of your job are really hard.&lt;/p&gt;

&lt;p&gt;The framework doesn't behave as it should.&lt;/p&gt;

&lt;p&gt;The database is locking.&lt;/p&gt;

&lt;p&gt;The language you are using has a weird way to deal with some situations that should be simpler or easier.&lt;/p&gt;

&lt;p&gt;Maybe you are fighting to center that div on your screen.&lt;/p&gt;

&lt;p&gt;All of those problems are legitimate and can drive you crazy.&lt;/p&gt;

&lt;p&gt;But once you get past these issues and become a master of your tools and how they behave in each and every situation then, and only then, you will feel the &lt;strong&gt;hardest&lt;/strong&gt; part of a developer's job: Edge Cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I mean by edge cases?
&lt;/h2&gt;

&lt;p&gt;An edge case is a situation that you (and maybe not even your end-user) never thought would happen.&lt;/p&gt;

&lt;p&gt;You create a page where everything fits perfectly, you test it on mobile, on your computer, and on your super-sized TV, great!&lt;/p&gt;

&lt;p&gt;And then you deploy your app in production to find out how a user is having rendering issues when using Safari on an iPad and, curiously, on the same iPad, it works perfectly on Firefox, go figure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Edge Cases are the hardest parts of a Developer's job.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The previous example is quite technical, but you got the idea.&lt;/p&gt;

&lt;p&gt;The same rationale applies to any layer of your app.&lt;/p&gt;

&lt;p&gt;If you implement business logic in your backend, you have to think about all of the possible combinations that might happen and test each and every one of them for your system to work bug-free.&lt;/p&gt;

&lt;p&gt;Most problems in software arise from edge cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to identify and avoid problems with Edge Cases?
&lt;/h2&gt;

&lt;p&gt;Communication.&lt;/p&gt;

&lt;p&gt;When writing business logic, the first thing to do to catch edge cases is to talk with your users, customers, clients, or any person who understands the problem in depth.&lt;/p&gt;

&lt;p&gt;Ask as much as possible, understand the situation and think about the possible edge cases.&lt;/p&gt;

&lt;p&gt;Remember there is a distance between regular manual work and automating this work with a system.&lt;/p&gt;

&lt;p&gt;There are edge cases your users might not even notice because they are so obvious to them, but not to you or anyone else.&lt;/p&gt;

&lt;p&gt;As said by Bill Gates:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The first rule of any technology used in a business is that automation applied to an efficient operation will magnify the efficiency. The second is that automation applied to an inefficient operation will magnify the inefficiency.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Most operations are inefficient, so be careful before automating anything.&lt;/p&gt;

&lt;p&gt;The second thing to avoid falling into an Edge Case trap is simple attention to detail.&lt;/p&gt;

&lt;p&gt;Attention to detail avoids problems related to the technical part while Communication avoids problems related to business logic.&lt;/p&gt;

&lt;p&gt;Attention to detail is for when you don't test your application with all kinds of screen sizes, or all browsers, or when all the planets align in a leap year and your app crashes (who knows).&lt;/p&gt;

&lt;p&gt;So, if you ask me, how do you evolve from a junior developer to a mid-level developer?&lt;/p&gt;

&lt;p&gt;My answer is: learn how to communicate clearly and learn to develop attention to detail.&lt;/p&gt;

&lt;p&gt;After learning general technical skills, these skills are the ones required to jump to another level in your career.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>career</category>
    </item>
    <item>
      <title>String Manipulation in Python</title>
      <dc:creator>Renan Moura</dc:creator>
      <pubDate>Sat, 27 Mar 2021 20:47:53 +0000</pubDate>
      <link>https://dev.to/renanmouraf/string-manipulation-in-python-5e00</link>
      <guid>https://dev.to/renanmouraf/string-manipulation-in-python-5e00</guid>
      <description>&lt;p&gt;String manipulation is one of those activities in programming that we, as programmers, do all the time.&lt;/p&gt;

&lt;p&gt;In many programming languages, you have to do a lot of the heavy lifting by yourself.&lt;/p&gt;

&lt;p&gt;In Python, on the other hand, you have several built-in functions in the standard library to help you manipulate strings in the most different ways you can think of.&lt;/p&gt;

&lt;p&gt;In the following articles, I showcase these many features of the language regarding strings specifically along with some nice tricks.&lt;/p&gt;

&lt;p&gt;You can also download a PDF version with all of these tips and a few more tricks on &lt;a href="https://renanmf.com/python-string-manipulation-handbook/"&gt;&lt;strong&gt;Python String Manipulation Handbook&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/split-string-python/"&gt;How to Split a String in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/remove-white-spaces-string-python/"&gt;How to remove all white spaces in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/multiline-strings-python/"&gt;Multiline Strings in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/lstrip-remove-space-string-in-python/"&gt;lstrip(): removing spaces and chars from the beginning of a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/rstrip-removing-spaces-chars-end-string-python/"&gt;rstrip(): removing spaces and chars from the end of a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/strip-removing-spaces-chars-beginning-end-string-python/"&gt;strip(): removing spaces and chars from the beginning and end of a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/string-lowercase-python/"&gt;String Lowercase in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/string-uppercase-python/"&gt;String Uppercase in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/string-title-case-in-python/"&gt;String Title Case in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/string-swap-case-python/"&gt;String Swap Case in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/checking-string-empty-python/"&gt;Checking if a string is empty in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/rjust-right-justified-string-python/"&gt;rjust(): right-justified string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/ljust-left-justified-string/"&gt;ljust(): left-justified string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/isalnum-checking-alphanumeric-only-string-python/"&gt;isalnum(): checking alphanumeric only in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/isprintable-checking-printable-characters-string-python/"&gt;isprintable(): checking printable characters in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/isspace-checking-white-space-only-string-python/"&gt;isspace(): checking white space only in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/startswith-checking-string-begins-certain-value-python/"&gt;startswith(): checking if a string begins with a certain value in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/capitalize-first-character-only-to-upper-case-string-python/"&gt;capitalize(): first character only to upper case in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/isupper-checking-upper-case-only-string-python/"&gt;isupper(): checking upper case only in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/endswith-check-string-ends-with-a-certain-value-python/"&gt;endswith(): check if a string ends with a certain value in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/join-items-iterable-into-string-python/"&gt;join(): join items of an iterable into one string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/splitlines-splitting-string-line-breaks-python/"&gt;splitlines(): splitting a string at line breaks in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/islower-checking-lower-case-only-string-python/"&gt;islower(): checking lower case only in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/isnumeric-checking-numerics-only-string-python/"&gt;isnumeric(): checking numerics only in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/isdigit-checking-digits-only-string-python/"&gt;isdigit(): checking digits only in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/isdecimal-checking-decimals-only-string-python/"&gt;isdecimal(): checking decimals only in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/isalpha-checking-letters-only-string-python/"&gt;isalpha(): checking letters only in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/istitle-checking-every-word-begins-with-an-upper-case-char-string-python/"&gt;istitle(): checking if every word begins with an upper case char in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/expandtabs-number-spaces-tab-string-python/"&gt;expandtabs(): set the number of spaces for a tab in a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/center-string-python/"&gt;center(): centered string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/zfill-add-zeros-string-python/"&gt;zfill(): add zeros to a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/find-check-string-has-substring-python/"&gt;find(): check if a string has a certain substring in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/removing-prefix-or-suffix-string-python/"&gt;Removing a Prefix or a Suffix in a String in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/python-lstrip-vs-removeprefix-and-rstrip-vs-removesuffix/"&gt;Python: lstrip() vs removeprefix() and rstrip() vs removesuffix()&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/reverse-string-python/"&gt;How to reverse a string in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/slicing-python/"&gt;Understanding Slicing in Python&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
      <category>python</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Machine Learning Project – How to Analyze and Clean Data, Create an ML Model, and Set Up an API</title>
      <dc:creator>Renan Moura</dc:creator>
      <pubDate>Fri, 26 Feb 2021 15:59:34 +0000</pubDate>
      <link>https://dev.to/renanmouraf/machine-learning-project-how-to-analyze-and-clean-data-create-an-ml-model-and-set-up-an-api-1kca</link>
      <guid>https://dev.to/renanmouraf/machine-learning-project-how-to-analyze-and-clean-data-create-an-ml-model-and-set-up-an-api-1kca</guid>
      <description>&lt;p&gt;This is a series on Data Science and Machine Learning applied to a House Prices dataset from the Kaggle competition &lt;a href="https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data"&gt;House Prices: Advanced Regression Techniques&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://renanmf.com/book-ds-ml-project-house-prices/"&gt;You can download a PDF version of this Data Science and Machine Learning Project with the full source code repository linked in the book.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this series we begin with the EDA (Exploratory Data Analysis) of the data, we create a script to clean the data, then we use the cleaned data to create a Machine Learning Model, and finally we use the Machine Learning model to implement a prediction API:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/exploratory-data-analysis-house-prices-part-one/"&gt;Exploratory Data Analysis – House Prices – Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/exploratory-data-analysis-house-prices-part-two/"&gt;Exploratory Data Analysis – House Prices – Part 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/data-science-project-data-cleaning-house-prices-dataset/"&gt;Data Science Project: Data Cleaning Script – House Prices DataSet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/data-science-project-machine-learning-model-house-prices-dataset/"&gt;Data Science Project: Machine Learning Model – House Prices Dataset&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/data-science-project-house-prices-dataset-api/"&gt;Data Science Project: House Prices Dataset - API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can download the complete code in the &lt;a href="https://github.com/renanmouraf/data-science-house-prices"&gt;Github Repository&lt;/a&gt; with clear instructions to execute this end-to-end project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt;&amp;gt;&amp;gt;You can also watch how to run this project on Youtube&amp;lt;&amp;lt;&amp;lt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/xEfCyb-0Wsk"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>machinelearning</category>
      <category>python</category>
    </item>
    <item>
      <title>How to Learn Machine Learning and Deep Learning: a guide for Software Engineers</title>
      <dc:creator>Renan Moura</dc:creator>
      <pubDate>Tue, 02 Feb 2021 20:39:40 +0000</pubDate>
      <link>https://dev.to/renanmouraf/how-to-learn-machine-learning-and-deep-learning-a-guide-for-software-engineers-39ii</link>
      <guid>https://dev.to/renanmouraf/how-to-learn-machine-learning-and-deep-learning-a-guide-for-software-engineers-39ii</guid>
      <description>&lt;p&gt;&lt;em&gt;This article was first posted on&lt;/em&gt; &lt;a href="https://renanmf.com/machine-learning-and-deep-learning-software-engineers/"&gt;renanmf.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a video where I share the resources I used to learn Machine Learning and Deep Learning online.&lt;/p&gt;

&lt;p&gt;If you are looking for a path to follow, this is your guide!&lt;/p&gt;

&lt;p&gt;I give you guidelines to learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Calculus&lt;/li&gt;
&lt;li&gt;Linear Algebra&lt;/li&gt;
&lt;li&gt;Machine Learning&lt;/li&gt;
&lt;li&gt;Deep Learning&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope you find it useful!&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/-uxyG_VAsyo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>beginners</category>
      <category>career</category>
    </item>
    <item>
      <title>Python Project: Guessing Game</title>
      <dc:creator>Renan Moura</dc:creator>
      <pubDate>Mon, 04 Jan 2021 14:09:54 +0000</pubDate>
      <link>https://dev.to/renanmouraf/python-project-guessing-game-18p3</link>
      <guid>https://dev.to/renanmouraf/python-project-guessing-game-18p3</guid>
      <description>&lt;p&gt;This numbers guessing game is a simple game that allows you to practice many of the fundamentals of the Python language.&lt;/p&gt;

&lt;p&gt;It is a great Python project for beginners and in this article, you will find not only the source code but also an explanation of how it works.&lt;/p&gt;

&lt;p&gt;The game works like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You choose a level: 1 (25 chances), 2 (15 chances), 3 (5 chances)&lt;/li&gt;
&lt;li&gt;The game will randomly pick a number from 1 to 1000&lt;/li&gt;
&lt;li&gt;In every turn, you pick a number&lt;/li&gt;
&lt;li&gt;The game will always tell you if your guess was lower or higher than the right number&lt;/li&gt;
&lt;li&gt;You win if you guess the right number before you run out of chances&lt;/li&gt;
&lt;li&gt;The game saves the highest score in a file named "score.txt".&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Although simple, this game involves many basic programming skills, and if you have any trouble following this code, don't worry, there is an article for every single thing you should know on this list:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/if-__name__-__main__-python/"&gt;if &lt;strong&gt;name&lt;/strong&gt; == ‘&lt;strong&gt;main&lt;/strong&gt;’ in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/generate-random-value-between-two-integers-python/"&gt;How to generate a random value between two integers in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/conditionals-python/"&gt;Conditionals in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/functions-python/"&gt;Functions in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/while-loops-python/"&gt;&lt;code&gt;while&lt;/code&gt; Loops in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/for-loops-python/"&gt;&lt;code&gt;for&lt;/code&gt; Loops in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/string-interpolation-f-strings-python/"&gt;String Interpolation with f-strings in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/user-input-command-line-python/"&gt;User input in the command line in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/file-handling-in-python/"&gt;File Handling in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/handling-exceptions-python/"&gt;Handling Exceptions in Python&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Game
&lt;/h2&gt;

&lt;p&gt;My suggestion is to open a text editor like &lt;a href="https://code.visualstudio.com/"&gt;VSCode&lt;/a&gt;, copy and paste the code, or open this article in another browser window, and put it side by side with this window, this way you can read the explanation while following along with the code.&lt;/p&gt;

&lt;p&gt;The code starts at the bottom, on the main block.&lt;/p&gt;

&lt;h3&gt;
  
  
  Choose a level: &lt;code&gt;choose_level()&lt;/code&gt; function
&lt;/h3&gt;

&lt;p&gt;It calls the function &lt;code&gt;choose_level()&lt;/code&gt; on the main block and goes to the beginning of the code where the actual function &lt;code&gt;choose_level()&lt;/code&gt; is and where you pick a level and get the number of chances accordingly.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;input()&lt;/code&gt; function is inside a &lt;code&gt;while&lt;/code&gt; loop that only breaks if you pick a valid integer, otherwise, it will catch the error with the &lt;code&gt;try/except&lt;/code&gt; block and print "Invalid choice", restarting the &lt;code&gt;while&lt;/code&gt; loop so the user can choose a level again.&lt;/p&gt;

&lt;p&gt;If the input is valid, but not 1 or 2 or 3, the &lt;code&gt;if&lt;/code&gt; block will print "Not a valid level." and restart the loop using &lt;code&gt;continue&lt;/code&gt; so the user can choose a level again.&lt;/p&gt;

&lt;p&gt;If the input is valid and either 1 or 2 or 3, the program moves on.&lt;/p&gt;

&lt;h3&gt;
  
  
  The core of the Game: &lt;code&gt;play_game(chances)&lt;/code&gt; function
&lt;/h3&gt;

&lt;p&gt;Then the &lt;code&gt;play_game(chances)&lt;/code&gt; function is called on the main block with the number of chances returned from &lt;code&gt;choose_level()&lt;/code&gt; as an argument and the program goes to the implementation of &lt;code&gt;play_game(chances)&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Initializing the game
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;play_game(chances)&lt;/code&gt; starts by picking a random number from 1 to 1000 and by initializing the number of points to 9999.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;for&lt;/code&gt; loop uses the &lt;code&gt;range(1, chances + 1)&lt;/code&gt; function giving a turn starting at 1 and going up until the number of chances you chose based on the difficulty level.&lt;/p&gt;

&lt;p&gt;Note that &lt;code&gt;range()&lt;/code&gt; does not include the number of the second argument, meaning that if you have 25 chances, it will only go until 24, that's why we have to make "chances + 1".&lt;/p&gt;

&lt;p&gt;The code then uses f-strings to print your current turn and how many chances you have.&lt;/p&gt;

&lt;h4&gt;
  
  
  Receiving input from the player
&lt;/h4&gt;

&lt;p&gt;Then you guess a number with the &lt;code&gt;input()&lt;/code&gt; function inside a &lt;code&gt;while&lt;/code&gt; loop.&lt;/p&gt;

&lt;p&gt;Note the &lt;code&gt;try/except&lt;/code&gt; that catches an exception in case the user tries a value that's different from an &lt;code&gt;int&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If the value is invalid, the except block catches the error, prints "Invalid guess." and the &lt;code&gt;while&lt;/code&gt; loop restarts.&lt;/p&gt;

&lt;p&gt;If you chose a valid value but it isn't between 1 and 1000, the &lt;code&gt;if&lt;/code&gt; block will be triggered, print a message, and use &lt;code&gt;continue&lt;/code&gt; to restart the loop.&lt;/p&gt;

&lt;p&gt;If you choose a valid number that is between 1 and 1000, the &lt;code&gt;break&lt;/code&gt; command will be triggered, breaking out the &lt;code&gt;while&lt;/code&gt; loop, and the program then proceeds to check if your guess matches the right number on &lt;code&gt;if guess == number:&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Checking your guess
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;if\else&lt;/code&gt; block to check the guess against the right number goes two ways.&lt;/p&gt;

&lt;p&gt;If the user nails it, the code will print the message with the score and call &lt;code&gt;save_highest_score(points)&lt;/code&gt; to save the score on a file (I will explain &lt;code&gt;save_highest_score(points)&lt;/code&gt; later).&lt;/p&gt;

&lt;p&gt;If the user doesn't guess the right number, it will go to the &lt;code&gt;else&lt;/code&gt; block.&lt;/p&gt;

&lt;p&gt;If the number is higher, the game prints "Your guess was too high, try a lower number.", if it is lower the game prints "Your guess was too low, try a higher number.".&lt;/p&gt;

&lt;p&gt;The program then calls the function &lt;code&gt;calculate_score(points, number, guess)&lt;/code&gt; (I will also explain this one later) to calculate your current score based on how many times you guessed wrong.&lt;/p&gt;

&lt;p&gt;You always start the game with 9999 and then lose points every turn you guess wrong.&lt;/p&gt;

&lt;p&gt;When you run out of chances and wasn't still able to guess the number, the program goes to &lt;code&gt;if turn == chances:&lt;/code&gt; where it checks if you exhausted the number of chances, and if you did, it prints "You ran out of chances!" and gives you the answer.&lt;/p&gt;

&lt;p&gt;Finally, the game prints "Game Over!".&lt;/p&gt;

&lt;h3&gt;
  
  
  Calculating the Score: &lt;code&gt;calculate_score(points, number, guess)&lt;/code&gt; function
&lt;/h3&gt;

&lt;p&gt;Let's understand &lt;code&gt;calculate_score(points, number, guess)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The function &lt;code&gt;calculate_score(points, number, guess)&lt;/code&gt; takes as arguments the current points the player has, the number they are trying to guess, and their current guess.&lt;/p&gt;

&lt;p&gt;The code subtracts the right number from guess, and then we have a &lt;code&gt;lost_points&lt;/code&gt; that is then subtracted from &lt;code&gt;points&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Notice the use of the &lt;code&gt;abs()&lt;/code&gt; built-in function, it returns the absolute value of a number.&lt;/p&gt;

&lt;p&gt;The absolute value of a number is the value without considering its sign. So both -790 and 790 become 790.&lt;/p&gt;

&lt;p&gt;This is important because if the right number is 200 and we guess 1, &lt;code&gt;lost_points&lt;/code&gt; will be 199 which is alright, but if we guess 990, &lt;code&gt;lost_points&lt;/code&gt; will be -790, which will increase the total number of points instead of decreasing it due to the code doing subtraction with a negative number.&lt;/p&gt;

&lt;p&gt;To see this in action, try removing &lt;code&gt;abs()&lt;/code&gt; from &lt;code&gt;lost_points = abs(number - guess)&lt;/code&gt; so it will look like this &lt;code&gt;lost_points = number - guess&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Saving the Final Score: &lt;code&gt;save_highest_score(score)&lt;/code&gt; function
&lt;/h3&gt;

&lt;p&gt;Finally, let's analyze what &lt;code&gt;save_highest_score(score)&lt;/code&gt; does.&lt;/p&gt;

&lt;p&gt;It opens the file "score.txt" to read the highest score recorded in the game.&lt;/p&gt;

&lt;p&gt;If there is no such file, the &lt;code&gt;except&lt;/code&gt; block prints the message "There was no champion" since there is no previous score to compare.&lt;/p&gt;

&lt;p&gt;If there is a file and it is not empty, the variable &lt;code&gt;record&lt;/code&gt; stores the highest score.&lt;/p&gt;

&lt;p&gt;Then we check if the current player's score is higher than the previous one.&lt;/p&gt;

&lt;p&gt;If it is, the program prints "You are the new champion!" and saves the new record on "score.txt".&lt;/p&gt;

&lt;p&gt;If the current score is not higher than the one stored in the file the program prints "Try again to beat the champion!".&lt;/p&gt;

&lt;h3&gt;
  
  
  The Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;random&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;choose_level&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"How hard do you want the game to be?"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"1 - Easy - 25 chances to try"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"2 - Medium - 15 chances to try"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"3 - Hard - 5 chances to try"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Choose the difficulty level (1 or 2 or 3): "&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Not a valid level."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="k"&gt;continue&lt;/span&gt;
            &lt;span class="k"&gt;break&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Invalid choice."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;chances&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;chances&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;chances&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;chances&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;calculate_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;points&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;lost_points&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;points&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;points&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;lost_points&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;points&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;save_highest_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;

    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"score.txt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"r"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;score_file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;record_line&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;score_file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;record_line&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record_line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"The record for this game is: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; points."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;FileNotFoundError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"There was no champion"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"You are the new champion!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"score.txt"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"w"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;score_file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;score_file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Try again to beat the champion!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;play_game&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chances&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;randint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;points&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;9999&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;turn&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;chances&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"-&amp;gt; Chance &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;turn&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; out of &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;chances&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Type a number between 1 and 1000: "&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Your guess must be between 1 and 1000!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="k"&gt;continue&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt;
            &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Invalid guess."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"&amp;gt;&amp;gt; You nailed it! Final score: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;points&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; &amp;lt;&amp;lt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;save_highest_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;points&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;break&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Your guess was too high, try a lower number."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Your guess was too low, try a higher number."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="n"&gt;points&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;calculate_score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;points&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;turn&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;chances&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"&amp;gt;&amp;gt; You ran out of chances! &amp;lt;&amp;lt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"The right number is: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Game Over!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"###############################"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Welcome to the Guessing game!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Guess the number from 1 to 1000"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"###############################"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;chances&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;choose_level&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;play_game&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chances&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Testing the Game
&lt;/h2&gt;

&lt;p&gt;The trick to winning in this kind of game is to divide the numbers in half when guessing, this way you eliminate 50% of the numbers in every turn, making your space of possibilities smaller quickly.&lt;/p&gt;

&lt;p&gt;Let's say the game starts with the random number &lt;em&gt;616&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Since this game goes from 1 to 1000, the logical first guess is 500.&lt;/p&gt;

&lt;p&gt;Then the game will tell you guessed too low, so you know the right number is between 500 and 1000.&lt;/p&gt;

&lt;p&gt;Then you try 750, the number in the middle of 500 and 1000.&lt;/p&gt;

&lt;p&gt;The game will say you guessed too high, now you know the right answer is between 500 and 750.&lt;/p&gt;

&lt;p&gt;You keep doing this until you either nail it or run out of chances.&lt;/p&gt;

&lt;p&gt;To run the game, copy and paste the code in a file with any name, I chose the name "guessing_game.py", and then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python guessing_game.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or, depending on your Python installation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 guessing_game.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is a sample output of when you beat the game:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;###############################
Welcome to the Guessing game!
Guess the number from 1 to 1000
###############################
How hard do you want the game to be?
1 - Easy - 25 chances to try
2 - Medium - 15 chances to try
3 - Hard - 5 chances to try
Choose the difficulty level (1 or 2 or 3): 1
-&amp;gt; Chance 1 out of 25
Type a number between 1 and 1000: 500
Your guess was too high, try a lower number.
-&amp;gt; Chance 2 out of 25
Type a number between 1 and 1000: 250
Your guess was too low, try a higher number.
-&amp;gt; Chance 3 out of 25
Type a number between 1 and 1000: 375
Your guess was too high, try a lower number.
-&amp;gt; Chance 4 out of 25
Type a number between 1 and 1000: 312
Your guess was too high, try a lower number.
-&amp;gt; Chance 5 out of 25
Type a number between 1 and 1000: 281
Your guess was too low, try a higher number.
-&amp;gt; Chance 6 out of 25
Type a number between 1 and 1000: 296
Your guess was too low, try a higher number.
-&amp;gt; Chance 7 out of 25
Type a number between 1 and 1000: 304
Your guess was too high, try a lower number.
-&amp;gt; Chance 8 out of 25
Type a number between 1 and 1000: 300
Your guess was too high, try a lower number.
-&amp;gt; Chance 9 out of 25
Type a number between 1 and 1000: 298
&amp;gt;&amp;gt; You nailed it! Final score: 9631 &amp;lt;&amp;lt;
There was no champion
You are the new champion!
Game Over!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is a sample output of when you lose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;###############################
Welcome to the Guessing game!
Guess the number from 1 to 1000
###############################
How hard do you want the game to be?
1 - Easy - 25 chances to try
2 - Medium - 15 chances to try
3 - Hard - 5 chances to try
Choose the difficulty level (1 or 2 or 3): 3
-&amp;gt; Chance 1 out of 5
Type a number between 1 and 1000: 4
Yout guess was too low, try a higher number.
-&amp;gt; Chance 2 out of 5
Type a number between 1 and 1000: 500
Your guess was too high, try a lower number.
-&amp;gt; Chance 3 out of 5
Type a number between 1 and 1000: 250
Yout guess was too low, try a higher number.
-&amp;gt; Chance 4 out of 5
Type a number between 1 and 1000: 23
Yout guess was too low, try a higher number.
-&amp;gt; Chance 5 out of 5
Type a number between 1 and 1000: 2
Your guess was too low, try a higher number.
&amp;gt;&amp;gt; You ran out of chances! &amp;lt;&amp;lt;
The right number is: 289
Game Over!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to truly understand what is going on in this code, the best thing you can is to modify it and see what happens.&lt;/p&gt;

&lt;p&gt;Try to change the messages in the &lt;code&gt;print()&lt;/code&gt; functions, change the number of chances for each level, come up with a different approach to calculate the score on &lt;code&gt;calculate_score(points, number, guess)&lt;/code&gt;, etc.&lt;/p&gt;

&lt;p&gt;There are many changes you can do to make this game even better!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>python</category>
      <category>programming</category>
    </item>
    <item>
      <title>The Ultimate Python Guide For Beginners</title>
      <dc:creator>Renan Moura</dc:creator>
      <pubDate>Wed, 09 Dec 2020 22:18:20 +0000</pubDate>
      <link>https://dev.to/renanmouraf/the-ultimate-python-guide-for-beginners-4kh3</link>
      <guid>https://dev.to/renanmouraf/the-ultimate-python-guide-for-beginners-4kh3</guid>
      <description>&lt;p&gt;Python has become one of the fastest-growing programming languages over the past few years.&lt;/p&gt;

&lt;p&gt;Not only it is widely used, it is also an awesome language to tackle if you want to get into the world of programming.&lt;/p&gt;

&lt;p&gt;This Python Guide for Beginners allows you to learn the core of the language in a matter of hours instead of weeks.&lt;/p&gt;

&lt;p&gt;You can download a PDF version of this guide: &lt;a href="https://renanmf.com/python-guide-beginners/"&gt;The Python Guide for Beginners&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/introduction-to-python/"&gt;Introduction to Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/how-to-install-python-3/"&gt;How to Install Python 3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/how-to-run-python-code/"&gt;How to Run Python Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/python-syntax/"&gt;Syntax&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/comments-python/"&gt;Comments&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/variables-python/"&gt;Variables&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/python-data-types/"&gt;Data Types&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/type-casting-python/"&gt;Type casting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/user-input-command-line-python/"&gt;User input in the command line&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/arithmetic-operators-python/"&gt;Arithmetic Operators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/assignment-operators-python/"&gt;Assignment Operators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/logical-operators-python/"&gt;Logical Operators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/comparison-operators-python/"&gt;Comparison Operators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/identity-operators-python/"&gt;Identity Operators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/membership-operators-python/"&gt;Membership Operators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/bitwise-operators-python/"&gt;Bitwise Operators&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/conditionals-python/"&gt;Conditionals in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/python-list/"&gt;Lists&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/python-tuple/"&gt;Tuples&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/python-set/"&gt;Sets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/python-dictionary/"&gt;Dictionaries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/while-loops-python/"&gt;&lt;code&gt;while&lt;/code&gt; Loops&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/for-loops-python/"&gt;&lt;code&gt;for&lt;/code&gt; Loops&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/functions-python/"&gt;Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/scope-python/"&gt;Scope&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/list-comprehensions-in-python/"&gt;List Comprehensions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/python-lambda-functions/"&gt;Lambda Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/modules-python/"&gt;Modules&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/if-__name__-__main__-python/"&gt;&lt;code&gt;if __name__ == ‘__main__’&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/file-handling-in-python/"&gt;File Handling&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/organizing-files-python/"&gt;Organizing Files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/classes-objects-python/"&gt;Object-Oriented Programming: Classes and Objects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/object-oriented-programming-encapsulation-in-python/"&gt;Object-Oriented Programming: Encapsulation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/inheritance-python/"&gt;Object-Oriented Programming: Inheritance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/object-oriented-programming-polymorphism-in-python/"&gt;Object-Oriented Programming: Polymorphism&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/handling-exceptions-python/"&gt;Handling Exceptions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Duck Typing in Python</title>
      <dc:creator>Renan Moura</dc:creator>
      <pubDate>Sun, 06 Dec 2020 22:01:27 +0000</pubDate>
      <link>https://dev.to/renanmouraf/duck-typing-in-python-4g75</link>
      <guid>https://dev.to/renanmouraf/duck-typing-in-python-4g75</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;If it looks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Dynamic Typed languages like Python and JavaScript have an interesting characteristic of letting an object respond to a call according to the definitions of methods and attributes it has independently of its type.&lt;/p&gt;

&lt;p&gt;This means that the type of the object, i.e, its own class, or the class it inherits from doesn't matter, the interpreter only cares about the interfaces of the object.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code Example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Duck&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;quack_and_swim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'quack and swim'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Bird&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;quack_and_swim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'quack and swim'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Frog&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ribbit_and_swim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'ribbit and swim'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;check_duck&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;animal&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;animal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;quack_and_swim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;'__main__'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;duck&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Duck&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;bird&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Bird&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;frog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Frog&lt;/span&gt;
    &lt;span class="n"&gt;check_duck&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;duck&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;check_duck&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bird&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;check_duck&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frog&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output of the code above is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;quack and swim
quack and swim
Traceback (most recent call last):
  File "&amp;lt;stdin&amp;gt;", line 7, in &amp;lt;module&amp;gt;
  File "&amp;lt;stdin&amp;gt;", line 2, in is_duck
AttributeError: type object 'Frog' has no attribute 'quack_and_swim'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first and second objects &lt;code&gt;duck&lt;/code&gt; and &lt;code&gt;bird&lt;/code&gt; could successfully respond to the of &lt;code&gt;quack_and_swim()&lt;/code&gt; while the &lt;code&gt;frog&lt;/code&gt; object couldn't and throws an exception.&lt;/p&gt;

&lt;p&gt;In terms of code, the classes &lt;code&gt;Duck&lt;/code&gt; and &lt;code&gt;Bird&lt;/code&gt; are not related at all, they don't share a parent class through inheritance, but they have the &lt;strong&gt;same interface&lt;/strong&gt; for the function &lt;code&gt;quack_and_swim()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The type of the object is not important, the &lt;em&gt;interface&lt;/em&gt; of the object when you use it is what matters.&lt;/p&gt;

&lt;p&gt;In the end, if the object behaves like a duck, for practical purposes, it is a duck, no matter what bird it is, as long as it has the right interface.&lt;/p&gt;

&lt;p&gt;But what do we do about the thrown exception?&lt;/p&gt;

&lt;p&gt;Since we don't check the type of the object or if it has certain attributes, the Pythonic way to handle any &lt;a href="https://renanmf.com/handling-exceptions-python/"&gt;exception&lt;/a&gt; is to use a &lt;code&gt;try/except&lt;/code&gt; block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;check_duck&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frog&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;AttributeError&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The treated exception above will output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Traceback (most recent call last):
  File "&amp;lt;stdin&amp;gt;", line 2, in &amp;lt;module&amp;gt;
NameError: name 'check_duck' is not defined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So we always assume the object has the method or attribute we need, if it doesn't, we catch the exception with the &lt;code&gt;try&lt;/code&gt; block and treat it accordingly.&lt;/p&gt;

&lt;p&gt;If you had any trouble following this article, I recommend this series of articles about Object-Oriented Programming:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/classes-objects-python/"&gt;Classes and Objects in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/object-oriented-programming-encapsulation-in-python/"&gt;Object-Oriented Programming: Encapsulation in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/inheritance-python/"&gt;Inheritance in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/object-oriented-programming-polymorphism-in-python/"&gt;Object-Oriented Programming: Polymorphism in Python&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also, consider reading &lt;a href="https://renanmf.com/handling-exceptions-python/"&gt;Handling Exceptions in Python&lt;/a&gt; to learn more about how to deal with exceptions in Python.&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Think like a programmer</title>
      <dc:creator>Renan Moura</dc:creator>
      <pubDate>Mon, 14 Sep 2020 19:56:39 +0000</pubDate>
      <link>https://dev.to/renanmouraf/think-like-a-programmer-4eca</link>
      <guid>https://dev.to/renanmouraf/think-like-a-programmer-4eca</guid>
      <description>&lt;p&gt;A programmer is not someone who types super fast (yes, you have been fooled by movies and TV series).&lt;/p&gt;

&lt;p&gt;Programming is about problem-solving.&lt;/p&gt;

&lt;p&gt;Most of the time, a programmer is thinking about the problem and how to solve it.&lt;/p&gt;

&lt;p&gt;Problem-solving is a skill that requires creativity.&lt;/p&gt;

&lt;p&gt;And just like any other skill, it can be learned.&lt;/p&gt;

&lt;p&gt;The best way to learn is to practice with different problems and projects.&lt;/p&gt;

&lt;p&gt;Solving different problems will teach you different skills.&lt;/p&gt;

&lt;p&gt;Don't worry too much about syntax, you can always google it if you don't remember, but the reasoning behind solving a problem is something you have to develop by yourself.&lt;/p&gt;

&lt;p&gt;The general problem-solving flow is like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Analyze and understand the problem&lt;/li&gt;
&lt;li&gt;What are the inputs&lt;/li&gt;
&lt;li&gt;What is the required output&lt;/li&gt;
&lt;li&gt;Plan the solution&lt;/li&gt;
&lt;li&gt;Break the problem into smaller parts &lt;/li&gt;
&lt;li&gt;Break the parts into tasks&lt;/li&gt;
&lt;li&gt;If you get stuck, step back a little and rethink your approach&lt;/li&gt;
&lt;li&gt;Test the solution&lt;/li&gt;
&lt;li&gt;Fix errors that might appear, face them like challenges, not annoyances &lt;/li&gt;
&lt;li&gt;Iterate the steps until success&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Programming teaches you to think better.&lt;/p&gt;

&lt;h2&gt;
  
  
  Problem-Solving flow
&lt;/h2&gt;

&lt;p&gt;A program doesn't exist without a goal.&lt;/p&gt;

&lt;p&gt;You code because someone in your company or an external client requested a solution for a problem they have.&lt;/p&gt;

&lt;p&gt;Developing a system is a project and as such, must be treated as one.&lt;/p&gt;

&lt;p&gt;You have a new project to develop, a new program, there some important things you should check before coding to maximize the chances of success of your endeavor.&lt;/p&gt;

&lt;p&gt;The first thing is:&lt;/p&gt;

&lt;h3&gt;
  
  
  Stakeholders and their problems
&lt;/h3&gt;

&lt;p&gt;Ask yourself: who is using this program? what for? what problem do they have that I am solving?&lt;/p&gt;

&lt;p&gt;Stakeholders can be your boss, a client, or the actual person who is going to use the program, the so-called end-user.&lt;/p&gt;

&lt;p&gt;Talk to these people.&lt;/p&gt;

&lt;p&gt;Don't assume you know what they need, you will waste time and resources and feel frustrated when you find out that what you built does not fill the gap as needed.&lt;/p&gt;

&lt;p&gt;Take notes in an organized way of everything they tell you.&lt;/p&gt;

&lt;p&gt;These notes will turn into the second thing:&lt;/p&gt;

&lt;h3&gt;
  
  
  Requirements
&lt;/h3&gt;

&lt;p&gt;Every software has requirements like: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"I must be able to manage my customer data"&lt;/li&gt;
&lt;li&gt;"I need the input X to become output Y"&lt;/li&gt;
&lt;li&gt;"I have thousands of spreadsheets with sales information and want to know how much did we profit monthly on average in the last 5 years combining their data"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Analyze and understand the problem and turn it into requirements you have to fulfill, describe in words what has to be done for your program to be successful.&lt;/p&gt;

&lt;p&gt;The third step is to:&lt;/p&gt;

&lt;h3&gt;
  
  
  Break down the requirements into tasks
&lt;/h3&gt;

&lt;p&gt;The requirement "I have thousands of spreadsheets with sales information and want to know how much did we profit monthly on average in the last 5 years combining their data" translates to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a way to input/import all the spreadsheets&lt;/li&gt;
&lt;li&gt;Process the data to get only what is related to sales profit, since the spreadsheets have a bunch of information I don't need such as names and addresses&lt;/li&gt;
&lt;li&gt;Group the sales profit by month and average them&lt;/li&gt;
&lt;li&gt;I have to output another spreadsheet with the result&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With these written down, you have a clear path on what to do and you are able to track your progress and report it back to the stakeholders and show them you are advancing in each task.&lt;/p&gt;

&lt;p&gt;If your requirement includes a screen or a form in a website, you can also draw a rough sketch of how it is going to look like, which field goes where, to serve as a model.&lt;/p&gt;

&lt;p&gt;You then discuss these tasks and sketches with the stakeholders to check if you understood the problem well and if you are on the right track.&lt;/p&gt;

&lt;p&gt;This is a good point to find some mistakes and correct the direction before wasting resources coding a solution.&lt;/p&gt;

&lt;p&gt;The fourth step is to:&lt;/p&gt;

&lt;h3&gt;
  
  
  Design and code your solution
&lt;/h3&gt;

&lt;p&gt;Now you can work on your code.&lt;/p&gt;

&lt;p&gt;Define which libraries you will need, which functions should you create, what approach should you use.&lt;/p&gt;

&lt;p&gt;This varies a lot from programmer to programmer, my solution will differ from yours and they will be both right.&lt;/p&gt;

&lt;p&gt;There is no single solution to a problem in programming.&lt;/p&gt;

&lt;p&gt;The fifth step is to:&lt;/p&gt;

&lt;h3&gt;
  
  
  Test and iterate
&lt;/h3&gt;

&lt;p&gt;First, test it on your own and check your test cases.&lt;/p&gt;

&lt;p&gt;In the example of the spreadsheets, you can try to use just a few files, say 3, to check if your code outputs the same results that you achieved but doing the process manually.&lt;/p&gt;

&lt;p&gt;Doing the process manually is simply taking each spreadsheet and making the process of taking the average monthly profit by hand, just like the end-user would, and yes, it usually takes a long time to do it.&lt;/p&gt;

&lt;p&gt;It is usually better to ask the end-user to provide this manual test case instead of doing it yourself because they will most likely do it faster and more accurately.&lt;/p&gt;

&lt;p&gt;If your code doesn't output the same, you have to iterate, find the error, fix it, and test again until it matches the expected output.&lt;/p&gt;

&lt;p&gt;If your test ran alright, give the solution to the stakeholders, so they can try it with more test cases and give you feedback if there is something to fix, enhance, or if your solution is just right.&lt;/p&gt;

&lt;p&gt;Embrace this process and you will be way more successful than just sitting and coding in dark.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding help
&lt;/h2&gt;

&lt;p&gt;What to do if you get stuck?&lt;/p&gt;

&lt;p&gt;It does not matter if you are a beginner or a pro, you will eventually get stuck.&lt;/p&gt;

&lt;p&gt;I've been coding for a long time and I still get stuck.&lt;/p&gt;

&lt;p&gt;Finding a way out of a problem by yourself is a major ability for a programmer and you should get used to it.&lt;/p&gt;

&lt;p&gt;If you see an error, the first thing is to stop and read it carefully.&lt;/p&gt;

&lt;p&gt;Sometimes the error is very explicit in telling you what went wrong and what you should do.&lt;/p&gt;

&lt;p&gt;See error messages as a friend pointing you in the right direction.&lt;/p&gt;

&lt;p&gt;Some errors are not so friendly though.&lt;/p&gt;

&lt;p&gt;In this case, Google is your best friend.&lt;/p&gt;

&lt;p&gt;Chances are, someone has been through this error before and there is a solution for it on the internet.&lt;/p&gt;

&lt;p&gt;Just copy and paste the error message on Google and look for the solutions available.&lt;/p&gt;

&lt;p&gt;You might need to open more than a few blogs and forums, but trust me, this is a part of the process, and getting good at it is really important.&lt;/p&gt;

&lt;p&gt;I encourage you to spend some time reading the official documentation of anything you are learning in tech.&lt;/p&gt;

&lt;p&gt;Some documentations are just bad, but most major technologies have good docs and Python is one of them as you can see here &lt;a href="https://www.python.org/doc/"&gt;Python Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Learning from the source is a great advantage in this ever-evolving world of programming.&lt;/p&gt;

&lt;p&gt;You might also like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/deliberate-practice-and-the-senior-developer/"&gt;Deliberate Practice and the Senior Developer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://renanmf.com/machine-learning-for-humans-how-to-learn-better-and-faster/"&gt;Machine Learning for Humans: how to learn better and faster?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>codenewbie</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Puzzle Solver</title>
      <dc:creator>Renan Moura</dc:creator>
      <pubDate>Mon, 22 Jun 2020 21:05:28 +0000</pubDate>
      <link>https://dev.to/renanmouraf/puzzle-solver-38a</link>
      <guid>https://dev.to/renanmouraf/puzzle-solver-38a</guid>
      <description>&lt;p&gt;A few weeks ago I sent an e-mail to my subscribers and ended it asking the following question:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's your motivation for coding? What do you want to learn?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I had many incredible replies and took my time going through each of them and replying them all.&lt;/p&gt;

&lt;p&gt;There was one reply that stuck in me head (I won't identify the person since I didn't ask his/her permission):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Two main reasons why I’m learning to code are: 1. problem solving&lt;br&gt;
and 2. looking to change job sector.&lt;/p&gt;

&lt;p&gt;Problem solving because I want to be able to find automated solutions&lt;br&gt;
to everyday problems that I find to be a nuisance.&lt;/p&gt;

&lt;p&gt;Change of jobs because I feel no passion about what I am currently&lt;br&gt;
doing. I’ve felt more alive in the few months I’ve been learning&lt;br&gt;
to code and solving problems in Python and other programs than what&lt;br&gt;
I’ve felt in my entire career as a lawyer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To which I replied:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Problem-solving is truly one of the main skills in programming.&lt;/p&gt;

&lt;p&gt;The job market for programmers is only growing and far from its peak, so I would say you  are at the right time to make a change.&lt;/p&gt;

&lt;p&gt;This feeling you are describing is what I call "Puzzle Solver Feeling".&lt;/p&gt;

&lt;p&gt;Programming is about solving puzzles daily.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A programmer is someone paid to solve puzzles.&lt;/p&gt;

&lt;p&gt;The problem you are given is often a total mess and you have to make sense out of it.&lt;/p&gt;

&lt;p&gt;It doesn't matter the language or the tools you are using, learn problem-solving and the rest will follow.&lt;/p&gt;

&lt;p&gt;How to learn problem-solving?&lt;/p&gt;

&lt;p&gt;By practicing with problems and projects the general problem-solving flow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Analyze and understand the problem&lt;/li&gt;
&lt;li&gt;What are the inputs&lt;/li&gt;
&lt;li&gt;What is the required output&lt;/li&gt;
&lt;li&gt;Plan the solution&lt;/li&gt;
&lt;li&gt;Break the problem into smaller parts&lt;/li&gt;
&lt;li&gt;Break the parts into tasks&lt;/li&gt;
&lt;li&gt;If you get stuck, step back a little and rethink your approach&lt;/li&gt;
&lt;li&gt;Test the solution&lt;/li&gt;
&lt;li&gt;Fix errors that might appear, face them like challenges, not annoyances&lt;/li&gt;
&lt;li&gt;Iterate the steps until success&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Programming teaches you to think better.&lt;/p&gt;

&lt;p&gt;Become a Puzzle Solver.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>career</category>
      <category>codenewbie</category>
    </item>
  </channel>
</rss>
