<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Fatos Morina - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Fatos Morina - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sun, 24 May 2026 16:29:57 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/fatosmorina/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Start Learning to Code – Handbook for Beginners ]]>
                </title>
                <description>
                    <![CDATA[ In this handbook, I'll address a question you may be asking yourself: should you learn how to code? After explaining why you definitely should, I'll cover some of the benefits and challenges of being a software developer. I'll also discuss some key s... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/learn-coding-for-everyone-handbook/</link>
                <guid isPermaLink="false">66d45eff246e57ac83a2c769</guid>
                
                    <category>
                        <![CDATA[ handbook ]]>
                    </category>
                
                    <category>
                        <![CDATA[ learn to code ]]>
                    </category>
                
                    <category>
                        <![CDATA[ learning to code ]]>
                    </category>
                
                    <category>
                        <![CDATA[ software development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Fri, 08 Dec 2023 17:07:46 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/12/How-to-Start-Learning-to-Code-cover--1-.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this handbook, I'll address a question you may be asking yourself: should you learn how to code?</p>
<p>After explaining why you definitely should, I'll cover some of the benefits and challenges of being a software developer. I'll also discuss some key strategies for approaching learning to code to help you succeed.</p>
<p>By the end, you should have a more developed mental model of what it takes to learn programming and how you can start or continue your journey.</p>
<h1 id="heading-table-of-contents">Table of Contents</h1>
<ul>
<li><p><a class="post-section-overview" href="#heading-what-is-programming">What is programming?</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-should-you-still-learn-to-code-answer-yes">Should you still learn to code [Yes]?</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-why-you-should-consider-coding-as-a-career">Why you should consider coding as a career</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-potential-challenges-of-a-programming-job">Potential challenges of a programming job</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-why-do-software-engineers-get-paid-so-well">Why do software engineers get paid so well</a>?</p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-prepare-for-your-coding-journey">How to prepare for your coding journey</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-your-ego-is-your-enemy">Your ego is your enemy</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-take-responsibility-for-your-learning">Take responsibility for your learning</a></p>
</li>
<li><p><a class="post-section-overview" href="#i-am-afraid-to-start-programming-what-should-i-do">I am afraid to start programming. What should I do?</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-strategies-and-tips-for-learning-to-code">Strategies and tips for learning to code</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-can-you-learn-coding-in-a-single-night">Can you learn coding in a single night?</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-avoid-tutorial-hell">Avoid tutorial hell</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-understand-complex-topics-by-using-the-feynman-technique">How to understand complex topics by using the Feynman Technique</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-dont-memorize-the-syntax">Don't memorize the syntax</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-keep-a-to-learn-list">Keep a To-Learn list</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-practical-aspects-of-coding">Practical aspects of coding</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-deal-with-overwhelming-projects">How to deal with overwhelming projects</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-choose-projects-to-build">How to choose projects to build?</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-learn-by-building-things-from-scratch">Learn by building things from scratch</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-learn-by-building-things-from-scratch">Build something that already exists</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-beyond-the-basics">Beyond the basics</a></p>
</li>
<li><p><a class="post-section-overview" href="#develop-a-love-of-learning">Develop a love of learning</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-look-at-the-bigger-picture">Look at the bigger picture</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-embrace-lifelong-learning-in-software-engineering">Embrace lifelong learning</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-get-the-pdf-version-of-the-book">Get the PDF version of the book</a></p>
</li>
</ul>
<h1 id="heading-introduction-to-programming">Introduction to Programming</h1>
<h2 id="heading-what-is-programming">What is Programming?</h2>
<p>Before we start with the advice, let's learn what computer programming is.</p>
<p>First of all, remember that a computer is not only a laptop or desktop. It's also your phone, tablet, and any other device that is capable of performing logical and arithmetic operations that we program into it.</p>
<p>This includes your car's navigation system, the ATM where you withdraw or deposit money, the systems that allow you to order food digitally, and so on.</p>
<p>Computer programming is the process of designing and building instructions (a "program") that the computer can execute.</p>
<p>As an example, we can take a calculator that performs arithmetic operations such as addition, subtraction, multiplication, and division.</p>
<p>Instead of doing all this with a pencil on paper – but instead, we have a calculator on our phones. And this calculator is a computer program that helps us find the result quickly.</p>
<p>Other programs that you may use every day include Facebook, WhatsApp, Instagram, YouTube, TikTok, and many others.</p>
<p>Writing a program is sort of like cooking a meal. You may have an idea for a delicious meal, but you need to buy the necessary ingredients beforehand.</p>
<p>Once you have what you need, you prepare that food, put it in the oven, and then wait while it cooks. After that, you serve the food at the table and eat it.</p>
<p>Things work similarly with programming: first, you have an idea and the knowledge to turn that idea into a program (or maybe you learn while you're building the program – just like how you can watch someone cooking food on YouTube and learn how to make that recipe).</p>
<p>Then, you start to put the ingredients of the program into place, piece by piece, until the entire program is ready to be served to users.</p>
<p>Unlike cooking, where dishes are consumed, programs remain intact and reusable even after being used.</p>
<p>This unique aspect means that a single program can serve multiple users simultaneously and over time.</p>
<p>There are costs associated with creating and maintaining software, but once developed, a program like a website can be accessed by numerous people at the same time without diminishing in availability or quality.</p>
<p>So to summarize, programming is the process of turning an idea into a computer program that other people can use. And this is something you can learn how to do yourself.</p>
<p>In the ever-evolving landscape of software engineering, many people are wondering about the impact AI will have.</p>
<p>Should you still learn how to code? (Short answer: yes.) Let's delve into this concern, especially for anyone who's skeptical about the future demand for coding skills.</p>
<h2 id="heading-should-you-still-learn-to-code-answer-yes">Should You Still Learn to Code? [Answer: Yes]</h2>
<p>We use software all the time – to chat with others, stay informed about the latest news, and even for our alarm clocks that help us wake up on time.</p>
<p>Even the browser or the PDF reader that you use to read documents are pieces of software. These words were even typed in a software program.</p>
<p>Programming is something that's ever-evolving, and many things that we're currently doing manually may get automated in the future.</p>
<p>But software is deeply embedded in our daily lives, powering tools and applications across various professions and personal activities.</p>
<p>The more we integrate into the digital world, the more central software becomes. It's reshaping our work, learning, and social interactions, with its importance only set to increase.</p>
<h3 id="heading-the-future-of-building-software">The Future of Building Software</h3>
<p>Imagine a world where building software was as simple as having a conversation with a highly advanced AI, like a future ChatGPT. You describe your needs, and the AI creates the entire software for you – no coding required.</p>
<p>So you may wonder: why should I learn coding when ChatGPT can code an entire app for me in seconds? Well, here's something I want you to understand: AI is not here to replace us, but to <strong>help us become more productive</strong>.</p>
<p>Sure, AI can help you save time and energy by performing certain basic, repetitive tasks for you. But grasping the basics of software development remains crucial, especially for the more complex problems that require your creative, experience-based solutions.</p>
<p>You need to be able to harness AI's power while continuing to learn and adapt. This will help make sure that we're steering the course in our rapidly evolving digital landscape.</p>
<p>As you can probably tell, I want to emphasize the irreplaceable role of software engineers and coders, even in an AI-dominated future. Here are a few reasons why:</p>
<ol>
<li><p><strong>Understanding Over Automation</strong>: Coding isn't just about executing tasks – it's about grasping complex logic and structures. Our human ability to analyze and solve intricate problems goes beyond AI's automation.</p>
</li>
<li><p><strong>Maintenance and Flexibility</strong>: Deep coding knowledge provides insights vital for software maintenance and adaptation. This knowledge is invaluable when AI-generated programs encounter issues.</p>
</li>
<li><p><strong>Safety and Reliability</strong>: Similar to understanding basic car mechanics for safety, knowing coding basics is essential for addressing software malfunctions.</p>
</li>
<li><p><strong>The Creative Element</strong>: AI lacks human creativity and innovation, which is crucial for envisioning and realizing novel software solutions.</p>
</li>
</ol>
<p>The rise of AI in coding doesn't signal the end for human coders. Rather, I believe it just signals a collaborative future. AI's automation of mundane tasks gives human coders more space for creativity and innovation in software development.</p>
<p>Learning to code transcends mere programming. It's about understanding how various technologies work, honing problem-solving skills, and nurturing creativity. These skills remain invaluable, even as AI reshapes the landscape.</p>
<p>So I encourage you to embrace coding as it opens doors to a future where human intelligence and AI collaboratively push the boundaries of innovation.</p>
<h2 id="heading-why-you-should-consider-coding-as-a-career">Why You Should Consider Coding as a Career</h2>
<p>Maybe when you were a kid (or now as an adult) you liked a computer game so much that you played it all the time.</p>
<p>And maybe you had the idea that someday you could develop a game like it.</p>
<p>I know people who started programming precisely for this reason: to be able to develop different computer games.</p>
<p>So, because of the pleasure you may have experienced, you may have decided to become a programmer yourself.</p>
<p>Over time, your reasons may change – and this certainly doesn't mean that everyone gets into coding only because of game development.</p>
<p>After all, there are many reasons why you might consider programming as an option for your career. Let's discuss some of these reasons now (and indeed there are many more).</p>
<h3 id="heading-you-have-the-opportunity-to-develop-something-for-fun">You have the opportunity to develop something for fun</h3>
<p>I mentioned the case of game development, but you don't have to start programming by building games.</p>
<p>Maybe you are an accountant, or you have a shop and want to register your goods through a program that you develop yourself...and so on.</p>
<p>Here are some practical projects that might inspire someone to learn to code:</p>
<ul>
<li><p>A custom note-taking application tailored to your specific needs.</p>
</li>
<li><p>A personalized inventory management system for your shop.</p>
</li>
<li><p>An app for organizing and tracking your daily tasks and goals.</p>
</li>
<li><p>A scheduler for managing your college or university timetable.</p>
</li>
<li><p>A problem-solving assistant for tackling challenging tasks.</p>
</li>
<li><p>A daily weather update tool that sends forecasts to your email.</p>
</li>
<li><p>A health app that suggests potential illnesses based on symptoms.</p>
</li>
<li><p>A focus enhancer that limits access to social media during work hours.</p>
</li>
</ul>
<p>There are many other programs that you could develop. In short, you can start programming because you like to solve the problems you face in your daily life.</p>
<p>And once you learn to code and can build these programs, then you can share them with your friends and family (and beyond).</p>
<h3 id="heading-you-can-solve-problems-for-people-all-over-the-world">You can solve problems for people all over the world</h3>
<p>Here's something that might make you happy: having the opportunity to help someone else (or a lot of people). I am sure that when you have been able to help a family member or a colleague, you've felt happy and satisfied.</p>
<p>Now, imagine how good you'd feel if you had the opportunity to solve a problem that people are facing all over the world.</p>
<p>For example, you may have an idea to start a Facebook group for residents of your neighborhood asking each other for household tools that you may need.</p>
<p>Or maybe you want to propose that everyone pitch in on maintaining the common spaces in your neighborhood.</p>
<p>You could also use this group to bring up problems as well as solutions that you aim to realize.</p>
<p>If you know how to code, you can create your own tool and share it with your neighbors. You can make your platform tailored to the specific needs of your neighborhood.</p>
<p>And if it works in your community, you can then share it with people from other neighborhoods.</p>
<p>You can take things a step further and work on projects that help people working in different fields.</p>
<p>So, for example, in addition to helping residents of your neighborhood, you can help farmers be better informed about the weather conditions by building a weather reporting app.</p>
<p>Or you can come up with a recommendation system that helps them determin how to work the land and what crops to plant when.</p>
<p>Or maybe you want to help a barber who wants to visualize the hair styles of his clients before cutting their hair. Or you could even build programs to help a private medical clinic better manage their patients' records.</p>
<p>As I hope you're beginning to see, the possibilities are pretty much endless.</p>
<h3 id="heading-you-can-work-on-interesting-challenges">You can work on interesting challenges</h3>
<p>A major advantage of programming is that you can use the knowledge you acquired to solve all different kinds of problems.</p>
<p>Often you may start to read a book, or watch a movie that you may not like, and you have the opportunity to leave that book or that movie unfinished and start another one.</p>
<p>The same thing applies to programming projects. You may not be very motivated to work on a side project, so usually you have the opportunity to switch and deal with another project.</p>
<p>You can do that even at work from time to time where you ask can ask your manager to assign you to a different project.</p>
<h3 id="heading-you-can-also-learn-during-work-hours">You can also learn during work hours</h3>
<p>Many companies offer programmers space and the opportunity to learn during work hours when there is no work that needs to be done at the moment.</p>
<p>In fact, some companies cover the expenses for training, books, and various courses that qualify and prepare workers.</p>
<p>And at some companies, when you complete a certification, you'll get a reward of some type, whether financial or otherwise.</p>
<p>Skilled, prepared, and trained programmers are valuable resources for a company. In addition to being able to work on more complex projects, they also often have the opportunity to get better clients and offers. The company can also invest in these highly-skilled devs by promoting them.</p>
<h3 id="heading-you-can-work-from-home">You can work from home</h3>
<p>The good thing about programming is that you can work from home (or anywhere) and be employed remotely. This means you don't have to physically move somewhere to engage in more interesting work or get a better offer.</p>
<p>During the pandemic, many companies offered the opportunity to work from home, and many companies will continue to offer this opportunity even after the pandemic.</p>
<p>This is a great relief for many people, as it saves them from the need to travel every day to the office, pay additional rent, live away from family members, and so on.</p>
<h3 id="heading-you-can-have-a-flexible-schedule">You can have a flexible schedule</h3>
<p>Different people have different obligations outside of work, including family needs, medical appointments, or various commitments at certain times, which cannot be postponed for later.</p>
<p>So for many, having a flexible schedule, or even getting to leave work at certain times, is necessary. And many developers are able to have this flexiblity in their work schedules.</p>
<h3 id="heading-you-can-collaborate-with-and-learn-from-intelligent-people">You can collaborate with and learn from intelligent people</h3>
<p>If you're on a team, there will likely be people who have studied many different fields/areas of tech than you have. They'll also likely have rich experiences with various previous projects. This will present to you many opportunities for learning and collaborating with these team members. So take advantage of those opportunities when you can.</p>
<p>You may have team members in Germany, Singapore, or Brazil, or anywhere else in the world. And by working on the same project, you have the opportunity to benefit from their knowledge, their approach to problems, and their creative solutions.</p>
<h3 id="heading-the-salary-is-often-very-good">The salary is often very good</h3>
<p>Programmers often enjoy higher salaries compared to many other professions.</p>
<p>This isn't just a slight difference – in most countries, if not all, the average salary for programmers significantly exceeds the national average.</p>
<p>This trend reflects the high demand and value placed on programming skills in the global job market.</p>
<p>In addition to the opportunity for good compensation, there is also the opportunity to get raises or other financial incentives/benefits depending on your work.</p>
<p>Also, many tech companies implement bonus schemes for their employees. These bonuses are given for achieving business goals, exceptional performance, or extremely dedicated work.</p>
<p>They can be awarded to individuals or teams, depending on the company's policies.</p>
<p>Thus, based on individual or team achievements, securing big clients, or completing successful projects, employees may receive additional compensation in the form of bonuses.</p>
<p>This can be a significant motivational factor for many in the programming field.</p>
<h3 id="heading-you-can-often-take-paid-leave">You can often take paid leave</h3>
<p>As much as we may be motivated to work and enthusiastic about turning our ideas into code and thus reality, we are human and need rest and relaxation. So make sure to take the time to disconnect from daily work.</p>
<p>In other words, rest is beneficial for everyone, especially for programmers, who may be stressed and engaged all day with work and pressure.</p>
<p>In general, developers get fairly generous paid leave, allowing them to take vacations throughout the year. There are also companies that offer the opportunity for long periods of leave, as long as it does not harm the project and the work of the entire team.</p>
<p>Taking vacations isn't always easy for people of other professions, who often have much less flexibility or less generous paid time off.</p>
<p>Those are just some of the reasons programming may be a good fit career-wise for you.</p>
<p>But to be fair, let's also consider some of the downsides to see if any of them are dealbreakers for you.</p>
<h2 id="heading-potential-challenges-of-a-programming-job">Potential Challenges of a Programming Job</h2>
<p>Perhaps you did not expect this issue to be addressed in this book which is aimed to inspire you to consider becoming a developer.</p>
<p>But I thought it was important to share potential downsides as well to help you make an informed decision.</p>
<p>Here, I'll discuss only some of the disadvantages that come from a career in programming. You might not experience all these specifically, and this may not reduce the chances of them happening to you. But if you're aware of them, perhaps you can avoid them more easily.</p>
<h3 id="heading-programming-can-be-stressful">Programming can be stressful</h3>
<p>Perhaps you have had the chance to speak with other developers and they told you that coding is stressful. Well, this can be the result of many situations.</p>
<p>For example, if you're fixated on solving a particular problem at work, you may hesitate to get up from your chair and walk around, which helps relieve stress. But you don't want to stop until you solve the problem. This can contribute to your stress.</p>
<p>So what can you do to help relieve stress, or release the emotional burden of an issue? Well first of all, it's good to do physical movement, including getting up from your chair, taking a little walk around the office (or your house, or wherever you're working), going out in the fresh air, and changing your environment for a few moments.</p>
<p>Remember: stress can be harmful both in keeping you from thinking clearly (which would help you more easily find a solution to the problem), and in consuming all your energy. All this can lead to a deterioration of your mental and emotional state.</p>
<h3 id="heading-you-need-to-learn-continuously">You need to learn continuously</h3>
<p>Learning is the only way to advancement. So if you always feel pressure to learn new things either directly or indirectly, this is a great opportunity you can use to advance your career.</p>
<p>New tech tools, programming languages, and platforms come out continuously. And you may be busy dealing with commitments outside of work that may also take your time and energy.</p>
<p>It doesn't matter how much experience you have so far in programming. The only thing that remains unchanged is the need to learn continuously. Learning new things helps you keep up with the job market, know what's required by your clients, and develop your own products.</p>
<p>But perhaps you don't enjoy the pressure to learn new skills all the time.</p>
<p>You might be someone who, as soon as you get into a job, want to feel comfortable and secure. This is ok, but it may result in having lower ambitions and fewer or less exciting goals.</p>
<p>So if you're someone who doesn't always want to be learning new skills, this could be a negative side of tech and an unsuitable burden. But I hope that you, instead of seeing this as a negative side or disadvantage of programming, will embrace it as a worthy challenge.</p>
<h3 id="heading-you-have-a-lot-of-responsibility">You have a lot of responsibility</h3>
<p>Your work as a developer may be used by many people. It may have a positive impact on them and make their lives easier.</p>
<p>But with this great power comes great responsibility. You may unintentionally cause negative consequences that may affect many people if you fail to catch an error in a program, for example.</p>
<p>It is not the same as making a mistake when designing a wristwatch, for example, that comes out with some problem like a scratched face or cracked leather band. If you release an application used by tens of thousands (or more!) of people – say, a medical device – that contains a mistake, it may risk people's lives.</p>
<p>This may seem a bit exaggerated, but it is worth remembering that many programs on hospital computers used by doctors and medical staff may have errors or bugs in them. As a result, this mistake could cause a doctor to make an incorrect diagnosis diagnosis and the wrong therapy which can be very harmful, even fatal to the patient.</p>
<p>So it's important to take your responsibilities as a developer seriously and complete your work carefully and thoughtfully.</p>
<h3 id="heading-you-may-need-to-work-after-hours">You may need to work after hours</h3>
<p>This is not unique only to programmers, since people who work in other jobs often need to work after work hours. But this can be hard for devs, especially those with additional responsibilities in their lives.</p>
<p>As a developer, you may need to stay late at work for many reasons, such as:</p>
<ul>
<li><p>You have a short deadline for finishing a new task, new feature, or just for fully completing the project for your client.</p>
</li>
<li><p>Some service that you have programmed has failed which needs an immediate fix so the client's service or tool doesn't go down. And you may need to be at your computer to fix it even though it might be after work hours, during a weekend, or during an official holiday.</p>
</li>
<li><p>A security issue has arisen in a programming library that you use and you need to resolve it so that your clients and users are not affected by this problem. Mistakes are inevitable, especially in programming, but errors vary, and some can be very harmful, while some may not even be noticed.</p>
</li>
</ul>
<p>Just make sure that you set boundaries and expectations with your team, your clients, and your manager so you don't end up working overtime all the time.</p>
<h3 id="heading-you-have-to-sit-for-long-periods-in-front-of-the-computer">You have to sit for long periods in front of the computer</h3>
<p>Developers often sit for long periods in a chair and often don't do enough physical activity. This can cause you to start experiencing back or joint pain, numbness, weight gain, or other potentially harmful health issues.</p>
<p>Or as you concentrate really hard on debugging a problem, you may have times when you even forget to close your eyes while working at your computer. This, of course, is not healthy, as it can damage your eyes.</p>
<p>Also, sitting such a short physical distance from your computer, which is usually less than a meter away, you may fixate your eyes in the same position for a long time, which can be harmful to your eyes as well.</p>
<p>To avoid these things, you can workout at a gym, do light exercises at home by following instructions on YouTube, and by generally moving your body more often like by getting up from your chair, walking around the office, eating healthy foods, stretching, and so on.</p>
<h3 id="heading-your-body-mass-may-increase">Your body mass may increase</h3>
<p>Many programmers feel stress during work. As a result, they eat more than they need to reduce stress – and they may not even notice that they are overeating due to stress.</p>
<p>And again, since you may be spending long periods sitting and eating more than you need, you may start gaining some weight and losing muscle.</p>
<p>To avoid unwanted weight gain, try to be conscious of what you eat and how much. You can try to eat less unhealthy fat and reduce your sugar intake. You can also do some physical exercises, and make sure to eat little but often.</p>
<p>These are just some of the challenges programmers can face. But hopefully, now that you're aware of them, you can figure out how to avoid or deal with them.</p>
<h2 id="heading-why-do-software-engineers-get-paid-so-well">Why Do Software Engineers Get Paid So Well?</h2>
<p>One of the reasons we work is to make money to cover expenses and ensure that we can live a pleasant and dignified life.</p>
<p>Since we were kids, we've had to learn, complete our education, and gain experience so that we can more easily get a good job and make good money.</p>
<p>Since you are reading this, you have probably heard that software engineers are paid pretty well compared to many other professions.</p>
<p>The average salary of programmers – even those without formal education and relatively little work experience – is often much higher than that of people with jobs in other fields.</p>
<p>There are many reasons for this, but here I'll discuss what I consider to be some of the main ones.</p>
<h3 id="heading-increased-need-for-software-engineers">Increased need for software engineers</h3>
<p>In our world today, almost every company needs software engineers. This is because technology is a big part of our daily lives.</p>
<p>We use technology in our phones, cars, and at work. Companies in many areas like health, education, and fun activities need software engineers to make and look after their computer programs.</p>
<p>Because so many companies need these skills, there are a lot of jobs for software engineers. This makes companies offer big salaries to get the best software engineers to work for them.</p>
<p>Also, being a software engineer is not easy. It takes a lot of learning and practice.</p>
<p>Technology keeps changing, so software engineers have to keep learning new things. Not many people can do this well, so there are not too many software engineers.</p>
<p>This means that because so many companies want software engineers and there are not enough of them, they get paid a lot.</p>
<p>In simple words, software engineers make a lot of money because they are needed a lot and there are not enough of them who can do the job well.</p>
<h3 id="heading-you-help-turn-ideas-into-reality">You help turn ideas into reality</h3>
<p>When you want to build a house, first you seek the help of an architect who comes to your land, analyzes the environment, and then, after some time, comes up with a detailed plan for every part of the house.</p>
<p>Then, this plan is taken by a building engineer who manages a team of workers and the entire construction process until the construction of the house is completed and the house is ready.</p>
<p>This is highly skilled work that requires a lot of training and expertise. It's the same with being a developer. You get paid relatively a lot because it reflects the high level of skill you have and the amount of effort and work it takes to do your job.</p>
<p>Software engineers are able to turn an idea that a client has into a computer program which then can bring benefits to people all over the world. This is a very valuable skill, and such it is rewarded accordingly.</p>
<h3 id="heading-your-solutions-can-connect-people-all-over-the-world">Your solutions can connect people all over the world</h3>
<p>When you think about a major highway, consider how it connects regions and transforms travel and commerce.</p>
<p>For instance, a major road might link two major cities, greatly increasing the flow of tourists and business travel between them.</p>
<p>Building such a highway requires a massive investment and a lot of effort, but once completed, it saves people significant time and opens up new opportunities.</p>
<p>This concept is similar to the creation of computer programs.</p>
<p>When a program is developed, it has the potential to connect millions of people worldwide who aren't in the same country or even on the same continent.</p>
<p>Take social media apps, for example. They're computer programs designed for global use, helping people like you, your family, and friends communicate, meet new people, or stay updated with the latest news.</p>
<p>Or consider Google's search engine, which processes over 3.5 billion queries daily on a variety of topics. It can help people anywhere, as long as they have an internet connection, solve their problems and learn new things.</p>
<p>These programs, much like a well-constructed highway, facilitate connections and interactions, making life more efficient and connected for countless individuals.</p>
<h3 id="heading-software-engineers-work-in-many-areas">Software Engineers work in many areas</h3>
<p>A special thing about software engineers is that they can work in many different areas. They are not just stuck in one kind of job.</p>
<p>This is really important and one of the reasons they get paid a lot.</p>
<p>Imagine a software engineer making a program for a doctor's office to keep track of patients.</p>
<p>Then, maybe the next week, they might make a system for a hotel to book rooms, or help a school manage its information.</p>
<p>Software engineers can help lots of different businesses by making computer programs that solve problems and make things easier.</p>
<p>Different companies, like those in health, hotels, or schools, might not know much about technology. But they know it helps them do better.</p>
<p>So, they pay software engineers well to make good technology for them.</p>
<p>This is because software engineers can do a lot to change and improve how different businesses work.</p>
<p>It's more than just writing code; it's about making tools that really help businesses in many ways.</p>
<h3 id="heading-you-are-constantly-improving-your-skills">You are constantly improving your skills</h3>
<p>Many developers constantly work to develop new tools to facilitate their daily work and make it easier or less time-consuming.</p>
<p>They write programs to do repetitive tasks for them, so they can then spend that saved time implementing logic and more complex solutions things for their projects.</p>
<p>So as a programmer, you'll always be improving your skills and getting faster at providing solutions to problems. You'll adopt the most powerful tools that help you perform your job faster and get more done.</p>
<p>A project that might have taken much longer, you can now finish in less time by using these new tools you have learned. This means that businesses who use your services as a programmer are able to go to market faster with useful products that serve customers better.</p>
<p>In other words, software engineers are paid so well because they have such specialized and valuable skills that allow them to help many people around the world.</p>
<h1 id="heading-how-to-prepare-for-your-coding-journey">How to Prepare for Your Coding Journey</h1>
<h2 id="heading-your-ego-is-your-enemy">Your Ego is Your Enemy</h2>
<p>When you begin thinking about starting your journey into coding, it's easy to feel overwhelmed.</p>
<p>You might envision complex systems and software like those at Google or Amazon and wonder how you could ever understand such complexities.</p>
<p>Often, when we set out to become proficient coders, we find that our biggest obstacle isn't the code itself, but our own egos.</p>
<p>Here, by ego, I mean an unhealthy belief in our own importance: our arrogance and our self-centered ambition.</p>
<p>It's like a stubborn voice inside us that insists on being the best without considering the collaborative, challenging, and iterative nature of learning to code.</p>
<p>Ego can mislead us into thinking we're more knowledgeable than we are, hindering our ability to learn and collaborate effectively.</p>
<p>It stands in the way of truly mastering coding, building productive relationships with fellow learners, and recognizing or creating opportunities for growth.</p>
<p>Ego is a constant threat, not just in professional life but as we embark on learning something new like coding.</p>
<p>It can prevent us from building great software, advancing in our learning goals, and recovering from setbacks.</p>
<p>To guard against ego, we need to be aware of its influence at every stage of our learning journey.</p>
<blockquote>
<p>“If you know the enemy and know yourself, you need not fear the result of a hundred battles. If you know yourself but not the enemy, for every victory gained you will also suffer a defeat. If you know neither the enemy nor yourself, you will succumb in every battle.” — Sun Tzu</p>
</blockquote>
<h3 id="heading-how-to-overcome-ego-in-the-early-stages-of-learning-to-code">How to Overcome Ego in the Early Stages of Learning to Code</h3>
<p>You might be starting with high enthusiasm, perhaps influenced by the success stories of self-taught coders or the allure of becoming a tech prodigy.</p>
<p>In such cases, ego might convince you that success will come easily, that you'll quickly master programming languages or skip the usual learning curves.</p>
<p>Remember, the most impressive achievements in coding come from dedication and hard work. Consider the builders behind WordPress, Microsoft, and Google, for example.</p>
<p>Their success stories are marked by relentless effort, not just innate talent or luck.</p>
<p>When starting your coding journey, don't fall into the trap of overestimating your abilities. Commit to the process, dedicate time to practice, and embrace the grind of learning.</p>
<p>Collaboration is key, as many groundbreaking projects are the result of team efforts.</p>
<p>Consider how major tech innovators worked together: Google’s founders met at Stanford’s computer science department, Microsoft began with Bill Gates and Paul Allen working together, and WhatsApp was a collaborative creation.</p>
<p>Learning to code is similar – it's about joining a community, sharing knowledge, and growing together.</p>
<h3 id="heading-ego-and-ongoing-learning">Ego and Ongoing Learning</h3>
<p>Even after landing your first coding job or completing a few projects, don't let ego convince you that you've learned all there is to know.</p>
<p>The tech field is ever-evolving, and continuous learning is vital.</p>
<p>Remember, the journey in coding doesn't have an endpoint. It's a continual process of growth and adaptation.</p>
<p>Your ego might make you resist new challenges, shy away from learning new languages or frameworks, or avoid seeking help when stuck.</p>
<p>Yet, these are the very experiences that enrich your coding journey and lead to true mastery.</p>
<p>History is full of examples where initial failures or setbacks led to great success.</p>
<p>Bill Gates and Paul Allen had a failed venture before Microsoft, and many successful apps and platforms were born out of earlier unsuccessful attempts.</p>
<h3 id="heading-embracing-humility-and-persistence">Embracing Humility and Persistence</h3>
<p>To thrive in your coding journey, humility and persistence are your greatest allies. Accept that failures and challenges are part of the process. Use them as stepping stones, not roadblocks.</p>
<p>Be open to continuous learning, seek feedback, and remember that collaboration enhances your growth.</p>
<p>As you progress, remember that ego is the enemy of learning. Stay grounded, focus on the process, and cherish the journey of becoming a skilled coder.</p>
<p>Your unique contribution to the world of coding lies not in being the best from the start but in being open to growth and learning from every experience along the way.</p>
<blockquote>
<p>“The first principle is that you must not fool yourself — and you are the easiest person to fool.”— Richard Feynman</p>
</blockquote>
<p>In learning to code, let your curiosity and passion for the craft be your guide, not your ego.</p>
<p>Keep your focus on the work, the learning process, and the joy of coding.</p>
<p>Identify the whispers of ego early on and counter them with discipline, humility, and a commitment to lifelong learning.</p>
<h2 id="heading-take-responsibility-for-your-learning">Take Responsibility for Your Learning</h2>
<p>Do not blame others for your lack of understanding or struggles when learning to code. Simply accept that you are the common denominator of all the problems and difficulties in your life.</p>
<h3 id="heading-are-you-not-understanding-a-particular-lesson">Are you not understanding a particular lesson?</h3>
<p>Do not blame the course, the book, or the instructor. Learning is your responsibility.</p>
<p>Every teacher tries their best, and we live in a time when you have plenty of options to choose and learn from.</p>
<p>So there is no excuse. If you work hard, you'll get there.</p>
<h3 id="heading-have-you-recently-found-that-a-piece-of-code-you-wrote-isnt-functioning-as-expected-in-your-project">Have you recently found that a piece of code you wrote isn't functioning as expected in your project?</h3>
<p>Even though this may be a rare occasion or something that you may not predict that could happen, you should still take responsibility.</p>
<p>First, admit that you made a mistake. Then, go and figure out how to fix the problem.</p>
<p>Use this as an opportunity to learn and document what went wrong and what you could do better in the future.</p>
<h3 id="heading-do-you-feel-that-you-arent-able-to-keep-up-the-pace-with-learning-new-things">Do you feel that you aren't able to keep up the pace with learning new things?</h3>
<p>I believe you already know that you are responsible for that as well.</p>
<p>It can be hard and very time consuming, especially if you have kids or other family to look after and also want to have a social life.</p>
<p>Still, your growth is your responsibility.</p>
<p><strong>You have to own that.</strong></p>
<p>You should try to carve out time a few times a week to improve your skills, whether that’s during your day job when there are no tasks to work on and you are free to learn, before leaving for work, in the evenings, or whenever is realistic for you.</p>
<p>You could try to wake up one hour earlier before work and invest that period of time in learning new things, or you could also set aside a few hours on a Sunday morning to do that.</p>
<h2 id="heading-im-afraid-to-start-programming-what-should-i-do">I'm Afraid to Start Programming. What Should I Do?</h2>
<p>Starting your journey in programming can be daunting, and it's natural to feel fear or self-doubt. But remember, even the most successful figures in tech and science have faced these challenges.</p>
<p>Consider Sergey Brin, the co-founder of Google. He achieved remarkable success but has spoken about feeling like an impostor, experiencing doubts about his contributions to the tech industry. His story shows that such feelings are normal, even at high levels of achievement.</p>
<p>Sheryl Sandberg, former COO of Facebook and a tech industry leader, also discussed her struggles with impostor syndrome. Despite her significant accomplishments, she's talked about moments of self-doubt and questioning her abilities. This highlights that everyone, regardless of their success, can experience these feelings.</p>
<p>Astrophysicist Neil deGrasse Tyson has been candid about his own experiences with impostor syndrome, reflecting on moments of self-doubt in his science career. His openness helps demystify the fears associated with stepping into new, challenging fields.</p>
<p>Dr. Maya Angelou, an esteemed author and poet, also expressed similar feelings. Despite her numerous accolades, she felt doubts about her worthiness and achievements. Her journey is an inspiring example of overcoming self-doubt to achieve greatness.</p>
<p>Wayne Gretzky's famous quote, "You miss 100% of the shots you don’t take," resonates deeply here. If fear holds you back, you'll never discover your potential in programming.</p>
<p>Starting in programming can be intimidating, and fears of failure are common. However, it's crucial to begin despite these fears. Remember, the tech experts and leaders you look up to started as beginners, just like you. They faced fears, made mistakes, and learned from them.</p>
<p>So, if your goal is to excel in programming or software engineering, embrace the challenge. Start learning and don't let fear or self-doubt deter you.</p>
<p>Everyone's journey starts with a single step, and feeling uncertain is simply a part of the process towards becoming skilled and confident in your abilities.</p>
<h1 id="heading-strategies-and-tips-for-learning-to-code">Strategies and Tips for Learning to Code</h1>
<h2 id="heading-can-you-learn-coding-in-a-single-night">Can you Learn Coding in a Single Night?</h2>
<p>A software bug in a Therac-25 radiation therapy machine <a target="_blank" href="https://www.newscientist.com/gallery/software-bugs/">caused the death</a> of five patients after receiving a massive dose of X-rays.</p>
<p>Knight Capital <a target="_blank" href="https://www.newscientist.com/gallery/software-bugs/">lost half a billion dollars</a> in half an hour when a software bug allowed computers to sell and buy millions of shares with no human oversight.</p>
<p>These and many other stories tell how seemingly unimportant bugs can actually cause disasters.</p>
<p>Software is becoming more and more important – which means that developers have more and more responsibility to be very careful and really good at what they do.</p>
<h3 id="heading-so-is-it-possible-to-learn-programming-in-just-one-night">So is it possible to learn programming in just one night?</h3>
<p>As funny as it sounds, there was a similar question asked on Quora more than 5 years ago.</p>
<p>Unfortunately, I cannot find that exact question anymore, but it stuck in my memory since then.</p>
<p>Maybe, the person who asked the question was trolling, or had an exam the next day and was hoping to get encouraging answers to pull an all-nighter and study before the exam.</p>
<p>I don’t remember the other answers, but I read one answer there which was really wise and quite funny.</p>
<p>The answer was something along these lines:</p>
<blockquote>
<p><em>Take a laptop and go to the north pole. A night there lasts 6 months. That’s how you can increase your chances of learning programming in one night.</em></p>
</blockquote>
<p>We live in a time where we want everything in a matter of seconds.</p>
<p>We want fast food, fast cars, six-pack abs in 6 days, and so on.</p>
<p>That’s the mindset that we have most of the time, and we expect the same thing in other areas as well.</p>
<p>But true mastery comes from a lot of work and dedication.</p>
<p>Take, for example, Peter Norvig, the director of research at Google, who <a target="_blank" href="https://norvig.com/21-days.html">suggests</a> that you to learn to program over the course of 10 years because rushing isn’t going to be worth it:</p>
<blockquote>
<p><em>“In 24 hours you won’t have time to write several significant programs, and learn from your successes and failures with them. You won’t have time to work with an experienced programmer and understand what it is like to live in a C++ environment. In short, you won’t have time to learn much.</em></p>
<p><em>So the book can only be talking about a superficial familiarity, not a deep understanding. As Alexander Pope said, a little learning is a dangerous thing.”</em></p>
</blockquote>
<p>If you mention that to people, they may not like it, but that’s the actual reality.</p>
<p>You cannot just jump from printing a few “Hello World” statements in the console to building the next Google a few days later.</p>
<p>I am not denying the fact that you could implement a really nice application in a few hours – but the ability to do that doesn’t come that fast.</p>
<p>Sure, you might have heard of the developer who <a target="_blank" href="https://dev.to/florinpop17/10-javascript-projects-in-10-hours-coding-challenge-316d">implemented 10 applications in 10 hours in one sitting</a>. But that’s not the result of one-night of learning. He worked hard and learned a lot before he managed to pull that off.</p>
<p>It takes time to learn something really well.</p>
<p>The more you do something, the more likely you are to get better at it. The more you practice, the more you'll be able to improve your performance – and the cycle repeats.</p>
<p>Now that you've read and hopefully internalized that, do not get too overwhelmed with the long journey ahead of you.</p>
<p>Will Smith describes it really well:</p>
<blockquote>
<p>“You don’t set out to build a wall. You don’t say ‘I’m going to build the biggest, baddest, greatest wall that’s ever been built.’ You don’t start there. You say, ‘I’m going to lay this brick as perfectly as a brick can be laid.’ You do that every single day. And soon you have a wall.”</p>
</blockquote>
<p>Now, instead of asking yourself whether you can learn programming in 1 night, a better question would be:</p>
<p><strong>What is one small but valuable thing that I could learn tonight?</strong></p>
<h2 id="heading-avoid-tutorial-hell">Avoid Tutorial Hell</h2>
<p>Have you ever spent hours watching tutorial videos and then felt like an expert, only to realize you couldn't actually do what the tutorial showed?</p>
<p>This is a common trap, and it's called "Tutorial Hell." It refers to the false sense of learning you may get when you read through a bunch of tutorials without actually trying to build something yourself.</p>
<p>When you watch tutorials without practicing, you might think you're learning, but you're really not getting the full experience.</p>
<p>Just watching something passively is not the same as truly understanding and being able to use that knowledge.</p>
<h3 id="heading-learn-to-code-by-coding">Learn to Code by Coding</h3>
<p>Learning to code is something that many people try to do just by watching videos or reading articles.</p>
<p>But if you really want to learn how to code, you have to get your hands dirty with the actual code.</p>
<p>It's not enough to sit back and watch someone else do it. <strong>You need to write the code yourself.</strong></p>
<p>This is the only way to turn the theoretical knowledge from videos into practical skills.</p>
<h3 id="heading-move-beyond-passive-learning">Move Beyond Passive Learning</h3>
<p>When diving into a specific framework or technology, it's easy to fall into the trap of passively watching or reading about it.</p>
<p>Instead, take an active approach.</p>
<p>Think of a project that you find interesting and would like to create. This could be anything from a simple website to a small app. The key is to choose something that excites you and motivates you to learn.</p>
<p>The project you choose will become your testing ground. It's where you'll apply everything you've learned from watching tutorials.</p>
<p>This hands-on practice is invaluable.</p>
<p>As you work on your project, you'll encounter real problems and challenges.</p>
<p>Solving these will deepen your understanding of the coding concepts and techniques you've learned about. You'll learn so much from googling, researching, trying and failing, and trying again.</p>
<p>It's in facing and overcoming these challenges that true learning happens.</p>
<p>Remember, the path to mastering any skill, especially coding, lies in active participation.</p>
<p>Watching tutorials is a great start, but it's the practice that makes you proficient. Learning by doing.</p>
<p>Your personal project is not just a test, but a journey towards deep understanding and skill development.</p>
<p>So, close the video player, open your code editor, and start building.</p>
<p>Your journey of true learning begins with the first line of code you write.</p>
<h2 id="heading-how-to-understand-complex-topics-by-using-the-feynman-technique">How to Understand Complex Topics by Using the Feynman Technique</h2>
<p>In the world of software engineering, there's a vast difference between simply knowing the name of something and truly understanding how it works.</p>
<p>You might know what a certain machine or a piece of software is called, but do you really grasp how it operates and accomplishes tasks?</p>
<p>This distinction is crucial in a field as complex and ever-evolving as software engineering.</p>
<p>One effective way to bridge this gap between superficial knowledge and deep understanding is through the 'Teach-Back' Technique.</p>
<p>This method, often associated with the famous physicist Richard Feynman, revolves around the idea of teaching what you learn to someone else.</p>
<h3 id="heading-what-is-the-teach-back-technique">What is the 'Teach-Back' Technique?</h3>
<p>Imagine you're explaining a new concept or tool you've learned in software engineering to a friend or a colleague who isn't familiar with it. This could be a programming concept, a coding language, or an advanced topic like blockchain or machine learning.</p>
<p><strong>First, begin with an explanation</strong>: start by breaking down the topic into simple terms. Your goal is to make it understandable to someone with little to no background in the subject. This exercise forces you to clarify your thoughts and solidify your understanding.</p>
<p><strong>Next, identify any gaps in your knowledge</strong>: as you explain, pay attention to moments where you stumble or feel uncertain. These are indicators of areas where your understanding is still shallow. Return to your study materials, whether they are books, articles, or online resources, and delve deeper into these topics.</p>
<p><strong>Remember that simplicity is key</strong>: in your explanation, avoid jargon and complex language. The ability to simplify a concept without losing its essence is a sign of true understanding. This approach not only benefits your learner but also reinforces your grasp of the subject.</p>
<p><strong>Sharing helps you solidify your knowledge</strong>: once you're comfortable with your explanation, consider sharing your newfound knowledge more broadly. Writing a blog post, creating notes, or even recording a video can further solidify your understanding and benefit others.</p>
<p><strong>Reaping the benefits</strong>: this technique of teaching others not only deepens your knowledge but also enhances your effectiveness as a software engineer. It's a powerful tool for learning and a testament to the saying, "To teach is to learn twice."</p>
<p>Remember, the true test of understanding in software engineering is your ability to convey complex ideas in simple, accessible terms.</p>
<p>The more effectively you can explain a concept, the better you understand it.</p>
<p>Embrace the role of being a teacher, even if your student is just an imaginary one, and watch as your understanding and proficiency grow.</p>
<p>This approach is not just about gaining knowledge – it's about mastering it.</p>
<h2 id="heading-dont-memorize-the-syntax">Don't Memorize the Syntax</h2>
<p>Say you move to a new city and you don’t know where the nearest grocery store is. You don’t beat yourself up — this is expected. You just use Google Maps to find it.</p>
<p>After you’ve been there several times, it’s highly likely that you won’t need to use Google Maps anymore (unless you want to check traffic or see if there are any accidents on your route – things like that).</p>
<p>So you naturally, over time, learn where things are – but it’s not that you’re intentionally <em>trying</em> to memorize every road, every possible path to a certain destination.</p>
<p>There may be cases when you're only interested in going to a certain place once.</p>
<p>It’s the same with certain methods that you may need to use in a programming language. New software developers may feel bad that they’re not memorizing sufficient syntax — that they still need to refer to the documentation.</p>
<p>They see this as a sign that they’re bad developers.</p>
<p>Here are a couple of common questions you may have when you're starting your journey into programming:</p>
<ul>
<li><p>How will I be able to learn all this syntax?</p>
</li>
<li><p>How long will it take for me to master it and write code without referring to the documentation?</p>
</li>
</ul>
<p>Then when you’re able to memorize some frequently used syntax, you may think that you’ve become good at programing.</p>
<p>You get the impression that it’s the amount of a language or the number of programming languages and frameworks you are able to memorize that really matters.</p>
<p>To put things in perspective, let’s compare the syntax of finding the length of a string in different programming languages:</p>
<ul>
<li><p><code>seq.length</code>, JavaScript lists, Java arrays.</p>
</li>
<li><p><code>seq.size()</code>, Java sequences, jQuery expressions (deprecated).</p>
</li>
<li><p><code>len(seq)</code>, Python.</p>
</li>
<li><p><code>seq.count()</code>, Django querysets.</p>
</li>
<li><p><code>SeqType'Length</code>, Ada arrays.</p>
</li>
<li><p><code>length seq</code>, Haskell.</p>
</li>
<li><p><code>(count seq)</code>, Clojure.</p>
</li>
<li><p><code>sizeof(seq)/sizeof(seq[0])</code>, C, statically allocated.</p>
</li>
<li><p><code>strlen(seq)</code>, C, null-terminated.</p>
</li>
</ul>
<p>As you can see, each language or technology has its own version of finding the length of a string. This should show you that it’s really difficult to memorize the same function in 12 different ways.</p>
<p>It’s very unlikely that a developer who’s used multiple programming languages can memorize all the syntax that they have used in the past. They may even not bother trying to learn it in the first place. So why is this? How does anyone actually write code?</p>
<h3 id="heading-is-syntax-so-important-that-i-have-to-memorize-it">Is Syntax So Important That I Have to Memorize It?</h3>
<p>To answer this, let’s see what some senior developers say.​</p>
<p>Here's a <a target="_blank" href="https://twitter.com/tdierks/status/835912924329836545">comment</a> from a senior dev at Google:</p>
<p><a target="_blank" href="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=twitter&amp;url=https%3A//twitter.com/tdierks/status/835912924329836545&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fabs.twimg.com%252Ferrors%252Flogo46x38.png%26key%3Da19fcc184b9711e1b4764040d3dc5c07#__hrp=eyJtdXRlciI6ZmFsc2UsIndhaXRGb3JEb2N1bWVudEJvZHkiOnRydWUsIndhaXRGb3JEb2N1bWVudFJlYWR5IjpmYWxzZSwibm9QYXRjaGVzIjp0cnVlLCJ3aWR0aCI6IjEwMCUiLCJoZWlnaHQiOiIxMDAlIiwiZW5naW5lTmFtZSI6ImVuZ2luZS0wLjEuMCIsImZyYW1lTmFtZSI6ImVuZ2luZS0wLjEuMDoxMTE2OTAxNjk0In0=">Embedded content</a></p>
<p>​​And here's one from a developer who works on commercial airline control systems:</p>
<p><a target="_blank" href="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=twitter&amp;url=https%3A//twitter.com/jp10k/status/835942380163457024&amp;image=#__hrp=eyJtdXRlciI6ZmFsc2UsIndhaXRGb3JEb2N1bWVudEJvZHkiOnRydWUsIndhaXRGb3JEb2N1bWVudFJlYWR5IjpmYWxzZSwibm9QYXRjaGVzIjp0cnVlLCJ3aWR0aCI6IjEwMCUiLCJoZWlnaHQiOiIxMDAlIiwiZW5naW5lTmFtZSI6ImVuZ2luZS0wLjEuMCIsImZyYW1lTmFtZSI6ImVuZ2luZS0wLjEuMDoxMTE2OTAxNjk0In0=">Embedded content</a></p>
<p>​​And JP went on to further comment on that previous tweet:</p>
<p><a target="_blank" href="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=twitter&amp;url=https%3A//twitter.com/jp10k/status/835944649487437826&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fpbs.twimg.com%252Fprofile_images%252F905797472232103936%252F5TFnAP4Q_400x400.jpg%26key%3Da19fcc184b9711e1b4764040d3dc5c07#__hrp=eyJtdXRlciI6ZmFsc2UsIndhaXRGb3JEb2N1bWVudEJvZHkiOnRydWUsIndhaXRGb3JEb2N1bWVudFJlYWR5IjpmYWxzZSwibm9QYXRjaGVzIjp0cnVlLCJ3aWR0aCI6IjEwMCUiLCJoZWlnaHQiOiIxMDAlIiwiZW5naW5lTmFtZSI6ImVuZ2luZS0wLjEuMCIsImZyYW1lTmFtZSI6ImVuZ2luZS0wLjEuMDoxMTE2OTAxNjk0In0=">Embedded content</a></p>
<p>​​Jon, a lead Android dev at Phunware, says he can't read an input stream without copying and pasting code from Stack Overflow:</p>
<p><a target="_blank" href="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=twitter&amp;url=https%3A//twitter.com/jonfhancock/status/834178169980678144&amp;image=#__hrp=eyJtdXRlciI6ZmFsc2UsIndhaXRGb3JEb2N1bWVudEJvZHkiOnRydWUsIndhaXRGb3JEb2N1bWVudFJlYWR5IjpmYWxzZSwibm9QYXRjaGVzIjp0cnVlLCJ3aWR0aCI6IjEwMCUiLCJoZWlnaHQiOiIxMDAlIiwiZW5naW5lTmFtZSI6ImVuZ2luZS0wLjEuMCIsImZyYW1lTmFtZSI6ImVuZ2luZS0wLjEuMDoxMTE2OTAxNjk0In0=">Embedded content</a></p>
<p>​​Another Tim commented on the original Tim's post:​​​</p>
<p><a target="_blank" href="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=twitter&amp;url=https%3A//twitter.com/timbray/status/835933619344429056&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fpbs.twimg.com%252Fprofile_images%252F421637246%252FTim_400x400.jpg%26key%3Da19fcc184b9711e1b4764040d3dc5c07#__hrp=eyJtdXRlciI6ZmFsc2UsIndhaXRGb3JEb2N1bWVudEJvZHkiOnRydWUsIndhaXRGb3JEb2N1bWVudFJlYWR5IjpmYWxzZSwibm9QYXRjaGVzIjp0cnVlLCJ3aWR0aCI6IjEwMCUiLCJoZWlnaHQiOiIxMDAlIiwiZW5naW5lTmFtZSI6ImVuZ2luZS0wLjEuMCIsImZyYW1lTmFtZSI6ImVuZ2luZS0wLjEuMDoxMTE2OTAxNjk0In0=">Embedded content</a></p>
<p>​Lastly, I'll leave you with Umer's comment:</p>
<blockquote>
<p>I wrote 255 lines of code that included a working server and a client. I queried google 23 times mostly landing on StackOverflow, Netty 4 website, GitHub, and JavaDocs. If you do the math, that averages out to 1 query every 10 lines of code! I had no idea. — <a target="_blank" href="https://tiantiankan.me/a/5cb4c6c2f4b9a5fab76893b2">Umer Mansoor</a></p>
</blockquote>
<p>These insights should give you courage — you don’t have to be ashamed that you can’t remember every detail of the syntax.</p>
<p>This is something that many junior developers may be concerned about. The truth is, you really do not have to memorize everything as you go.</p>
<p>Not even tech recruiters care about that. Here’s the response that an engineering director at Google gave regarding this:​</p>
<p><a target="_blank" href="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=twitter&amp;url=https%3A//twitter.com/tdierks/status/836014459055443968&amp;image=https%3A//i.embed.ly/1/image%3Furl%3Dhttps%253A%252F%252Fpbs.twimg.com%252Fprofile_images%252F867170721423908865%252FReXcZP2R_400x400.jpg%26key%3Da19fcc184b9711e1b4764040d3dc5c07#__hrp=eyJtdXRlciI6ZmFsc2UsIndhaXRGb3JEb2N1bWVudEJvZHkiOnRydWUsIndhaXRGb3JEb2N1bWVudFJlYWR5IjpmYWxzZSwibm9QYXRjaGVzIjp0cnVlLCJ3aWR0aCI6IjEwMCUiLCJoZWlnaHQiOiIxMDAlIiwiZW5naW5lTmFtZSI6ImVuZ2luZS0wLjEuMCIsImZyYW1lTmFtZSI6ImVuZ2luZS0wLjEuMDoxMTE2OTAxNjk0In0=">Embedded content</a></p>
<p>​</p>
<p>Here’s another quote from a <a target="_blank" href="https://news.ycombinator.com/item?id=11603078">comment</a> on Hacker News:</p>
<blockquote>
<p>I not only use Google frequently, I use it to search for things I myself have written in the past.</p>
<p>I can’t count the number of times I’ve Googled for a programming question where the answer is found on a Stack Overflow page I’ve written. If it’s a particularly old answer that I’ve completely forgotten, I’ve even thought to myself, “Wow this genius sounds just like me!” as well as “This idiot has no clue what he’s talking about!” .</p>
</blockquote>
<p>A couple of years ago, I read a post on a Facebook group from a senior developer mentioning that when recruiters ask him whether he has experience with a particular technology for which he hasn’t, he responds, “That’s just another tool.”</p>
<p>He means that he may not have had the chance to work with it in the past but he has the confidence that he can learn it.</p>
<p>You might not need to spend months before you're able to work with a new tool. You may only need a few hours to read its documentation and then learn more as needed along the journey without the need to memorize everything.</p>
<p>You do not expect to have all green lights on when you start your journey to your destination. You pass through the current green light and stop at a red light. You wait until the green light is on before proceeding.</p>
<p>Nowadays, we get new languages and frameworks, or considerable changes to existing ones, so that trying to memorize the syntax is both difficult and not that important. As one commentator on a blog post brilliantly <a target="_blank" href="http://disq.us/p/17uk3bk">put</a> it:</p>
<blockquote>
<p>“Great engineers know how to formulate good queries. Yet interviewers expect walking dictionaries.”</p>
</blockquote>
<p>So, to sum it all up: <a target="_blank" href="https://www.freecodecamp.org/news/how-to-search-google-like-a-pro/">get really good at googling</a> and learning as you go :)</p>
<h2 id="heading-keep-a-to-learn-list">Keep a To-Learn List</h2>
<p>You might have heard of to-do lists for keeping track of daily chores or tasks.</p>
<p>But as a software engineer, where learning is as important as doing, a "to-learn" list becomes your roadmap to growth and discovery.</p>
<p>Think of a "to-learn" list as your personal guide in the world of technology.</p>
<p>Just as a to-do list reminds you to buy groceries or pay bills, a to-learn list keeps track of all the exciting things in technology you want to explore.</p>
<p>This could be a new programming language that's taking the world by storm, a revolutionary tool that can change the way you code, or the latest trends in fields like artificial intelligence.</p>
<p>Your to-learn list is more than just a collection of cool things – it's a set of goals.</p>
<p>It's like having a bucket list for your professional development, full of adventures waiting to be embarked upon.</p>
<p>Whether it's mastering a new coding language, diving into insightful books, or enrolling in online courses, this list is your ticket to a world of endless learning.</p>
<p>A to-learn list keeps your curiosity alive. It's like having a treasure map where X marks the spot for new knowledge.</p>
<p>Each item on the list is a stepping stone to understanding the deeper workings of technology, beyond just using it.</p>
<p>This list also acts as a motivator. Imagine each new skill you learn as a level-up in a game, making you more capable and skilled in your job.</p>
<p>It's a reminder that your journey in software engineering is filled with exciting milestones waiting to be achieved.</p>
<p>Remember, there's always more to learn, and that's a good thing.</p>
<p>It keeps you humble and open-minded, acknowledging that the tech world is vast and ever-evolving, and no one knows it all.</p>
<p>This perspective is vital for continuous growth.</p>
<p>As you check off items on your to-learn list, you'll find yourself becoming a problem-solving wizard.</p>
<p>Each new skill or piece of knowledge adds to your ability to tackle complex challenges, making you an invaluable asset to your team.</p>
<p>The more you learn, the more valuable you become as a software engineer. This means being able to handle tasks more efficiently and creatively, boosting your productivity and making you a star performer in your field.</p>
<p>Your "to-learn" list is a powerful tool in your journey as a software engineer.</p>
<p>It's a living document that grows and changes with you, reflecting your aspirations and curiosity.</p>
<p>By maintaining and updating this list, you ensure that your journey in software engineering is always moving forward, filled with continuous learning and personal growth.</p>
<p>So, embrace your "to-learn" list, and let it guide you to new heights in your career, keeping you curious, motivated, and ever-evolving in the dynamic world of technology.</p>
<h1 id="heading-practical-aspects-of-coding"><strong>Practical</strong> A<strong>spects of</strong> C<strong>oding</strong></h1>
<h2 id="heading-how-to-deal-with-overwhelming-projects">How to Deal with Overwhelming Projects</h2>
<p>Big software projects, like those of Google, Amazon, or WhatsApp, often seem like modern marvels.</p>
<p>They can be awe-inspiring, reflecting complex engineering and innovative ideas.</p>
<p>If you ever consider the teams behind these giants, it's natural to feel a mix of awe and intimidation. The scale and impact of such projects can seem overwhelming.</p>
<p>Remember, the builders of these platforms likely faced similar feelings at the outset. But they didn't allow apprehension to hinder their progress.</p>
<p>Instead, they channeled it into productive action, laying brick by brick the foundation of what would become technological milestones.</p>
<p>As a software engineer, you might not be tasked with building the next global tech phenomenon right away, but every project, no matter its size, can feel daunting at the start.</p>
<p>Here's a roadmap to help you tackle even the most intimidating software engineering projects.</p>
<h3 id="heading-vision-seeing-the-end-from-the-start">Vision: Seeing the End from the Start</h3>
<p>One of the most critical steps in managing a large project is to have a clear vision. This means having a well-defined picture of the end goal. The clearer this vision, the easier it will be to navigate towards it.</p>
<p>Try to articulate this vision in simple terms, maybe through a diagram or a straightforward description.</p>
<p>Your goal should be to make this vision so understandable that anyone, regardless of their technical background, can grasp it.</p>
<p>For instance, if you're developing a complex web application, outline its core functionalities. Envision the user experience, the interface, and the key features that will define your application.</p>
<h3 id="heading-breaking-it-down-the-art-of-reverse-engineering">Breaking It Down: The Art of Reverse Engineering</h3>
<p>With your end goal vividly pictured, the next step is reverse engineering this vision into actionable steps.</p>
<p>This process involves deconstructing your final goal into smaller, manageable tasks. These tasks should be quantifiable, allowing you to plan and schedule them effectively.</p>
<p>In plotting your course, set clear milestones. These are significant checkpoints that signal progress towards your ultimate objective.</p>
<p>Take a web application as an example: begin by charting out the various stages of development. This could include initial design, front-end development, back-end setup, integration of functionalities, testing phases, and final deployment. Then you can tackle each one, one at a time.</p>
<h3 id="heading-starting-point-the-first-small-step">Starting Point: The First Small Step</h3>
<p>Every monumental project begins with a single, often small, step.</p>
<p>Do not fall into the trap of believing you can conquer the entire project in one go. Large-scale projects demand time, effort, and persistence.</p>
<p>Start with a manageable task or component of the project. Completing this initial task will provide a sense of accomplishment and momentum.</p>
<p>Progress, however incremental, is a powerful motivator. It propels you forward, fueling your drive to tackle the subsequent phases of your project.</p>
<p>If you find yourself hesitating to start, it might be because the task at hand seems too daunting. In such cases, break down the task further into smaller, more approachable segments.</p>
<h3 id="heading-reflective-progress-the-importance-of-review">Reflective Progress: The Importance of Review</h3>
<p>Regularly step back and review your progress.</p>
<p>This practice is essential for ensuring that you're on the right path toward your goal.</p>
<p>It’s easy to get caught up in the minutiae and lose sight of the broader objective. A periodic review helps you realign your efforts with your initial vision.</p>
<p>This review process is not merely a check-in. It's a strategic evaluation of your direction and methods. It might lead to course corrections, refinements of strategies, or even a reassessment of your goals.</p>
<h3 id="heading-the-path-through">The Path Through</h3>
<p>It’s common in software engineering to encounter phases of doubt and to feel stuck in a cycle of inaction.</p>
<p>Waiting for the perfect moment or for challenges to ease on their own is a futile approach. Instead, the key to conquering large projects lies in embracing responsibility and actively engaging with the tasks at hand.</p>
<p>No matter the size of the project, its completion is always achievable through careful planning, dedication, and unwavering focus.</p>
<p>Remember, in the realm of software engineering, <em>the only way out is the way through</em>.</p>
<p>Each step, no matter how small, is a move towards the realization of your project. Embrace each phase of the journey with commitment and resolve, and watch as your ambitious projects turn into accomplished realities.</p>
<h2 id="heading-how-to-choose-projects-to-build">How to Choose Projects to Build</h2>
<p>As you start learning and trying to apply your skills, you'll likely have a lot of project ideas that you're eager to start building.</p>
<p>Maybe you've listed them in a project management tool or jotted them down in your notebook. You have various app concepts, software solutions, or coding experiments you're excited about. But there's a common challenge: deciding which project to tackle first.</p>
<p>This indecision can lead to procrastination. You might find yourself opting for activities that are more immediately gratifying, avoiding the commitment to a single project.</p>
<p>"Perhaps there's something more crucial I should be working on?" you wonder. "Should I start this app or that automation script? Maybe I should brainstorm more ideas and something will click."</p>
<p>Let's pause for a moment and consider an old fable that might shed some light on this predicament.</p>
<h3 id="heading-learning-from-buridans-donkey">Learning from Buridan's Donkey</h3>
<p>There's a story about a donkey that was exactly in the middle of some hay and water. It couldn't decide whether to eat or drink first, so it didn't do either and got really hungry and thirsty.</p>
<p>The donkey didn't think about just picking one thing first and then doing the other thing next.</p>
<p>As software engineers, we often face a similar dilemma with our projects. We have numerous ideas and concepts, but none of them will come to fruition without action.</p>
<p>It's essential to recognize that we can't work on every project simultaneously. Just as we can't be in two places at once, we can't simultaneously code different applications. And this physical limitation shouldn't hinder our progress towards our goals.</p>
<h4 id="heading-just-start-with-one-project">Just start with one project</h4>
<p>Is it the perfect choice? Maybe, maybe not. But that's not what's critical at this moment.</p>
<p>The project you choose to work on probably isn't a life-or-death decision. Pick one and begin. You can always return to your other ideas later.</p>
<p>Start by outlining the features of the app or software. Code the first function or interface. Celebrate this progress, however small. Then, continue developing piece by piece.</p>
<p>Repeat this process for your other projects.</p>
<p>Don't let a plethora of choices impede your progress. Over-analysis leads to paralysis, stifling your movement towards completing your projects.</p>
<p>Stop overthinking. Start coding.</p>
<p>Let the world benefit from your work, one completed project at a time.</p>
<h3 id="heading-how-to-overcome-procrastination">How to overcome procrastination</h3>
<p>This is a common challenge for software engineers: "I know I need to start coding, but I just can't seem to begin."</p>
<p>"The blank IDE screen is intimidating. I can't get my fingers to start typing."</p>
<p>Consider how Ernest Hemingway, a renowned writer, dealt with writer's block:</p>
<blockquote>
<p>“Sometimes when I was starting a new story and could not get it going, I would sit in front of the fire and squeeze the peel of the little oranges into the edge of the flame and watch the sputter of blue that they made.</p>
<p>I would stand and look out over the roofs of Paris and think, ‘Do not worry. You have always written before and you will write now. All you have to do is write one true sentence. Write the truest sentence that you know.’</p>
<p>So finally I would write one true sentence, and then go on from there.”</p>
</blockquote>
<p>Adapt this approach to your coding. Start with a simple feature or function.</p>
<p>If that's all you accomplish for the day, so be it. Consistent small steps lead to significant progress.</p>
<p>Even a modest amount of coding each day maintains consistency. And often, once you start on a small task, you'll find yourself naturally progressing to more substantial parts of the project.</p>
<h3 id="heading-inspiration-from-history">Inspiration from History</h3>
<p>Consider Isaac Newton, who, during the bubonic plague lockdown in 1666, retreated to his family home from the University of Cambridge.</p>
<p>Without modern tools or online classes, Newton used this time to delve into complex mathematical problems, eventually laying the groundwork for calculus.</p>
<p>His focus and dedication led to groundbreaking discoveries.</p>
<p>In software engineering, it's easy to get caught up in finding the perfect tool or environment.</p>
<p>But remember, the real work comes from dedication and effort, not from having the latest technology or software.</p>
<blockquote>
<p>“Real professionals don’t hide behind their tools — real professionals use what’s around them. It’s the amateurs who try to nerd out about their tools — it’s all a distraction from really doing the work.” — Derek Sivers</p>
</blockquote>
<p>Let's move beyond excuses. Let's get back to coding.</p>
<h2 id="heading-learn-by-building-things-from-scratch">Learn by Building Things from Scratch</h2>
<p>Every time you start a new project, think of it as adding a brick to your knowledge fortress.</p>
<p>You'll encounter the essential elements of software – like algorithms, data structures, and design patterns. These are the ABCs of software, and grasping them deeply turns you into a more skilled and versatile engineer.</p>
<p>When you build from scratch, you're the architect and the builder. You get to decide every detail, customizing your project to fit your interests and needs.</p>
<p>It's like cooking a meal where you choose every ingredient to suit your taste, making the entire process deeply personal and satisfying.</p>
<p>Starting from zero means you'll walk through every stage of creating software – from the first sketch of your idea to making it work and showing it to the world.</p>
<p>This complete journey is like reading a book from cover to cover, giving you a full picture of how software comes to life.</p>
<p>Building from the ground up often means exploring the depths of the technologies you're using. Imagine diving into the ocean to discover what's underneath – that's what you do with each technology, understanding its secrets and subtleties.</p>
<p>As you build, you'll face various puzzles and challenges. Each problem you solve sharpens your mind, not just in coding but in finding smart, elegant solutions to tricky situations.</p>
<p>There's a special kind of pride and confidence that comes from seeing a project evolve from a simple idea to a working program.</p>
<p>It's like climbing a mountain – with every step, you feel stronger and more capable.</p>
<p>The hurdles you overcome while crafting software from scratch are similar to those you'll face in the professional world.</p>
<p>Be it fixing an unexpected error, adding a complex feature, or managing your time – these experiences are like rehearsals for the real-world stage of software engineering.</p>
<p>Embarking on a project from scratch is a cornerstone of your journey as a software engineer. It's an exercise in patience, persistence, and creativity.</p>
<p>Remember, it's not just about the software you build. It's about the skills you hone, the knowledge you acquire, and the confidence you develop.</p>
<p>Each project is a step towards becoming not just a coder, but a true artisan in the realm of technology. So, begin with an empty file and a spark of an idea, and let the magic of creation unfold.</p>
<h2 id="heading-build-something-that-already-exists">Build Something that Already Exists</h2>
<p>In the thrilling journey of software development, starting a new project often feels like opening a treasure chest filled with endless possibilities.</p>
<p>While it's tempting to dive into creating something unique and complex, the path of learning often calls for a simpler, more familiar approach.</p>
<p>Now, we'll explore the idea that not every project must be groundbreaking. Sometimes, the best learning comes from simplicity and familiarity.</p>
<p>Imagine starting with a blank canvas. Instead of painting a complex masterpiece right away, you first practice with simple strokes and familiar patterns. This is the essence of learning in software development.</p>
<p>By keeping projects simple and manageable, you avoid the trap of overwhelming complexity, allowing you to focus on the fundamentals of coding and problem-solving.</p>
<p>Think of existing open-source projects as a library filled with books you can learn from. These projects, created by others and shared on platforms like GitHub, are like guides offering valuable lessons.</p>
<p>They're a starting point, showing you how things are built and encouraging you to explore further.</p>
<p>Picture yourself as an apprentice painter, learning by replicating the works of masters. Similarly, in software development, <a target="_blank" href="https://www.freecodecamp.org/news/javascript-game-tutorial-stick-hero-with-html-canvas/">cloning an existing project</a> is a <a target="_blank" href="https://www.freecodecamp.org/news/learn-how-to-create-an-instagram-clone-using-react/">hands-on way to learn coding and problem-solving</a>.</p>
<p>After recreating the project, compare your work with the original. This comparison acts as a mirror, reflecting your strengths and areas for improvement.</p>
<p>Think about an app or a website you use daily. What if you tried to build a version of it yourself? This approach makes learning fun and relevant.</p>
<p>Working on something you're familiar with keeps you engaged and helps you understand the project's intricacies more deeply.</p>
<p>In your learning journey, focus on projects that challenge and enhance your skills, rather than trying to invent something entirely new. It's like practicing scales in music – they may not be glamorous, but they're essential for growth.</p>
<p>Prioritize learning and skill development over the pursuit of a groundbreaking idea. As you embark on new software projects, remember that your primary goal is to grow as a developer. It's not just about building something novel – it's about building your capabilities and confidence.</p>
<p>By replicating existing projects and focusing on the learning process, you turn each project into a valuable step in your journey.</p>
<p>This approach not only enriches your understanding but also lays a strong foundation for your future as a skilled software engineer.</p>
<p>So, grab your tools and start building – not just software, but a path to mastery in the art of development.</p>
<h1 id="heading-beyond-the-basics">Beyond the Basics</h1>
<h2 id="heading-develop-a-love-learning">Develop a Love Learning</h2>
<p>Software development is one of the most in-demand professions of our time.</p>
<p>There are constantly new job openings, which attract both youngsters and already employed people from a wide range of professions.</p>
<p>They know that you can get a really good salary working as a software engineer, and so they start their careers with great ambitions.</p>
<p>Even if you get a job in software development, if you really want to become great, it helps to love learning and programming.</p>
<p>It is one of the few professions in which you constantly have to learn something new. It’s not just the existing concepts you need to know. You have to adapt to the constant influx of new technologies.</p>
<p>You have to adapt to the changes in the market and learn whatever new things are currently considered as valuable. In short, you will have to consistently learn a lot.</p>
<p>In order to keep your brain constantly engaged in learning, you will have to be curious and stay humble.</p>
<p>Often, programmers get employed on the basis of their existing knowledge and start to think they don’t need to learn new things anymore. But you will only be able to excel as a software engineer if you are curious and love learning, as the need to learn never ceases.</p>
<p>In November 1915, after writing only two pages of what he referred to as “one of the most beautiful works of my life,” Einstein sent his 11-year-old son Hans Albert a letter.</p>
<p>He praised his son for his learning efforts, saying, “That is the way to learn the most…When you are doing something with such enjoyment that you don’t notice the time passes.”</p>
<p>“Curiosity has its own reason for existing,” Einstein explains. “One cannot help but be in awe when one contemplates the mysteries of eternity, of life, of the marvelous structure of reality.”</p>
<p>Become curious about how a framework works and is structured. When you learn something thoroughly, you gain a clear picture of its mechanisms and functionalities.</p>
<p>For example, don't simply accept that scikit-learn is a great framework for machine learning — learn how it works, behind the curtains. And consider the possibility of contributing to and improving it, as it is open source.</p>
<p>Also, try not to be overly concerned with money. Of course, we all need money to pay our bills and buy food for ourselves and our family. These are basic needs, and we need to meet them – so money is critical. But try to cultivate a passion for learning and developing for the sake of it. This will make the financial compensation all the more rewarding.</p>
<p>Try to develop a love of programming and feel grateful that you have the opportunity to positively impact the lives of millions of people with the lines of code that you write.</p>
<p>Einstein believed that “love is a better teacher than a sense of duty.”</p>
<p>What we can learn from this as software engineers is the importance of not just working for a good salary but working because we love learning and our work in general. If we can develop an intrinsic curiosity and drive that keeps us engaged after work or during the weekends when our boss is not watching, all the better.</p>
<h2 id="heading-look-at-the-bigger-picture">Look at the Bigger Picture</h2>
<p>In the fast-paced and exciting world of software engineering, it's crucial to understand that being a software engineer is about much more than just writing code.</p>
<p>Imagine you're not just a builder, but also an architect and a visionary. Your role is like being a key player in a big team, where your ideas and work help the team win.</p>
<h3 id="heading-understand-your-impact">Understand your impact</h3>
<p>When you're a software engineer, you might spend a lot of time working on specific coding tasks – like solving a puzzle piece by piece.</p>
<p>But, it's important to remember that you're actually helping to complete a much larger puzzle.</p>
<p>Let's say your company is like a big ship, and you're not just fixing parts of the ship – you're helping it reach its destination.</p>
<p>Imagine you're making an app for a local bakery. Instead of just focusing on making the buttons work, you should also think about how your app will help the bakery get more customers and make their life easier.</p>
<h3 id="heading-seeing-the-whole-not-just-the-parts">Seeing the whole, not just the parts</h3>
<p>As you grow in your career, you'll start to see not just the lines of code you write, but the whole project, like looking at a whole forest instead of just one tree.</p>
<p>This means you'll start to understand how your work affects everything else and can make decisions that help the entire business.</p>
<p>Think of a puzzle game on your phone. If you only focus on one small part, you might miss a better solution that solves more puzzles at once.</p>
<h3 id="heading-from-coding-to-contributing">From coding to contributing</h3>
<p>When you start focusing on the most important tasks, you become more than just someone who writes code. You become someone who solves big problems.</p>
<p>This is like moving from being a player in a game to being the one who helps plan the strategy of the game.</p>
<p>Imagine your company is like a garden. At first, you might be planting individual flowers (writing code). But later, you start to plan where to plant trees and how to make the garden more beautiful (strategic thinking).</p>
<h3 id="heading-more-than-a-coder">More than a coder</h3>
<p>By aligning your work with what the business really needs, you become a key player on your team. Your work starts to have a big impact, and you become someone everyone relies on.</p>
<p>It's like being a star player on a sports team who not only scores goals but also helps the team win championships.</p>
<p>If you're working on a website, don't just make it look good. Think about how it functions, how it can attract more visitors, and how it can help the business grow.</p>
<p>Being a software engineer is an amazing journey. It's not just about writing code, but about using your skills to help the business and its customers.</p>
<p>When you start to see your role in this bigger way, you grow not just as a programmer, but as a key member of your team.</p>
<p>This approach will help you develop both personally and professionally in the exciting world of software engineering.</p>
<p>Remember, you're not just building software – you're building success stories.</p>
<h2 id="heading-embrace-lifelong-learning-in-software-engineering">Embrace Lifelong Learning in Software Engineering</h2>
<p>Think of the field of software engineering not as a one-time race but as an ongoing marathon with new and exciting paths to explore at every turn.</p>
<p>Your formal education, whether you got a college degree or participated in a bootcamp or taught yourself to code – it's just the starting line.</p>
<p>What lies ahead is a thrilling adventure of continuous learning and growth.</p>
<p>Picture yourself as a detective in the world of technology. Each new challenge is a mystery waiting to be solved.</p>
<p>At first, these puzzles may seem daunting, but as you learn more, you'll find joy in piecing together the solutions. This journey enhances your confidence and turns complex problems into exciting quests.</p>
<p>In the fast-paced tech landscape, what's hot today might be forgotten tomorrow. So while it's important to stay up-to-date and aware of the latest trends, don't forget to work on the fundamentals and learn the mainstay technologies.</p>
<p>So while you'll want to learn new programming languages and frameworks, and get comfortable with the latest software, be practical about what you focus on.</p>
<p>As you learn and grow, your value as a software engineer will skyrocket.</p>
<p>This isn't just about earning a bigger paycheck – it's about getting your hands on more exciting and challenging projects.</p>
<p>Just like a sought-after artist, your up-to-date skills and knowledge can help make you a hot commodity in the tech world.</p>
<p>Imagine each new skill you learn as a key. The more keys you have, the more doors you can open. This could lead to better job offers, working on groundbreaking projects, or even guiding a team.</p>
<p>Your knowledge and experience are like a map, guiding you to a rewarding and dynamic career.</p>
<h2 id="heading-good-luck">Good Luck!</h2>
<p>Thank you for reading this handbook! I hope you now feel better equipped to break into the world of tech, grow your skills, and work towards your first – or next – developer job.</p>
<h3 id="heading-get-the-pdf-version-of-the-book">Get the PDF version of the book</h3>
<p>You can read this book as a PDF by downloading it <a target="_blank" href="https://fatosmorina.gumroad.com/l/coding-for-everyone">here</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Learn Python Programming – Everything You Need to Know (Free Book) ]]>
                </title>
                <description>
                    <![CDATA[ Python is one of the most popular programming languages in the world today. It was created in 1991 by Guido van Rossum. According to van Rossum, Python is a: “high-level programming language, and its core design philosophy is all about code readabil... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/learn-python-book/</link>
                <guid isPermaLink="false">66d45f03d7a4e35e3843496b</guid>
                
                    <category>
                        <![CDATA[ beginners guide ]]>
                    </category>
                
                    <category>
                        <![CDATA[ book ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Thu, 27 Oct 2022 16:38:20 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/10/pexels-christina-morillo-1181359--4-.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Python is one of the most popular programming languages in the world today. It was created in 1991 by Guido van Rossum.</p>
<p>According to van Rossum, Python is a:</p>
<blockquote>
<p>“high-level programming language, and its core design philosophy is all about code readability and a syntax which allows programmers to express concepts in a few lines of code.”</p>
</blockquote>
<h2 id="heading-benefits-of-learning-python">Benefits of Learning Python</h2>
<p>Python is one of the easiest languages that you can learn and work with. You can use it for software development, server side of web development, machine learning, mathematics, and any type of scripting that you can think of.</p>
<p>The good thing about Python is that it is widely used and accepted by many companies and academic institutions. This makes it a really good choice, especially if you are just starting your coding journey.</p>
<p>Python also has a large community of developers that use it and are willing to help you if you get stuck or have questions. This community has already published many open source libraries that you can start using. They also actively keep improving them.</p>
<p>Python's syntax is quite similar to that of the English language, which makes it easier for you to understand and use quite intuitively.</p>
<p>Python runs on an interpreter system, meaning that you don't have to wait for a compiler to compile the code and then execute it. You can instead build prototypes quickly.</p>
<p>It also works on different platforms, such as Windows, Linux, Mac, Rapsberry Pi, and so on.</p>
<p>So you see – it's a great programming language, whether you're just starting out or you're looking to add another useful tool to your kit.</p>
<p>Here's what we'll cover in this book:</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><p><a class="post-section-overview" href="#heading-python-basics">Python Basics</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-operators-in-python">Operators in Python</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-data-types-in-python">Data types in Python</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-tuples-in-python">Tuples in Python</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-dictionaries-in-python-key-value-data-structures">Dictionaries in Python</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-sets-in-python">Sets in Python</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-type-conversions-in-python">Type Conversions in Python</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-control-flow-in-python">Control Flow in Python</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-functions-in-python">Functions in Python</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-object-oriented-programming-in-python">Object Oriented Programming in Python</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-importing-in-python">Importing in Python</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-handle-exceptions-in-python">How to Handle Exceptions in Python</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-user-input-in-python">User Input in Python</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-get-the-book-as-a-pdf">Get the PDF version of the book</a></p>
</li>
</ul>
<h1 id="heading-python-basics">Python Basics</h1>
<h2 id="heading-indentation-in-python">Indentation in Python</h2>
<p>Compared to other languages, Python places special importance on indentation.</p>
<p>In other programming languages, white spaces and indentations are only used to make the code more readable and prettier. But in Python, they represent a sub-block of code.</p>
<p>The following code is not going to work, since the second line is not properly intended:</p>
<pre><code class="lang-python"><span class="hljs-keyword">if</span> <span class="hljs-number">100</span> &gt; <span class="hljs-number">10</span>:
  print(<span class="hljs-string">"100 is greater than 10"</span>)
</code></pre>
<p>For it to work properly, the indentation should look like the following:</p>
<pre><code class="lang-python"><span class="hljs-keyword">if</span> <span class="hljs-number">100</span> &gt; <span class="hljs-number">10</span>:
    print(<span class="hljs-string">"100 is greater than 10"</span>)
</code></pre>
<p>This may look hard to understand, but you can use a code editor that highlights such syntax errors quite vividly. Moreover, the more Python code you write, the easier it gets for you to consider such indentations as second nature.</p>
<p>Python uses four spaces for proper indentation by default.</p>
<h2 id="heading-comments-in-python">Comments in Python</h2>
<p>We use comments to specify parts of the program that should be simply ignored and not executed by the Python interpreter. This means that everything written inside a comment is not taken into consideration at all and you can write in any language that you want, including your own native language.</p>
<p>In Python, you start a comment with the symbol <em>#</em> in front of the line:</p>
<pre><code class="lang-python"><span class="hljs-comment"># This is a comment in Python</span>
</code></pre>
<p>You can also include more extended comments in multiple lines using triple quotes:</p>
<pre><code class="lang-python"><span class="hljs-string">"""
This is a comment in Python.
Here we are typing in another line and we are still inside the same comment block.

In the previous line we have a space, because it's allowed to have spaces inside comments.

Let's end this comment right here.
"""</span>
</code></pre>
<h2 id="heading-print-method-in-python">print() method in Python</h2>
<p>We are going to use the method <code>print()</code> since it helps us see results in the console.</p>
<p>You do not need to know how it works behind the scenes or even know what a method is right now. Just think of it as a way for us to display results from our code in the console.</p>
<h1 id="heading-operators-in-python">Operators in Python</h1>
<h2 id="heading-arithmetic-operators-in-python">Arithmetic operators in Python</h2>
<p>Even though you can just pull out your phone from your pocket and do some calculations, you should also get used to implementing some arithmetic operators in Python.</p>
<p>When we want to add two numbers, we use the plus sign, just like in math:</p>
<pre><code class="lang-python">print(<span class="hljs-number">50</span> + <span class="hljs-number">4</span>)  <span class="hljs-comment"># 54</span>
</code></pre>
<p>Similarly, for subtraction, we use the minus sign:</p>
<pre><code class="lang-python">print(<span class="hljs-number">50</span> - <span class="hljs-number">4</span>)  <span class="hljs-comment"># 46</span>
</code></pre>
<p>For multiplication, we use the star or asterisk:</p>
<pre><code class="lang-python">print(<span class="hljs-number">50</span> * <span class="hljs-number">4</span>)  <span class="hljs-comment"># 200</span>
</code></pre>
<p>When doing divisions, we use the forward slash sign:</p>
<pre><code class="lang-python">print(<span class="hljs-number">50</span> / <span class="hljs-number">4</span>)  <span class="hljs-comment"># 12.5</span>
print(<span class="hljs-number">8</span> / <span class="hljs-number">4</span>)  <span class="hljs-comment"># 2.0</span>
</code></pre>
<p>This results in float numbers. If we want to only get the integer number when doing division (also known as simply doing floor division), we should use the double fraction sign:</p>
<pre><code class="lang-python">print(<span class="hljs-number">50</span> // <span class="hljs-number">4</span>)  <span class="hljs-comment"># 12</span>
print(<span class="hljs-number">8</span> / <span class="hljs-number">4</span>)  <span class="hljs-comment"># 2</span>
</code></pre>
<p>We can also find the remainder of a number divided by another number using the percent sign <code>%</code>.</p>
<pre><code class="lang-python">print(<span class="hljs-number">50</span> % <span class="hljs-number">4</span>)  <span class="hljs-comment"># 2</span>
</code></pre>
<p>This operation can be helpful especially in cases when we want to check whether a number is odd or even. A number is odd if when divided by 2, the remainder is 1. Otherwise, it is even.</p>
<p>Here is an illustration:</p>
<pre><code class="lang-python">print(<span class="hljs-number">50</span> % <span class="hljs-number">2</span>)  <span class="hljs-comment"># 0</span>
<span class="hljs-comment"># Since the remainder is 0, this number is even</span>

print(<span class="hljs-number">51</span> % <span class="hljs-number">2</span>)  <span class="hljs-comment"># 1</span>
<span class="hljs-comment">#Since the remainder is 1, this number is odd</span>
</code></pre>
<p>When we want to raise a number to a specific power, we should use the double star sign:</p>
<pre><code class="lang-python">print(<span class="hljs-number">2</span> ** <span class="hljs-number">3</span>)  <span class="hljs-comment"># 8</span>
<span class="hljs-comment"># This is a short way of writing 2 * 2 * 2</span>

print(<span class="hljs-number">5</span> ** <span class="hljs-number">4</span>)  <span class="hljs-comment"># 625</span>
<span class="hljs-comment"># This is a short way of writing 5 * 5 * 5 * 5</span>
</code></pre>
<h2 id="heading-assignment-operators-in-python">Assignment operators in Python</h2>
<p>You use these operators to assign values to variables.</p>
<p>When we declare a variable, we use the equal sign:</p>
<pre><code class="lang-python">name = <span class="hljs-string">"Fatos"</span>
age = <span class="hljs-number">28</span>
</code></pre>
<p>We can also declare multiple variables in the same line:</p>
<pre><code class="lang-python">name, age, location = <span class="hljs-string">"Fatos"</span>, <span class="hljs-number">28</span>, <span class="hljs-string">"Europe"</span>
</code></pre>
<p>We can use this as a way to also swap values between variables. For example, let's say that we have two variables <code>a</code> and <code>b</code> and we want to switch their values.</p>
<p>One logical way to do that would be to introduce a third variable that serves as a temporary variable:</p>
<pre><code class="lang-python">a, b = <span class="hljs-number">1</span>, <span class="hljs-number">2</span>

print(a)  <span class="hljs-comment"># 1</span>
print(b)  <span class="hljs-comment"># 2</span>

c = a
a = b
b = c

print(a)  <span class="hljs-comment"># 2</span>
print(b)  <span class="hljs-comment"># 1</span>
</code></pre>
<p>We can do that in a single line in the following way:</p>
<pre><code class="lang-python">a, b = <span class="hljs-number">1</span>, <span class="hljs-number">2</span>

print(a)  <span class="hljs-comment"># 1</span>
print(b)  <span class="hljs-comment"># 2</span>

b, a = a, b

print(a)  <span class="hljs-comment"># 2</span>
print(b)  <span class="hljs-comment"># 1</span>
</code></pre>
<p>We can also merge the assignment operators with arithmetic operators.</p>
<p>Let's see how we can do that for addition first.</p>
<p>Let's assume that we have the following variables:</p>
<pre><code class="lang-python">total_sum = <span class="hljs-number">20</span>

current_sum = <span class="hljs-number">10</span>
</code></pre>
<p>Now we want to add the value of the <code>current_sum</code> to <code>total_sum</code>. To do that, we should write the following:</p>
<pre><code class="lang-python">total_sum = total_sum + current_sum

print(total_sum)  <span class="hljs-comment"># 30</span>
</code></pre>
<p>This may not look accurate, since the right hand side is not equal to the left hand side. However, in this case we are simply doing an assignment and not a comparison of both sides of the equation.</p>
<p>To do this quickly, we can use the following form:</p>
<pre><code class="lang-python">total_sum += current_sum

print(total_sum)  <span class="hljs-comment"># 30</span>
</code></pre>
<p>This is equivalent to the previous statement.</p>
<p>Similarly, we can do the same with other arithmetic operators:</p>
<p>Subtraction:</p>
<pre><code class="lang-python">result = <span class="hljs-number">3</span>
number = <span class="hljs-number">4</span>

result -= number  <span class="hljs-comment"># This is equal to result = result - number</span>

print(result)  <span class="hljs-comment"># -1</span>
</code></pre>
<p>Multiplication:</p>
<pre><code class="lang-python">product = <span class="hljs-number">3</span>
number = <span class="hljs-number">4</span>

product *= number  <span class="hljs-comment"># This is equal to product = product * number</span>

print(product)  <span class="hljs-comment"># 12</span>
</code></pre>
<p>Division:</p>
<pre><code class="lang-python">result = <span class="hljs-number">8</span>
number = <span class="hljs-number">4</span>

result /= number  <span class="hljs-comment"># This is equal to result = result / number</span>

print(result)  <span class="hljs-comment"># 2.0</span>
</code></pre>
<p>Modulo operator:</p>
<pre><code class="lang-python">result = <span class="hljs-number">8</span>
number = <span class="hljs-number">4</span>

result %= number  <span class="hljs-comment"># This is equal to result = result % number</span>

print(result)  <span class="hljs-comment"># 0</span>
</code></pre>
<p>Power operator:</p>
<pre><code class="lang-python">result = <span class="hljs-number">2</span>
number = <span class="hljs-number">4</span>

result **= number  <span class="hljs-comment"># This is equal to result = result ** number</span>

print(result)  <span class="hljs-comment"># 16</span>
</code></pre>
<h2 id="heading-comparison-operators-in-python">Comparison operators in Python</h2>
<p>You likely learned how to do basic comparisons of numbers in school, such as checking whether a specific number is larger than another number, or whether they are equal.</p>
<p>We can use almost the same operators in Python to do such comparisons.</p>
<p>Let's see them in action.</p>
<h3 id="heading-equality-operators">Equality operators</h3>
<p>You can check whether two numbers are equal using the <code>==</code> operator:</p>
<pre><code class="lang-python">print(<span class="hljs-number">2</span> == <span class="hljs-number">3</span>)  <span class="hljs-comment"># False</span>
</code></pre>
<p>The last expression evaluates to False since <code>2</code> is not equal to <code>3</code>.</p>
<p>There is another operator that you can use to check whether 2 numbers are not equal. This is an operator that you may have not have seen in your math classes written exactly in this way. This is the operator <code>!=</code>.</p>
<p>Let's do a comparison of whether <code>2</code> is not equal to <code>3</code>:</p>
<pre><code class="lang-python">print(<span class="hljs-number">2</span> != <span class="hljs-number">3</span>)  <span class="hljs-comment"># True</span>
</code></pre>
<p>This expression evaluates to True since <code>2</code> is indeed not equal to <code>3</code>.</p>
<h3 id="heading-inequality-operators">Inequality operators</h3>
<p>Now here we are going to see how to check whether a number is larger than another number:</p>
<pre><code class="lang-python">print(<span class="hljs-number">2</span> &gt; <span class="hljs-number">3</span>)  <span class="hljs-comment"># False</span>
</code></pre>
<p>This is something that you should already know from your math classes.</p>
<p>When trying to check whether a number is greater than or equal to another number, we need to use this operator <code>&gt;=</code>:</p>
<pre><code class="lang-python">print(<span class="hljs-number">2</span> &gt;= <span class="hljs-number">3</span>)  <span class="hljs-comment"># False</span>
</code></pre>
<p>Similarly, to check whether a number is less than or equal to another, we have:</p>
<pre><code class="lang-python">print(<span class="hljs-number">2</span> &lt; <span class="hljs-number">3</span>)  <span class="hljs-comment"># True</span>
print(<span class="hljs-number">2</span> &lt;= <span class="hljs-number">3</span>)  <span class="hljs-comment"># True</span>
</code></pre>
<h3 id="heading-logical-operators">Logical operators</h3>
<p>In high school math, you may have learned about logical operators such as <code>and</code> and <code>or</code>.</p>
<p>Briefly speaking, for an expression to evaluate to True when using <code>and</code>, both statements should be true. In Python, we implement it using <code>and</code>:</p>
<pre><code class="lang-python">print(<span class="hljs-number">5</span> &gt; <span class="hljs-number">0</span> <span class="hljs-keyword">and</span> <span class="hljs-number">3</span> &lt; <span class="hljs-number">5</span>)  <span class="hljs-comment"># True</span>
</code></pre>
<p>This example is going to evaluate to True since <code>5</code> is greater than <code>0</code>, which evaluates to True, and <code>3</code> is less than <code>5</code>, which also evaluates to True. From this we get True and True, which evaluates to True.</p>
<p>Let's take an example when an <code>and</code> expression is going to evaluate to <code>False</code>:</p>
<pre><code class="lang-python">print(<span class="hljs-number">2</span> &gt; <span class="hljs-number">5</span> <span class="hljs-keyword">and</span> <span class="hljs-number">0</span> &gt; <span class="hljs-number">-1</span>)  <span class="hljs-comment"># False</span>
</code></pre>
<p><code>2</code> is not greater than <code>5</code>, so the statement in the left hand side is going to evaluate to False. No matter what's on the right hand side, we are going to get the whole expression equal to <code>False</code>, since False and any other value (like True) are going to result in False.</p>
<p>When you have statements where at least one of them should evaluate to True, then we should use the <code>or</code> operator:</p>
<pre><code class="lang-python">print(<span class="hljs-number">2</span> &gt; <span class="hljs-number">5</span> <span class="hljs-keyword">or</span> <span class="hljs-number">0</span> &gt; <span class="hljs-number">-1</span>)  <span class="hljs-comment"># True</span>
</code></pre>
<p>This is going to evaluate to True since the statement in the right hand side evaluates to True – so at least one of them is true.</p>
<p>If both statements are False, then <code>or</code> results in <code>False</code> in the end:</p>
<pre><code class="lang-python">print(<span class="hljs-number">2</span> &lt; <span class="hljs-number">0</span> <span class="hljs-keyword">or</span> <span class="hljs-number">0</span> &gt; <span class="hljs-number">1</span>)  <span class="hljs-comment"># False</span>
</code></pre>
<p>This is False since 0 is not greater than 2 and also 0 is not greater than 1. So the whole expression is False.</p>
<h1 id="heading-data-types-in-python">Data Types in Python</h1>
<h2 id="heading-variables-in-python">Variables in Python</h2>
<p>You can think about variables as the building blocks of any computer program that you might write.</p>
<p>You can use variables to store values and then reuse them as many times as you want. The moment you want to change a value, you can just change it in one place and that new value that you just changed is going to get reflected everywhere else where that variable is used.</p>
<p>Every variable in Python is an object.</p>
<p>A variable is created in the moment it is initialized with a value.</p>
<p>Here are the general rules for Python variables:</p>
<ul>
<li><p>A variable name must start with a letter or the underscore character. It cannot start with a number.</p>
</li>
<li><p>A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ).</p>
</li>
<li><p>Variable names are case-sensitive, meaning that <code>height</code>, <code>Height</code>, and <code>HEIGHT</code> are all different variables.</p>
</li>
</ul>
<p>Let's define our first variable:</p>
<pre><code class="lang-python">age = <span class="hljs-number">28</span>
</code></pre>
<p>In this example, we are initializing a variable with the name <em>age</em> and assigning the value 28 to it.</p>
<p>We can define other variables along with it, like:</p>
<pre><code class="lang-python">age = <span class="hljs-number">28</span>
salary = <span class="hljs-number">10000</span>
</code></pre>
<p>We can use pretty much any name that we want, but it is a better practice to use names that both you and other any colleagues who work with you can understand.</p>
<p>We have other variable types in Python, such as float numbers, strings, and boolean values. We can even create our own custom types.</p>
<p>Let's see an example of a variable that holds a float number:</p>
<pre><code class="lang-python">height = <span class="hljs-number">3.5</span>
</code></pre>
<p>As you can see, this initialization is quite similar to the ones when we had integer numbers. Here we are only changing the value on the right. The Python interpreter is smart enough to know that we are dealing with another type of variable, namely a float type of variable.</p>
<p>Let's see an example of a string:</p>
<pre><code class="lang-python">reader = <span class="hljs-string">"Fatos"</span>
</code></pre>
<p>We put string values either in double quotes or single quotes to specify the value that we want to store in string variables.</p>
<p>When we want to store boolean values, we need to use reserved words, namely, <em>True</em> and <em>False</em>.</p>
<pre><code class="lang-python">text_visibile = <span class="hljs-literal">False</span>
</code></pre>
<p>We can also have a boolean value stored when we have expressions that result with a boolean value, for example, when we compare a number with another number, such as:</p>
<pre><code class="lang-python">is_greater = <span class="hljs-number">5</span> &gt; <span class="hljs-number">6</span>
</code></pre>
<p>This variable is going to get initialized with the value <em>False</em> since 5 is lower than 6.</p>
<h2 id="heading-numbers-in-python">Numbers in Python</h2>
<p>We have three numeric types in Python: integers, floats, and complex numbers.</p>
<h3 id="heading-integers">Integers</h3>
<p>Integers represent whole numbers that can be both positive and negative and do not contain any decimal part.</p>
<p>Here are a few examples of integers: <code>1</code>, <code>3000</code>, <code>-31234</code>, and so on.</p>
<p>When adding, subtracting, or multiplying two integers, we get an integer as a result in the end.</p>
<pre><code class="lang-python">print(<span class="hljs-number">3</span> + <span class="hljs-number">5</span>)  <span class="hljs-comment"># 8</span>
print(<span class="hljs-number">3</span> - <span class="hljs-number">5</span>)  <span class="hljs-comment"># -2</span>
print(<span class="hljs-number">3</span> * <span class="hljs-number">5</span>)  <span class="hljs-comment"># 15</span>
</code></pre>
<p>These are all integers.</p>
<p>This also includes cases when we raise a number to a power:</p>
<pre><code class="lang-python">result = <span class="hljs-number">3</span> ** <span class="hljs-number">4</span>  <span class="hljs-comment"># This is similar to multiplying 3 * 3 * 3 * 3 in which case, we are multiplying integers together</span>
print(result)  <span class="hljs-comment"># 81</span>
</code></pre>
<p>When we want to divide two integers, we are going to get a float number.</p>
<h3 id="heading-booleans">Booleans</h3>
<p>The boolean type represents truth values, True and False. You learned the explanation of this type in the <em>Numbers</em> section, since booleans are indeed subtypes of the integer type.</p>
<p>More specifically, almost always a False value can be considered as a <code>0</code>, whereas a True value can be considered as a <code>1</code>.</p>
<p>As such, we can also do arithmetic operations with them:</p>
<pre><code class="lang-python">print(<span class="hljs-literal">True</span> * <span class="hljs-number">5</span>)  <span class="hljs-comment"># 5</span>
print(<span class="hljs-literal">False</span> * <span class="hljs-number">500</span>)  <span class="hljs-comment"># 0, since False is equal to 0</span>
</code></pre>
<p>The exception for such integer representations of Boolean values is when these values are strings such as "False" and "True".</p>
<h3 id="heading-floats">Floats</h3>
<p>Float numbers are numbers that contain the decimal part, such as <code>-3.14</code>, <code>12.031</code>, <code>9.3124</code>, and so on.</p>
<p>We can also convert to float numbers using the <code>float()</code> function:</p>
<pre><code class="lang-python">ten = float(<span class="hljs-number">10</span>)

print(ten)  <span class="hljs-comment"># 10.0</span>
</code></pre>
<p>When adding, subtracting, or dividing two float numbers, or a float number and an integer, we get a float number as a result in the end:</p>
<pre><code class="lang-python">print(<span class="hljs-number">3.4</span> * <span class="hljs-number">2</span>)  <span class="hljs-comment"># 6.8</span>
print(<span class="hljs-number">3.4</span> + <span class="hljs-number">2</span>)  <span class="hljs-comment"># 5.4</span>
print(<span class="hljs-number">3.4</span> - <span class="hljs-number">2</span>)  <span class="hljs-comment"># 1.4</span>
print(<span class="hljs-number">2.1</span> * <span class="hljs-number">3.4</span>)  <span class="hljs-comment"># 7.14</span>
</code></pre>
<h3 id="heading-complex-numbers">Complex numbers</h3>
<p>Complex numbers have both the real and the <em>imaginary</em> part that we write in the following way:</p>
<pre><code class="lang-python">complex_number = <span class="hljs-number">1</span> + <span class="hljs-number">5j</span>

print(complex_number)  <span class="hljs-comment"># (1+5j)</span>
</code></pre>
<h2 id="heading-strings-in-python">Strings in Python</h2>
<p>Strings represent characters that are enclosed in either single quotes or double quotes. Both of them are treated the same:</p>
<pre><code class="lang-python">name = <span class="hljs-string">"Fatos"</span>  <span class="hljs-comment"># Double quotes</span>

name = <span class="hljs-string">'Fatos'</span>  <span class="hljs-comment"># Single quotes</span>
</code></pre>
<p>If we want to include a quote inside a string, we need to let Python know that it should not close the string but simply escape that quote:</p>
<pre><code class="lang-python">greeting = <span class="hljs-string">'Hello. I\'m fine.'</span>  <span class="hljs-comment"># We escaped the apostrophe in I'm.</span>

double_quote_greeting = <span class="hljs-string">"Hello. I'm fine."</span>  <span class="hljs-comment"># When using double quotes, we do not need to escape the apostrophe</span>
</code></pre>
<p>When we want to include a new line in a string, we can include the special character <code>\n</code>:</p>
<pre><code class="lang-python">my_string = <span class="hljs-string">"I want to continue \n in the next line"</span>

print(my_string) 
<span class="hljs-comment"># I want to continue </span>
<span class="hljs-comment"># in the next line</span>
</code></pre>
<p>Since strings are arrays of characters, we can index specific characters using indexes. Indexes start from 0 and go all the way until the length of the string minus 1.</p>
<p>We exclude the index that is equal to the length of the string since we start indexing from 0 and not from 1.</p>
<p>Here is an example:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"Word"</span>
</code></pre>
<p>In this example, if we were to select individual characters of the string, they would unfold as follows:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"Word"</span>

print(string[<span class="hljs-number">0</span>])  <span class="hljs-comment"># W</span>
print(string[<span class="hljs-number">1</span>])  <span class="hljs-comment"># o</span>
print(string[<span class="hljs-number">2</span>])  <span class="hljs-comment"># r</span>
print(string[<span class="hljs-number">3</span>])  <span class="hljs-comment"># d</span>
</code></pre>
<p>We can use negative indexes as well, which means that we start from the end of the string with <code>-1</code>. We cannot use <code>0</code> to index from the end of a string, since <code>-0 = 0</code>:</p>
<pre><code class="lang-python">print(string[<span class="hljs-number">-1</span>])  <span class="hljs-comment"># d</span>
print(string[<span class="hljs-number">-2</span>])  <span class="hljs-comment"># r</span>
print(string[<span class="hljs-number">-3</span>])  <span class="hljs-comment"># o</span>
print(string[<span class="hljs-number">-4</span>])  <span class="hljs-comment"># W</span>
</code></pre>
<p>We can also do slicing and include only a portion of the string and not the entire string. For example, if we want to get characters that start from a specific index until a specific index, we should write it in the following way: <code>string[start_index:end_index]</code>, excluding the character at index <code>end_index</code>:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"Word"</span>

print(string[<span class="hljs-number">0</span>:<span class="hljs-number">3</span>])  <span class="hljs-comment"># Wor</span>
</code></pre>
<p>If we want to start from a specific index and continue getting all the remaining characters of the string until the end, we can omit specifying the end index, as follows:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"Word"</span>

print(string[<span class="hljs-number">2</span>:])  <span class="hljs-comment"># rd</span>
</code></pre>
<p>If we want to start from 0 and go until a specific index, we can simply specify the ending index:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"Word"</span>

print(string[:<span class="hljs-number">2</span>])  <span class="hljs-comment"># Wo</span>
</code></pre>
<p>This means that the value of <code>string</code> is equal to <code>string[:2]</code> (excluding the character at position 2) + <code>string[2:]</code>.</p>
<p>Note that strings in Python are immutable. This means that once a string object has been created, it cannot be modified, such as trying to change a character in a string.</p>
<p>As an illustration, let's say that we want to change the first character in the string, namely switching <code>W</code> with <code>A</code> in the following way:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"Word"</span>
string[<span class="hljs-number">0</span>] = <span class="hljs-string">"A"</span>
</code></pre>
<p>Now, if we try to print <code>string</code>, we would get an error like the following:</p>
<pre><code class="lang-python"><span class="hljs-comment"># TypeError: 'str' object does not support item assignment</span>
</code></pre>
<p>If we need a new string, we should simply create a new one.</p>
<h3 id="heading-string-operators">String operators</h3>
<p>We can concatenate strings using the <code>+</code> operator:</p>
<pre><code class="lang-python">first = <span class="hljs-string">"First"</span>
second = <span class="hljs-string">"Second"</span>

concantenated_version = first + <span class="hljs-string">" "</span> + second

print(concatenated_version)  <span class="hljs-comment"># First Second</span>
</code></pre>
<p>We can use the multiplication operator <code>*</code> with strings and numbers.</p>
<p>You can use this to repeat the string that many times. For example, if we want to repeat a string 5 times, but we do not want to write it manually five times, we can simply multiply it with the number 5:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"Abc"</span>

repeated_version = string * <span class="hljs-number">5</span>

print(repeated_version)  <span class="hljs-comment"># AbcAbcAbcAbcAbc</span>
</code></pre>
<h3 id="heading-string-built-in-methods">String built-in methods</h3>
<p>There are a few built-in methods of strings that we can use that can make it easier for us to manipulate with them.</p>
<h4 id="heading-len-method"><code>len()</code> method</h4>
<p><code>len()</code> is a method that we can use to get the length of a string:</p>
<pre><code class="lang-python">sentence = <span class="hljs-string">"I am fine."</span>

print(len(sentence))  <span class="hljs-comment"># 10</span>
</code></pre>
<h4 id="heading-replace-method"><code>replace()</code> method</h4>
<p>We can use <code>replace()</code> to replace a character or a substring of a string with another character or substring:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"Abc"</span>

modified_version = string.replace(<span class="hljs-string">"A"</span>, <span class="hljs-string">"Z"</span>)

print(modified_version)  <span class="hljs-comment"># Zbc</span>
</code></pre>
<h4 id="heading-strip-method"><code>strip()</code> method</h4>
<p><code>strip()</code> removes white spaces that can be in the beginning or at the end of a string:</p>
<pre><code class="lang-python">string = <span class="hljs-string">" Hi there "</span>

print(string.strip())  <span class="hljs-comment"># Hi there</span>
</code></pre>
<h4 id="heading-split-method"><code>split()</code> method</h4>
<p>We can use <code>split()</code> to convert a string into an array of substrings based on a specific pattern that is mentioned as the separator.</p>
<p>For example, let's assume that we want to save all words of a sentence in an array of words. These words are separated by white spaces, so we will need to do the splitting based on that:</p>
<pre><code class="lang-python">sentence = <span class="hljs-string">"This is a sentence that is being declared here"</span>

print(string.split(<span class="hljs-string">" "</span>)) 
<span class="hljs-comment"># ['This', 'is', 'a', 'sentence', 'that', 'is', 'being', 'declared', 'here']</span>
</code></pre>
<h4 id="heading-join-method"><code>join()</code> method</h4>
<p><code>join()</code> is the opposite of <code>split()</code>: from an array of strings, it returns a string. The process of concatenation is supposed to happen with a specified separator in between each element of the array that in the end results in a single concatenated string:</p>
<pre><code class="lang-python">words = [<span class="hljs-string">"cat"</span>, <span class="hljs-string">"dog"</span>, <span class="hljs-string">"rabbit"</span>]

print(<span class="hljs-string">" - "</span>.join(words))  <span class="hljs-comment"># cat - dog - rabbit</span>
</code></pre>
<h4 id="heading-count-method"><code>count()</code> method</h4>
<p>We can use <code>count()</code> to count the number of times a character or a substring appears in a string:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"Hi there"</span>

print(string.count(<span class="hljs-string">"h"</span>))  <span class="hljs-comment"># 1, since, it is case sensitive and 'h' is not equal to 'H'</span>

print(string.count(<span class="hljs-string">"e"</span>))  <span class="hljs-comment"># 2</span>

print(string.count(<span class="hljs-string">"Hi"</span>))  <span class="hljs-comment"># 1</span>

print(string.count(<span class="hljs-string">"Hi there"</span>))  <span class="hljs-comment"># 1</span>
</code></pre>
<h4 id="heading-find-method"><code>find()</code> method</h4>
<p><code>find()</code> lets us find a character or a substring in a string and returns the index of it. In case it does not find it, it will simply return <code>-1</code>:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"Hi there"</span>

print(string.find(<span class="hljs-string">"3"</span>))  <span class="hljs-comment"># -1</span>

print(string.find(<span class="hljs-string">"e"</span>))  <span class="hljs-comment"># 5</span>

print(string.find(<span class="hljs-string">"Hi"</span>))  <span class="hljs-comment"># 0</span>

print(string.find(<span class="hljs-string">"Hi there"</span>))  <span class="hljs-comment"># 0</span>
</code></pre>
<h4 id="heading-lower"><code>lower()</code></h4>
<p><code>lower()</code> converts all characters of a string into lower case:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"Hi there"</span>

print(string.lower())  <span class="hljs-comment"># hi there</span>
</code></pre>
<h4 id="heading-upper"><code>upper()</code></h4>
<p><code>upper()</code> converts all characters of a string into upper case:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"Hi there"</span>

print(string.upper())  <span class="hljs-comment"># HI THERE</span>
</code></pre>
<h4 id="heading-capitalize-method"><code>capitalize()</code> method</h4>
<p>We can use <code>capitalize()</code> to covert the first character of a string into uppercase:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"hi there"</span>

print(string.capitalize())  <span class="hljs-comment"># Hi there</span>
</code></pre>
<h4 id="heading-title-method"><code>title()</code> method</h4>
<p><code>title()</code> converts starting characters of each word (sequences that are separated by white spaces) of a string into uppercase:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"hi there"</span>

print(string.title())  <span class="hljs-comment"># Hi There</span>
</code></pre>
<h4 id="heading-isupper-method"><code>isupper()</code> method</h4>
<p><code>isupper()</code> is a method that we can use to check whether all characters in a string are upper case:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"are you HERE"</span>
another_string = <span class="hljs-string">"YES"</span>

print(string.isupper())  <span class="hljs-comment"># False</span>
print(another_string.isupper())  <span class="hljs-comment"># True</span>
</code></pre>
<h4 id="heading-islower-method"><code>islower()</code> method</h4>
<p><code>islower()</code> similarly checks whether all characters are lower case:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"are you HERE"</span>
another_string = <span class="hljs-string">"no"</span>

print(string.islower())  <span class="hljs-comment"># False</span>
print(another_string.islower())  <span class="hljs-comment"># True</span>
</code></pre>
<h4 id="heading-isalpha-method"><code>isalpha()</code> method</h4>
<p><code>isalpha()</code> returns True if all characters in a string are letters of the alphabet:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"A1"</span>
another_string = <span class="hljs-string">"aA"</span>

print(string.isalpha())  <span class="hljs-comment"># False, since it contains 1</span>
print(another_string.isalpha())  <span class="hljs-comment"># True since both `a` and `A` are letters of the alphabet</span>
</code></pre>
<h4 id="heading-isdecimal-method"><code>isdecimal()</code> method</h4>
<p><code>isdecimal()</code> returns True if all characters in a string are numbers:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"A1"</span>
another_string = <span class="hljs-string">"3.31"</span>
yet_another_string = <span class="hljs-string">"3431"</span>

print(string.isdecimal())  <span class="hljs-comment"># False, since it contains 'A'</span>
print(another_string.isdecimal())  <span class="hljs-comment"># False, since it contains '.'</span>
print(yet_another_string.isdecimal())  <span class="hljs-comment"># True, since it contains only numbers</span>
</code></pre>
<h3 id="heading-string-formatting">String Formatting</h3>
<p>Formatting a string can be quite useful since you may be using it quite frequently no matter the type of project or script that you are working on.</p>
<p>Let's first illustrate why we need formatting and include string interpolation.</p>
<p>Imagine that I want to develop a software that greets people the moment they come in, such as:</p>
<pre><code class="lang-python">greeting = <span class="hljs-string">"Good morning Fatos."</span>
</code></pre>
<p>This now looks great, but I am not the only person who uses it, right?</p>
<p>I am just one of the people who gets to use it.</p>
<p>Now if someone comes and signs in, I will have to use their own names, such as:</p>
<pre><code class="lang-python">greeting = <span class="hljs-string">"Good morning Besart."</span>
</code></pre>
<p>This is just my first real user who is registering. I am not counting myself.</p>
<p>Now let's think that I get lucky and the second user also pops in on a Friday morning and our application should display:</p>
<pre><code class="lang-python">greeting = <span class="hljs-string">"Good morning Betim."</span>
</code></pre>
<p>As you can see, we are getting somewhere from a business perspective since two new users just showed up, but this is not a scalable implementation. We are writing a very static <code>greeting</code> expression.</p>
<p>You should already remember that we are about to mention something that I introduced back at the beginning.</p>
<p>Yes, we will need to use variables and include a variable next to the string, as follows:</p>
<pre><code class="lang-python">greeting = <span class="hljs-string">"Good morning "</span> + first_name
</code></pre>
<p>This is much more flexible.</p>
<p>This is one way of doing that.</p>
<p>Another way you can do this is using a method called <code>format()</code>.</p>
<p>We can use curly braces to specify places where we want to put dynamic values, such as the following:</p>
<pre><code class="lang-python">greeting = <span class="hljs-string">"Good morning {}. Today is {}."</span>.format(<span class="hljs-string">"Fatos"</span>, <span class="hljs-string">"Friday"</span>)
</code></pre>
<p>This is now going to put the first parameter of the method <code>format()</code> inside the first curly braces, which in our case is <code>Fatos</code>. Then, in the second occurrence of the curly braces, it is going to put the second parameter of the method <code>format()</code>.</p>
<p>If we try to print the value of the string, we should get the following:</p>
<pre><code class="lang-python">print(greeting)
<span class="hljs-comment"># Good morning Fatos. Today is Friday.</span>
</code></pre>
<p>We can specify parameters with indexes inside curly braces like the following that can then be used:</p>
<pre><code class="lang-python">greeting = <span class="hljs-string">"Today is {1}. Have a nice day {0}"</span>.format(<span class="hljs-string">"Fatos"</span>, <span class="hljs-string">"Friday"</span>)

print(greeting)
<span class="hljs-comment"># greeting = "Today is {1}. Have a nice day {0}.".format("Fatos", "Friday")</span>
</code></pre>
<p>We can also specify parameters inside the <code>format()</code> method and use those specific words inside curly braces as a reference:</p>
<pre><code class="lang-python">greeting = <span class="hljs-string">"Today is {day_of_the_week}. Have a nice day {first_name}."</span>.format(first_name=<span class="hljs-string">"Fatos"</span>,
                                                                              day_of_the_week=<span class="hljs-string">"Friday"</span>)
print(greeting)  <span class="hljs-comment"># Today is Friday. Have a nice day Fatos.</span>
</code></pre>
<p>We can combine both types of arguments in a single example, such as the following:</p>
<pre><code class="lang-python">short_bio = <span class="hljs-string">'My name is {name}. My last name is {0}. I love {passion}. I like playing {1}.'</span>.format(
    <span class="hljs-string">'Morina'</span>,
    <span class="hljs-string">'Basketball'</span>,
    name=<span class="hljs-string">'Fatos'</span>,
    passion=<span class="hljs-string">'Programming'</span>
)

print(short_bio)
<span class="hljs-comment"># My name is Fatos. My last name is Morina. I love Programming. I like playing Basketball.</span>
</code></pre>
<p>As you can see, using named arguments as opposed to positional ones can be less error-prone, since their ordering in the <code>format()</code> method does not matter.</p>
<p>We can also use another way of formatting strings which consists of beginning a string with <code>f</code> or <code>F</code> before the opening quotation marks or triple quotation marks and including names of the variables that we want to be included in the end:</p>
<pre><code class="lang-python">first_name = <span class="hljs-string">"Fatos"</span>
day_of_the_week = <span class="hljs-string">"Friday"</span>
continent = <span class="hljs-string">"Europe"</span>

greeting = <span class="hljs-string">f'Good morning <span class="hljs-subst">{first_name}</span>. Today is <span class="hljs-subst">{day_of_the_week}</span>'</span>

print(greeting)  <span class="hljs-comment"># Good morning Fatos. Today is Friday.</span>
</code></pre>
<p>Here is another example where we are using a triple quotient after the <code>F</code>:</p>
<pre><code class="lang-python">continent = <span class="hljs-string">"Europe"</span>

i_am_here = F<span class="hljs-string">'''I am in {continent}'''</span>

print(i_am_here)  <span class="hljs-comment"># I am in Europe</span>
</code></pre>
<h2 id="heading-lists-in-python">Lists in Python</h2>
<p>If you take a look at a bookshelf, you can see that the books are stacked and put closely together. You can see that there are many examples of collecting, and structuring elements in some way.</p>
<p>This is also quite important in computer programming. We cannot just continue declaring countless variables and manage them that easily.</p>
<p>Let's say that we have a class of students and want to save their names. We can start saving their names according to the way they are positioned in the classroom:</p>
<pre><code class="lang-python">first = <span class="hljs-string">"Albert"</span>
second = <span class="hljs-string">"Besart"</span>
third = <span class="hljs-string">"Fisnik"</span>
fourth = <span class="hljs-string">"Festim"</span>
fifth = <span class="hljs-string">"Gazmend"</span>
</code></pre>
<p>The list can keep on going which will make it quite hard for us to keep track of all of them.</p>
<p>There is fortunately an easier way for us to put these in a collection in Python called a list.</p>
<p>Let's create a list called <em>students</em> and store in that list all the names declared in the previous code block:</p>
<pre><code class="lang-python">students = [<span class="hljs-string">"Albert"</span>, <span class="hljs-string">"Besart"</span>, <span class="hljs-string">"Fisnik"</span>, <span class="hljs-string">"Festim"</span>, <span class="hljs-string">"Gazmend"</span>]
</code></pre>
<p>This is prettier, right?</p>
<p>Moreover, this way, it is easier for us to manage and also manipulate the elements in the list.</p>
<p>You may think that, "Well it was easier for me to just call <em>first</em> and get the value stored in there. Now it is impossible to get a value from this new list, called <em>students</em>".</p>
<p>If we couldn't read and use those elements that we just stored in a list, that would make it less helpful.</p>
<p>Fortunately, lists have indexes, which start from 0. This means that if we want to get the first element in a list, we need to use index 0 and not index 1 as you may think.</p>
<p>In the example above, the list items have these corresponding indexes:</p>
<pre><code class="lang-python">students = [<span class="hljs-string">"Albert"</span>, <span class="hljs-string">"Besart"</span>, <span class="hljs-string">"Fisnik"</span>, <span class="hljs-string">"Festim"</span>, <span class="hljs-string">"Gazmend"</span>]
<span class="hljs-comment"># Indexes 0, 1, 2, 3, 4</span>
</code></pre>
<p>Now, if we want to get the first element, we simply write:</p>
<pre><code class="lang-python">students[<span class="hljs-number">0</span>]
</code></pre>
<p>If we want to get the second element, we just write:</p>
<pre><code class="lang-python">students[<span class="hljs-number">1</span>]
</code></pre>
<p>As you can probably see, we simply need to write the name of the list and also the corresponding index of the element that we want to get in the square brackets.</p>
<p>This list is, of course, not static. We can add elements to it, like when a new student joins the class.</p>
<p>Let's add a new element in the list <em>students</em> with the value <em>Besfort</em>:</p>
<pre><code class="lang-python">students.append(<span class="hljs-string">"Besfort"</span>)
</code></pre>
<p>We can also change the value of an existing element. To do that, we need to simply reinitialize that specific element of the list with a new value.</p>
<p>For example, let's change the name of the first student:</p>
<pre><code class="lang-python">students[<span class="hljs-number">0</span>] = <span class="hljs-string">"Besim"</span>
</code></pre>
<p>Lists can contain contain different types of variables, for example, we can have a string that contains integers, float numbers, and strings:</p>
<pre><code class="lang-python">combined_list = [<span class="hljs-number">3.14</span>, <span class="hljs-string">"An element"</span>, <span class="hljs-number">1</span>, <span class="hljs-string">"Another element here"</span>]
</code></pre>
<h3 id="heading-slicing">Slicing</h3>
<p>Similar to strings, lists can also be sliced, which as a result returns a new list. This means that the original list remains unchanged.</p>
<p>Let's see how we can get the first three elements of a list using slicing:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>]

print(my_list[<span class="hljs-number">0</span>:<span class="hljs-number">3</span>])  <span class="hljs-comment"># [1, 2, 3]</span>
</code></pre>
<p>As you can see, we have specified 0 as the starting index and 3 as the index where the slicing should stop, excluding the element at the ending index.</p>
<p>If we want to simply start from an index and get all the remaining elements in the list, meaning that the end_index should be the last index, then we can omit and not have to write the last index at all:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>]

print(my_list[<span class="hljs-number">3</span>:])  <span class="hljs-comment"># [4, 5]</span>
</code></pre>
<p>Similarly, if we want to start from the beginning of the list and do the slicing until a specific index, then we can omit writing the 0 index entirely, since Python is smart enough to infer that:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>]

print(my_list[:<span class="hljs-number">3</span>])  <span class="hljs-comment"># [1, 2, 3]</span>
</code></pre>
<p>Strings in Python are immutable, whereas lists are mutable, meaning that we can modify lists' content after we declare them.</p>
<p>As an illustration, let's say that we want to change the first character in the string, namely switching <code>S</code> with <code>B</code> in the following way:</p>
<pre><code class="lang-python">string = <span class="hljs-string">"String"</span>
string[<span class="hljs-number">0</span>] = <span class="hljs-string">"B"</span>
</code></pre>
<p>Now, if we try to print <code>string</code>, we would get an error like the following:</p>
<pre><code class="lang-python"><span class="hljs-comment"># TypeError: 'str' object does not support item assignment</span>
</code></pre>
<p>Now if we have a list and want to modify its first element, then we can successfully do so:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-string">"a"</span>, <span class="hljs-string">"b"</span>, <span class="hljs-string">"c"</span>, <span class="hljs-string">"d"</span>, <span class="hljs-string">"e"</span>]

my_list[<span class="hljs-number">0</span>] = <span class="hljs-number">50</span>

print(my_list)  <span class="hljs-comment"># [50, 'b', 'c', 'd', 'e']</span>
</code></pre>
<p>We can expand a list by concatenating it with another list using the <code>+</code> operator:</p>
<pre><code class="lang-python">first_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]

second_list = [<span class="hljs-number">4</span>, <span class="hljs-number">5</span>]

first_list = first_list + second_list 

print(first_list)  <span class="hljs-comment"># [1, 2, 3, 4, 5]</span>
</code></pre>
<h3 id="heading-how-to-nest-a-list-inside-another-list">How to nest a list inside another list</h3>
<p>We can nest a list inside another list like this:</p>
<pre><code class="lang-python">math_points = [<span class="hljs-number">30</span>, <span class="hljs-string">"Math"</span>]

physics_points = [<span class="hljs-number">53</span>, <span class="hljs-string">"Phyiscs"</span>]

subjects = [math_points, physics_points]

print(subjects)  <span class="hljs-comment"># [[30, 'Math'], [53, 'Phyiscs']]</span>
</code></pre>
<p>These lists do not need even have to have the same length.</p>
<p>To access elements of a list which is inside a list we need to use double indexes.</p>
<p>Let's see how we can access the element <code>math_points</code> inside the <code>subjects</code> list. Since <code>math_points</code> is an element in the <code>subjects</code> list positioned at index 0, we simply need to do the following:</p>
<pre><code class="lang-python">print(subjects[<span class="hljs-number">0</span>])  <span class="hljs-comment"># [30, 'Math']</span>
</code></pre>
<p>Now let's assume that we want to access <code>Math</code> inside the <code>subjects</code> list. Since <code>Math</code> is at index <code>1</code>, we are going to need to use the following double indexes:</p>
<pre><code class="lang-python">print(subjects[<span class="hljs-number">0</span>][<span class="hljs-number">1</span>])  <span class="hljs-comment"># 'Math'</span>
</code></pre>
<h3 id="heading-list-methods">List methods</h3>
<p><code>len()</code> is a method that you can use to find the length of a list:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-string">"a"</span>, <span class="hljs-string">"b"</span>, <span class="hljs-number">1</span>, <span class="hljs-number">3</span>]

print(len(my_list))  <span class="hljs-comment"># 4</span>
</code></pre>
<h4 id="heading-how-to-add-elements-to-a-list">How to add elements to a list</h4>
<p>We can also expand lists by adding new elements, or we can also delete elements.</p>
<p>We can add new elements at the end of a list using the <code>append()</code> method:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-string">"a"</span>, <span class="hljs-string">"b"</span>, <span class="hljs-string">"c"</span>]

my_list.append(<span class="hljs-string">"New element"</span>)

my_list.append(<span class="hljs-string">"Yet another new element"</span>)

print(my_list)  
<span class="hljs-comment"># ['a', 'b', 'c', 'New element', 'Yet another new element']</span>
</code></pre>
<p>If we want to add elements at specific indexes in a list, we can use the <code>insert()</code> method. We specify the index in the first argument and the element that we want to add in the list as a second argument:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-string">"a"</span>, <span class="hljs-string">"b"</span>]

my_list.insert(<span class="hljs-number">1</span>, <span class="hljs-string">"z"</span>)

print(my_list)  <span class="hljs-comment"># ['a', 'z', 'b']</span>
</code></pre>
<h4 id="heading-how-to-delete-elements-from-a-list">How to delete elements from a list</h4>
<p>We can delete elements from lists using the <code>pop()</code> method, which removes the last element in the list:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>]

my_list.pop()  <span class="hljs-comment"># removes 5 from the list</span>

print(my_list)  <span class="hljs-comment"># [1, 2, 3, 4]</span>

my_list.pop()  <span class="hljs-comment"># removes 4 from the list</span>

print(my_list)  <span class="hljs-comment"># [1, 2, 3]</span>
</code></pre>
<p>We can also specify the index of an element in the list that indicates which element in the list we should delete:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>]

my_list.pop(<span class="hljs-number">0</span>)  <span class="hljs-comment"># Delete the element at index 0</span>

print(my_list)  <span class="hljs-comment"># [2, 3, 4, 5]</span>
</code></pre>
<p>We can also delete elements from lists using the <code>del</code> statement and then specifying the value of the element that we want to delete:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">1</span>]

<span class="hljs-keyword">del</span> my_list[<span class="hljs-number">0</span>]  <span class="hljs-comment"># Delete element my_list[0]</span>

print(my_list)  <span class="hljs-comment"># [2, 3, 4, 5]</span>
</code></pre>
<p>We can also delete slices of lists using <code>del</code>:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">1</span>]

<span class="hljs-keyword">del</span> my_list[<span class="hljs-number">0</span>:<span class="hljs-number">3</span>]  <span class="hljs-comment"># Delete elements: my_list[0], my_list[1], my_list[2]</span>

print(my_list)  <span class="hljs-comment"># [4, 1]</span>
</code></pre>
<p>We can do this using <code>remove()</code>:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>]

my_list.remove(<span class="hljs-number">3</span>) 

print(my_list)  <span class="hljs-comment"># [1, 2, 4]</span>
</code></pre>
<p><code>reverse()</code> lets us reverse the elements in a list. This is quite easy and straightforward:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>]

my_list.reverse()

print(my_list)  <span class="hljs-comment"># [4, 3, 2, 1]</span>
</code></pre>
<h4 id="heading-index-search">Index search</h4>
<p>Getting elements of a list using indexes is simple. Finding indexes of elements of a list is also easy. We simply need to use the method <code>index()</code> and mention the element that we want to find inside a list:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-string">"Fatos"</span>, <span class="hljs-string">"Morina"</span>, <span class="hljs-string">"Python"</span>, <span class="hljs-string">"Software"</span>]

print(my_list.index(<span class="hljs-string">"Python"</span>))  <span class="hljs-comment"># 2</span>
</code></pre>
<h3 id="heading-membership">Membership</h3>
<p>This is quite intuitive and related to real life: We get to ask ourselves whether something is part of something or not.</p>
<p>Is my phone in my pocket or bag?</p>
<p>Is my coworker's email included in the CC?</p>
<p>Is my friend in this coffee shop?</p>
<p>In Python, if we want to check whether a value is part of something, that we can use the operator <code>in</code>:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]  <span class="hljs-comment"># This is a list</span>

print(<span class="hljs-number">1</span> <span class="hljs-keyword">in</span> my_list)  <span class="hljs-comment"># True</span>
</code></pre>
<p>Since 1 is included in the array <code>[1, 2, 3]</code>, the expression evaluates to True.</p>
<p>We can also use it not only with arrays of numbers, but with arrays of characters as well:</p>
<pre><code class="lang-python">vowels = [<span class="hljs-string">'a'</span>, <span class="hljs-string">'i'</span>, <span class="hljs-string">'o'</span>, <span class="hljs-string">'u'</span>]
print(<span class="hljs-string">'y'</span> <span class="hljs-keyword">in</span> vowels)  <span class="hljs-comment"># False</span>
</code></pre>
<p>Since <code>y</code> is not a vowel and not included in the declared array, the expression in the second line of the previous code snippet is going to result in False.</p>
<p>Similarly, we can also check whether something is not included using <code>not in</code>:</p>
<pre><code class="lang-python">odd_numbers = [<span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">5</span>, <span class="hljs-number">7</span>]
print(<span class="hljs-number">2</span> <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> odd_numbers)  <span class="hljs-comment"># True</span>
</code></pre>
<p>Since 2 is not included in the array, the expression is going to evaluate to True.</p>
<h3 id="heading-how-to-sort-elements-in-a-list">How to sort elements in a list</h3>
<p>Sorting elements in a list is something that you may need to do from time to time. <code>sort()</code> is a built-in method that makes it possible for you to sort elements in a list in an ascending order alphabetically or numerically:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">3</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">0</span>]

my_list.sort()

print(my_list)  <span class="hljs-comment"># [0, 1, 2, 3, 4, 5]</span>

alphabetical_list = [<span class="hljs-string">'a'</span>, <span class="hljs-string">'c'</span>, <span class="hljs-string">'b'</span>, <span class="hljs-string">'z'</span>, <span class="hljs-string">'e'</span>, <span class="hljs-string">'d'</span>]

alphabetical_list.sort()

print(alphabetical_list)  <span class="hljs-comment"># ['a', 'b', 'c', 'd', 'e', 'z']</span>
</code></pre>
<p>There are other methods of lists that we have not included in here.</p>
<h3 id="heading-list-comprehension">List comprehension</h3>
<p>List comprehension represents a concise way in which we use a <code>for</code> loop to create a new list from an existing one. The result is always a new list in the end.</p>
<p>Let's start with an example where we want to multiply each number of a list with 10 and save that result in a new list. First, let's do this without using list comprehension:</p>
<pre><code class="lang-python">numbers = [<span class="hljs-number">2</span>, <span class="hljs-number">4</span>, <span class="hljs-number">6</span>, <span class="hljs-number">8</span>]  <span class="hljs-comment"># Complete list</span>

numbers_tenfold = []  <span class="hljs-comment"># Empty list</span>

<span class="hljs-keyword">for</span> number <span class="hljs-keyword">in</span> numbers:
    number = number * <span class="hljs-number">10</span>  <span class="hljs-comment"># Multiply each number with 10</span>
    numbers_tenfold.append(number)  <span class="hljs-comment"># Add that new number in the new list</span>

print(numbers_tenfold)  <span class="hljs-comment"># [20, 40, 60, 80]</span>
</code></pre>
<p>We can implement that using list comprehension in the following way:</p>
<pre><code class="lang-python">numbers = [<span class="hljs-number">2</span>, <span class="hljs-number">4</span>, <span class="hljs-number">6</span>, <span class="hljs-number">8</span>]  <span class="hljs-comment"># Complete list</span>

numbers_tenfold = [number * <span class="hljs-number">10</span> <span class="hljs-keyword">for</span> number <span class="hljs-keyword">in</span> numbers]  <span class="hljs-comment"># List comprehension</span>

print(numbers_tenfold)  <span class="hljs-comment"># [20, 40, 60, 80]</span>
</code></pre>
<p>We can also include conditions when doing these list comprehensions.</p>
<p>Let's assume that we want to save a list of positive numbers.</p>
<p>Before we write the way we would implement this using list comprehension, let's write a way in which we would create a list of only numbers that are greater than 0 in another list and increase those positive numbers by 100:</p>
<pre><code class="lang-python">positive_numbers = []  <span class="hljs-comment"># Empty list</span>

numbers = [<span class="hljs-number">-1</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">-2</span>, <span class="hljs-number">-3</span>, <span class="hljs-number">-4</span>, <span class="hljs-number">3</span>, <span class="hljs-number">2</span>]  <span class="hljs-comment"># Complete list</span>

<span class="hljs-keyword">for</span> number <span class="hljs-keyword">in</span> numbers:
    <span class="hljs-keyword">if</span> number &gt; <span class="hljs-number">0</span>:  <span class="hljs-comment"># If the current number is greater than 0</span>
        positive_numbers.append(number + <span class="hljs-number">100</span>)  <span class="hljs-comment"># add that number inside the list positive_numbers</span>


print(positive_numbers)  <span class="hljs-comment"># [101, 103, 102]</span>
</code></pre>
<p>We can do the same using list comprehension:</p>
<pre><code class="lang-python">numbers = [<span class="hljs-number">-1</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">-2</span>, <span class="hljs-number">-3</span>, <span class="hljs-number">-4</span>, <span class="hljs-number">3</span>, <span class="hljs-number">2</span>]  <span class="hljs-comment"># Compelete list</span>

positive_numbers = [number + <span class="hljs-number">100</span> <span class="hljs-keyword">for</span> number <span class="hljs-keyword">in</span> numbers <span class="hljs-keyword">if</span> number &gt; <span class="hljs-number">0</span>]  <span class="hljs-comment"># List comprehension</span>

print(positive_numbers)  <span class="hljs-comment"># [101, 103, 102]</span>
</code></pre>
<p>As you can see, this is much shorter and should take less time to write.</p>
<p>We can also use list comprehension with multiple lists as well.</p>
<p>Let's take an example where we want to add each element of a list with each element in another list:</p>
<pre><code class="lang-python">first_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]
second_list = [<span class="hljs-number">50</span>]

double_lists = [first_element +
                second_element <span class="hljs-keyword">for</span> first_element <span class="hljs-keyword">in</span> first_list <span class="hljs-keyword">for</span> second_element <span class="hljs-keyword">in</span> second_list]

print(double_lists)  <span class="hljs-comment"># [51, 52, 53]</span>
</code></pre>
<p>In the end, we are going to get a resulting list that has the same number of elements as the list with the longest length.</p>
<h2 id="heading-tuples-in-python">Tuples in Python</h2>
<p>Tuples are collections that are ordered and immutable, meaning that their content cannot be changed. They are ordered and we can access their elements using indexes.</p>
<p>Let's start with our first tuple:</p>
<pre><code class="lang-python">vehicles = (<span class="hljs-string">"Computer"</span>, <span class="hljs-string">"Smartphone"</span>, <span class="hljs-string">"Smart watch"</span>, <span class="hljs-string">"Tablet"</span>)

print(vehicles)

<span class="hljs-comment"># ('Computer', 'Smartphone', 'Smart watch', 'Tablet')</span>
</code></pre>
<p>All the indexing and slicing operations that we have seen in the list section apply for tuples as well:</p>
<pre><code class="lang-python">print(len(vehicles))  <span class="hljs-comment"># 4</span>

print(vehicles[<span class="hljs-number">3</span>])  <span class="hljs-comment"># Tablet</span>

print(vehicles[:<span class="hljs-number">3</span>])  <span class="hljs-comment"># ('Computer', 'Smartphone', 'Smart watch')</span>
</code></pre>
<p>You can find the index of an element inside a tuple using the <code>index()</code> method:</p>
<pre><code class="lang-python">print(vehicles.index(<span class="hljs-string">'tablet'</span>))  <span class="hljs-comment"># 3</span>
</code></pre>
<p>We can also concatenate or merge two tuples using the <code>+</code> operator:</p>
<pre><code class="lang-python">natural_sciences = (<span class="hljs-string">'Chemistry'</span>, <span class="hljs-string">'Astronomy'</span>,
                    <span class="hljs-string">'Earth science'</span>, <span class="hljs-string">'Physics'</span>, <span class="hljs-string">'Biology'</span>)

social_sciences = (<span class="hljs-string">'Anthropology'</span>, <span class="hljs-string">'Archaeology'</span>, <span class="hljs-string">'Economics'</span>, <span class="hljs-string">'Geography'</span>,
                   <span class="hljs-string">'History'</span>, <span class="hljs-string">'Law'</span>, <span class="hljs-string">'Linguistics'</span>, <span class="hljs-string">'Politics'</span>, <span class="hljs-string">'Psychology'</span>, <span class="hljs-string">'Sociology'</span>)

sciences = natural_sciences + social_sciences

print(sciences)
<span class="hljs-comment"># ('Chemistry', 'Astronomy', 'Earth science', 'Physics', 'Biology', 'Anthropology', 'Archaeology', 'Economics', 'Geography', 'History', 'Law', 'Linguistics', 'Politics', 'Psychology', 'Sociology')</span>
</code></pre>
<h3 id="heading-membership-check">Membership check</h3>
<p>We can check whether an element is part of a tuple using the operators <code>in</code> and <code>not in</code> just like with lists:</p>
<pre><code class="lang-python">vehicles = (<span class="hljs-string">'Car'</span>, <span class="hljs-string">'Bike'</span>, <span class="hljs-string">'Airplane'</span>)

print(<span class="hljs-string">'Motorcycle'</span> <span class="hljs-keyword">in</span> vehicles)  <span class="hljs-comment"># False, since Motorcycle is not included in vehicles</span>

print(<span class="hljs-string">'Train'</span> <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> vehicles)  <span class="hljs-comment"># True, since Train is not included in vehicles</span>
</code></pre>
<h3 id="heading-how-to-nest-two-tuples">How to nest two tuples</h3>
<p>Instead of merging, we can also nest tuples into a single tuple by using tuples that we want to nest inside the parenthesis:</p>
<pre><code class="lang-python">natural_sciences = (<span class="hljs-string">'Chemistry'</span>, <span class="hljs-string">'Astronomy'</span>,
                    <span class="hljs-string">'Earth science'</span>, <span class="hljs-string">'Physics'</span>, <span class="hljs-string">'Biology'</span>)

social_sciences = (<span class="hljs-string">'Anthropology'</span>, <span class="hljs-string">'Archaeology'</span>, <span class="hljs-string">'Economics'</span>, <span class="hljs-string">'Geography'</span>,
                   <span class="hljs-string">'History'</span>, <span class="hljs-string">'Law'</span>, <span class="hljs-string">'Linguistics'</span>, <span class="hljs-string">'Politics'</span>, <span class="hljs-string">'Psychology'</span>, <span class="hljs-string">'Sociology'</span>)

sciences = (natural_sciences, social_sciences)

print(sciences)
<span class="hljs-comment"># (('Chemistry', 'Astronomy', 'Earth science', 'Physics', 'Biology'), ('Anthropology', 'Archaeology', 'Economics', 'Geography', 'History', 'Law', 'Linguistics', 'Politics', 'Psychology', 'Sociology'))</span>
</code></pre>
<h3 id="heading-immutability">Immutability</h3>
<p>Since tuples are immutable, we can't change them after we create them. This means that we cannot add or delete elements in them, or append a tuple to another tuple.</p>
<p>We cannot even modify existing elements in a tuple. If we try to modify an element in a tuple, we are going to face a problem like the following:</p>
<pre><code class="lang-python">vehicles = (<span class="hljs-string">'Car'</span>, <span class="hljs-string">'Bike'</span>, <span class="hljs-string">'Airplane'</span>)

vehicles[<span class="hljs-number">0</span>] = <span class="hljs-string">'Truck'</span>

print(vehicles)
<span class="hljs-comment"># TypeError: 'tuple' object does not support item assignment</span>
</code></pre>
<h2 id="heading-dictionaries-in-python-key-value-data-structures">Dictionaries in Python – Key-Value Data Structures</h2>
<p>As we saw previously, elements in lists are associated with indexes that we can use to reference those elements.</p>
<p>There is another data structure in Python that allows us to specify our own custom indexes and not just numbers. These are called dictionaries, and they are similar to dictionaries that we use to find the meaning of words we do not understand.</p>
<p>Let's assume that you are trying to learn German and there is a new word that you have not had the chance to learn before that you just saw at a market: <em>Wasser</em>.</p>
<p>Now, you can pick up your phone and check its corresponding meaning in English using Google Translate or any other application of your choice. But if you were to use a physical dictionary, you would need to find this word by going to that specific page and check its meaning sitting right beside it. The reference or the key for the meaning of this word would be the term <em>Wasser</em>.</p>
<p>Now, if we want to implement this in Python, we should not use lists that have indexes only as numbers. We should use dictionaries instead.</p>
<p>For dictionaries, we use curly braces and have each element that has two parts: the key and the value.</p>
<p>In our previous example, the key was the German word, whereas the value was its translation in English, as you can see in the following example:</p>
<pre><code class="lang-python">german_to_english_dictionary = {
    <span class="hljs-string">"Wasser"</span>: <span class="hljs-string">"Water"</span>,
    <span class="hljs-string">"Brot"</span>: <span class="hljs-string">"Bread"</span>,
    <span class="hljs-string">"Milch"</span>: <span class="hljs-string">"Milk"</span>
}
</code></pre>
<p>Now, when we want to access specific elements in the dictionary, we simply use keys. For example, let's assume that we want to get the meaning of the word <em>Brot</em> in English. To do that, we can simply reference that element using that key:</p>
<pre><code class="lang-python">brot_translation = german_to_english_dictionary[<span class="hljs-string">"Brot"</span>]
print(brot_translation)  <span class="hljs-comment"># Bread</span>
</code></pre>
<p>When we print the value that we get, we are going to get the translation in English.</p>
<p>Similarly, we can get the English translation of the word <em>Milch</em> by getting the value of the element that has <em>Milch</em> as the key:</p>
<pre><code class="lang-python">milch_translation = german_to_english_dictionary[<span class="hljs-string">"Milch"</span>]
print(milch_translation)  <span class="hljs-comment"># Milk</span>
</code></pre>
<p>We can also get the value of an element in a dictionary using <code>get()</code> and specifying the key of the item that we want to get:</p>
<pre><code class="lang-python">german_to_english_dictionary.get(<span class="hljs-string">"Wasser"</span>)
</code></pre>
<p>Both keys and values can be of any data type.</p>
<p>Dictionaries can have duplicate values, but the all the keys should be unique. Take a look at this example to see what I mean:</p>
<pre><code class="lang-python">my_dictionary = dict([
  (<span class="hljs-string">'a'</span>, <span class="hljs-number">1</span>),
  (<span class="hljs-string">'b'</span>, <span class="hljs-number">1</span>),
  (<span class="hljs-string">'c'</span>, <span class="hljs-number">2</span>)
])
</code></pre>
<p>We can create dictionaries using <code>dict()</code>:</p>
<pre><code class="lang-python">words = dict([
    (<span class="hljs-string">'abandon'</span>, <span class="hljs-string">'to give up to someone or something on the ground'</span>),
    (<span class="hljs-string">'abase'</span>, <span class="hljs-string">'to lower in rank, office, or esteem'</span>),
    (<span class="hljs-string">'abash'</span>, <span class="hljs-string">'to destroy the self-possession or self-confidence of'</span>)
])

print(words)
<span class="hljs-comment"># {'abandon': 'to give up to someone or something on the ground', 'abase': 'to lower in rank, office, or esteem', 'abash': 'to destroy the self-possession or self-confidence of'}</span>
</code></pre>
<h3 id="heading-how-to-add-new-values-to-a-dict">How to add new values to a dict</h3>
<p>We can add new values inside dictionaries by specifying a new key and a corresponding value. Then Python is going to create a new element inside that dictionary:</p>
<pre><code class="lang-python">words = {
    <span class="hljs-string">'a'</span>: <span class="hljs-string">'alfa'</span>,
    <span class="hljs-string">'b'</span>: <span class="hljs-string">'beta'</span>,
    <span class="hljs-string">'d'</span>: <span class="hljs-string">'delta'</span>,
}

words[<span class="hljs-string">'g'</span>] = <span class="hljs-string">'gama'</span>

print(words)
<span class="hljs-comment"># {'a': 'alfa', 'b': 'beta', 'd': 'delta', 'g': 'gama'}</span>
</code></pre>
<p>If we specify the key of an element that is already part of the dictionary, that element is going to be modified:</p>
<pre><code class="lang-python">words = {
    <span class="hljs-string">'a'</span>: <span class="hljs-string">'alfa'</span>,
    <span class="hljs-string">'b'</span>: <span class="hljs-string">'beta'</span>,
    <span class="hljs-string">'d'</span>: <span class="hljs-string">'delta'</span>,
}

words[<span class="hljs-string">'b'</span>] = <span class="hljs-string">'bravo'</span>


print(words)
<span class="hljs-comment"># {'a': 'alfa', 'b': 'bravo', 'd': 'delta'}</span>
</code></pre>
<h3 id="heading-how-to-remove-elements-from-a-dict">How to remove elements from a dict</h3>
<p>If we want to remove elements from a dictionary, we can use the method <code>pop()</code> and also specify the key of the element that we want to delete:</p>
<pre><code class="lang-python">words = {
    <span class="hljs-string">'a'</span>: <span class="hljs-string">'alfa'</span>,
    <span class="hljs-string">'b'</span>: <span class="hljs-string">'beta'</span>,
    <span class="hljs-string">'d'</span>: <span class="hljs-string">'delta'</span>,
}

words.pop(<span class="hljs-string">'a'</span>)

print(words)  <span class="hljs-comment"># {'b': 'beta', 'd': 'delta'}</span>
</code></pre>
<p>We can also delete values using <code>popitem()</code> which removes the last inserted key-value pair starting from Python 3.7. In earlier versions, it deletes a random pair:</p>
<pre><code class="lang-python">words = {
    <span class="hljs-string">'a'</span>: <span class="hljs-string">'alfa'</span>,
    <span class="hljs-string">'b'</span>: <span class="hljs-string">'beta'</span>,
    <span class="hljs-string">'d'</span>: <span class="hljs-string">'delta'</span>,
}

words[<span class="hljs-string">'g'</span>] = <span class="hljs-string">'gamma'</span>

words.popitem()

print(words)  
<span class="hljs-comment"># {'a': 'alfa', 'b': 'beta', 'd': 'delta'}</span>
</code></pre>
<p>There is another way that we can delete elements, namely by using <code>del</code> statement:</p>
<pre><code class="lang-python">words = {
    <span class="hljs-string">'a'</span>: <span class="hljs-string">'alfa'</span>,
    <span class="hljs-string">'b'</span>: <span class="hljs-string">'beta'</span>,
    <span class="hljs-string">'d'</span>: <span class="hljs-string">'delta'</span>,
}

<span class="hljs-keyword">del</span> words[<span class="hljs-string">'b'</span>]

print(words)  <span class="hljs-comment"># {'a': 'alfa', 'd': 'delta'}</span>
</code></pre>
<h3 id="heading-how-to-get-the-length-of-a-dict">How to get the length of a dict</h3>
<p>We can get the length of a dictionary using <code>len()</code> just like with lists and tuples:</p>
<pre><code class="lang-python">words = {
    <span class="hljs-string">'a'</span>: <span class="hljs-string">'alfa'</span>,
    <span class="hljs-string">'b'</span>: <span class="hljs-string">'beta'</span>,
    <span class="hljs-string">'d'</span>: <span class="hljs-string">'delta'</span>,
}

print(len(words))  <span class="hljs-comment"># 3</span>
</code></pre>
<h3 id="heading-membership-1">Membership</h3>
<p>If we want to check whether a key is already part of a dictionary so that we avoid overriding it, we can use the operator <code>in</code> and <code>not in</code> just like with lists and tuples:</p>
<pre><code class="lang-python">words = {
    <span class="hljs-string">'a'</span>: <span class="hljs-string">'alfa'</span>,
    <span class="hljs-string">'b'</span>: <span class="hljs-string">'beta'</span>,
    <span class="hljs-string">'d'</span>: <span class="hljs-string">'delta'</span>,
}

print(<span class="hljs-string">'a'</span> <span class="hljs-keyword">in</span> words)  <span class="hljs-comment"># True</span>
print(<span class="hljs-string">'z'</span> <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> words)  <span class="hljs-comment"># True</span>
</code></pre>
<h3 id="heading-comprehension">Comprehension</h3>
<p>We can use comprehension just like with lists to create dictionaries in a quick way.</p>
<p>To help us with that, we are going to need to use a method called <code>items()</code> that converts a dictionary into a list of tuples. The element in index 0 is a key, whereas in position with index 1, we have a value.</p>
<p>Let's first see the method <code>items()</code> in action:</p>
<pre><code class="lang-python">points = {
    <span class="hljs-string">'Festim'</span>: <span class="hljs-number">50</span>,
    <span class="hljs-string">'Zgjim'</span>: <span class="hljs-number">89</span>,
    <span class="hljs-string">'Durim'</span>: <span class="hljs-number">73</span>
}

elements = points.items()

print(elements) <span class="hljs-comment"># dict_items([('Festim', 50), ('Zgjim', 89), ('Durim', 73)])</span>
</code></pre>
<p>Now let's create a new dictionary from this existing dictionary <code>points</code> using comprehension.</p>
<p>We can assume that a professor is in a good mood and generous enough to reward each student with a bonus of <code>10</code> points. We want to add these new points to each student by saving these new points in a new dictionary:</p>
<pre><code class="lang-python">points = {
    <span class="hljs-string">'Festim'</span>: <span class="hljs-number">50</span>,
    <span class="hljs-string">'Zgjim'</span>: <span class="hljs-number">89</span>,
    <span class="hljs-string">'Durim'</span>: <span class="hljs-number">73</span>
}

elements = points.items()

points_modified = {key: value + <span class="hljs-number">10</span> <span class="hljs-keyword">for</span> (key, value) <span class="hljs-keyword">in</span> elements}

print(points_modified)  <span class="hljs-comment"># {'Festim': 60, 'Zgjim': 99, 'Durim': 83}</span>
</code></pre>
<h2 id="heading-sets-in-python">Sets in Python</h2>
<p>Sets are unordered and unindexed collections of data. Since elements in sets are not ordered, we cannot access elements using indexes or using the method <code>get()</code>.</p>
<p>We can add tuples, but we cannot add dictionaries or lists in a set.</p>
<p>We cannot add duplicate elements in sets. This means that when we want to remove duplicate elements from another type of collection, we can make use of this uniqueness in sets.</p>
<p>Let's start creating our first set using curly brackets as follows:</p>
<pre><code class="lang-python">first_set = {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>}
</code></pre>
<p>We can also create sets using the <code>set()</code> constructor:</p>
<pre><code class="lang-python">empty_set = set()  <span class="hljs-comment"># Empty set</span>

first_set = set((<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>))  <span class="hljs-comment"># We are converting a tuple into a set</span>
</code></pre>
<p>Like all data structures, we can find the length of a set using the method <code>len()</code>:</p>
<pre><code class="lang-python">print(len(first_set))  <span class="hljs-comment"># 3</span>
</code></pre>
<h3 id="heading-how-to-add-elements-to-a-set">How to add elements to a set</h3>
<p>We can add one element in a set using the method <code>add()</code>:</p>
<pre><code class="lang-python">my_set = {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>}

my_set.add(<span class="hljs-number">4</span>)

print(my_set)  <span class="hljs-comment"># {1, 2, 3, 4}</span>
</code></pre>
<p>If we want to add more than one element, then we need to use method <code>update()</code>. We use as an input for this method a list, tuple, string or another set:</p>
<pre><code class="lang-python">my_set = {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>}

my_set.update([<span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>])

print(my_set)  <span class="hljs-comment"># {1, 2, 3, 4, 5, 6}</span>

my_set.update(<span class="hljs-string">"ABC"</span>)

print(my_set)  <span class="hljs-comment"># {1, 2, 3, 4, 5, 6, 'A', 'C', 'B'}</span>
</code></pre>
<h3 id="heading-how-to-delete-elements-from-a-set">How to delete elements from a set</h3>
<p>If we want to delete elements from sets, we can use methods <code>discard()</code> or <code>remove()</code>:</p>
<pre><code class="lang-python">my_set = {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>}

my_set.remove(<span class="hljs-number">2</span>)

print(my_set)  <span class="hljs-comment"># {1, 3}</span>
</code></pre>
<p>If we try to delete an element that is not part of the set using <code>remove()</code>, then we are going to get an error:</p>
<pre><code class="lang-python">my_set = {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>}

my_set.remove(<span class="hljs-number">4</span>)

print(my_set)  <span class="hljs-comment"># KeyError: 4</span>
</code></pre>
<p>To avoid such errors when removing elements from sets, we can use the method <code>discard()</code>:</p>
<pre><code class="lang-python">my_set = {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>}

my_set.discard(<span class="hljs-number">4</span>)

print(my_set)  <span class="hljs-comment"># {1, 2, 3}</span>
</code></pre>
<h3 id="heading-set-theory-operations">Set Theory Operations</h3>
<p>If you remember high school math lessons, you should already know about union, intersection, and the difference between two sets of elements. These operations are supported for sets in Python as well.</p>
<h4 id="heading-union">Union</h4>
<p>Union represents the collection of all unique elements from both sets. We can find the union of two sets using the pipe operator <code>|</code> or the <code>union()</code> method:</p>
<pre><code class="lang-python">first_set = {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>}
second_set = {<span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>}

union_set = first_set.union(second_set)

print(union_set)  <span class="hljs-comment"># {1, 2, 3, 4}</span>
</code></pre>
<h4 id="heading-intersection">Intersection</h4>
<p>Intersection represents the collection that contains elements that are in both sets. We can find it using operator <code>&amp;</code> or the <code>intersection()</code> method:</p>
<pre><code class="lang-python">first_set = {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>}
second_set = {<span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>}

intersection_set = first_set.intersection(second_set)

print(union_set)  <span class="hljs-comment"># {2}</span>
</code></pre>
<h4 id="heading-difference">Difference</h4>
<p>The difference between two sets represents the collection that contains only the elements that are in the first set, but not in the second. We can find the difference between two sets using the <code>-</code> operator or the method <code>difference()</code></p>
<pre><code class="lang-python">first_set = {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>}
second_set = {<span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>}

difference_set = first_set.difference(second_set)

print(difference_set)  <span class="hljs-comment"># {1}</span>
</code></pre>
<p>As you can probably remember from high school, ordering of sets when we find the difference of two sets matters, which is not the case with the union and intersection.</p>
<p>This is similar to arithmetic, where <code>3 - 4</code> is not equal to <code>4 - 3</code>:</p>
<pre><code class="lang-python">first_set = {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>}
second_set = {<span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>}

first_difference_set = first_set.difference(second_set)

print(first_difference_set)  <span class="hljs-comment"># {1}</span>

second_difference_set = second_set.difference(first_set)

print(second_difference_set)  <span class="hljs-comment"># {3, 4}</span>
</code></pre>
<h1 id="heading-type-conversions-in-python">Type Conversions in Python</h1>
<h2 id="heading-conversions-between-primitive-types">Conversions Between Primitive Types</h2>
<p>Python is an object oriented programming language. That is why it uses constructor functions of classes to do conversions from one type into another.</p>
<h3 id="heading-int-method"><code>int()</code> method</h3>
<p><code>int()</code> is a method that you use do a conversion of an integer literal, float literal (rounding it to its previous integer number, that is 3.1 to 3), or a string literal (with the condition that the string represents an int or float literal):</p>
<pre><code class="lang-python">three = int(<span class="hljs-number">3</span>)  <span class="hljs-comment"># converting an integer literal into an integer</span>
print(three)  <span class="hljs-comment"># 3</span>

four = int(<span class="hljs-number">4.8</span>)  <span class="hljs-comment"># converting a float number into its previous closest integer</span>
print(four)  <span class="hljs-comment"># 4</span>

five = int(<span class="hljs-string">'5'</span>)  <span class="hljs-comment"># converting a string into an integer</span>
print(five)  <span class="hljs-comment"># 5</span>
</code></pre>
<h3 id="heading-float-method"><code>float()</code> method</h3>
<p><code>float()</code> is similarly used to create float numbers from an integer, float, or string literal (with the condition that the string represents an <code>int</code> or <code>float</code> literal):</p>
<pre><code class="lang-python">int_literal = float(<span class="hljs-number">5</span>)
print(int_literal)  <span class="hljs-comment"># 5.0</span>

float_literal = float(<span class="hljs-number">1.618</span>)
print(float_literal)  <span class="hljs-comment"># 1.618</span>

string_int = float(<span class="hljs-string">"40"</span>)
print(string_int)  <span class="hljs-comment"># 40.0</span>

string_float = float(<span class="hljs-string">"37.2"</span>)
print(string_float)  <span class="hljs-comment"># 37.2</span>
</code></pre>
<h3 id="heading-str-method"><code>str()</code> method</h3>
<p>We can use <code>str()</code> to create strings from strings, integer literals, float literals, and many other data types:</p>
<pre><code class="lang-python">int_to_string = str(<span class="hljs-number">3</span>)
print(int_to_string)  <span class="hljs-comment"># '3'</span>

float_to_string = str(<span class="hljs-number">3.14</span>)
print(float_to_string)  <span class="hljs-comment"># '3.14'</span>

string_to_string = str(<span class="hljs-string">'hello'</span>)
print(string_to_string)  <span class="hljs-comment"># 'hello'</span>
</code></pre>
<h2 id="heading-other-conversions">Other Conversions</h2>
<p>To convert from one type of data structure into another type, we do the following:</p>
<pre><code class="lang-markdown">destination<span class="hljs-emphasis">_type(input_</span>type)
</code></pre>
<p>Let us get started with specific types, so that it becomes much clearer.</p>
<h3 id="heading-conversions-to-lists">Conversions to lists</h3>
<p>We can convert a set, tuple, or dictionary into a list using the <code>list()</code> constructor.</p>
<pre><code class="lang-python">books_tuple = (<span class="hljs-string">'Book 1'</span>, <span class="hljs-string">'Book 2'</span>, <span class="hljs-string">'Book 3'</span>)
tuple_to_list = list(books_tuple)  <span class="hljs-comment"># Converting tuple to list</span>
print(tuple_to_list)  <span class="hljs-comment"># ['Book 1', 'Book 2', 'Book 3']</span>


books_set = {<span class="hljs-string">'Book 1'</span>, <span class="hljs-string">'Book 2'</span>, <span class="hljs-string">'Book 3'</span>}
set_to_list = list(books_set)  <span class="hljs-comment"># Converting set to list</span>
print(set_to_list)  <span class="hljs-comment"># ['Book 1', 'Book 2', 'Book 3']</span>
</code></pre>
<p>When converting a dictionary into a list, only its keys are going to make it into a list:</p>
<pre><code class="lang-python">books_dict = {<span class="hljs-string">'1'</span>: <span class="hljs-string">'Book 1'</span>, <span class="hljs-string">'2'</span>: <span class="hljs-string">'Book 2'</span>, <span class="hljs-string">'3'</span>: <span class="hljs-string">'Book 3'</span>}
dict_to_list = list(books_dict)  <span class="hljs-comment"># Converting dict to list</span>
print(dict_to_list)  <span class="hljs-comment"># ['1', '2', '3']</span>
</code></pre>
<p>If we want to keep both keys and values of a dictionary, we need to use the method <code>items()</code> to first convert it into a list of tuples where each tuple is a key and a value:</p>
<pre><code class="lang-python">books_dict = {<span class="hljs-string">'1'</span>: <span class="hljs-string">'Book 1'</span>, <span class="hljs-string">'2'</span>: <span class="hljs-string">'Book 2'</span>, <span class="hljs-string">'3'</span>: <span class="hljs-string">'Book 3'</span>}

dict_to_list = list(books_dict.items())  <span class="hljs-comment"># Converting dict to list</span>

print(dict_to_list)
<span class="hljs-comment"># [('1', 'Book 1'), ('2', 'Book 2'), ('3', 'Book 3')]</span>
</code></pre>
<h3 id="heading-conversions-to-tuples">Conversions to tuples</h3>
<p>All data structures can be converted to a tuple using the <code>tuple()</code> constructor method, including a dictionary In that case we get a tuple with the keys of the dictionary:</p>
<pre><code class="lang-python">books_list = [<span class="hljs-string">'Book 1'</span>, <span class="hljs-string">'Book 2'</span>, <span class="hljs-string">'Book 3'</span>]
list_to_tuple = tuple(books_list)  <span class="hljs-comment"># Converting tuple to tuple</span>
print(list_to_tuple)  <span class="hljs-comment"># ('Book 1', 'Book 2', 'Book 3')</span>


books_set = {<span class="hljs-string">'Book 1'</span>, <span class="hljs-string">'Book 2'</span>, <span class="hljs-string">'Book 3'</span>}
set_to_tuple = tuple(books_set)  <span class="hljs-comment"># Converting set to tuple</span>
print(set_to_tuple)  <span class="hljs-comment"># ('Book 1', 'Book 2', 'Book 3')</span>


books_dict = {<span class="hljs-string">'1'</span>: <span class="hljs-string">'Book 1'</span>, <span class="hljs-string">'2'</span>: <span class="hljs-string">'Book 2'</span>, <span class="hljs-string">'3'</span>: <span class="hljs-string">'Book 3'</span>}
dict_to_tuple = tuple(books_dict)  <span class="hljs-comment"># Converting dict to tuple</span>
print(dict_to_tuple)  <span class="hljs-comment"># ('1', '2', '3')</span>
</code></pre>
<h3 id="heading-conversions-to-sets">Conversions to sets</h3>
<p>Similarly, all data structures can be converted to a set using the <code>set()</code> constructor method, including a dictionary. In that case we get a set with the keys of the dictionary:</p>
<pre><code class="lang-python">books_list = [<span class="hljs-string">'Book 1'</span>, <span class="hljs-string">'Book 2'</span>, <span class="hljs-string">'Book 3'</span>]
list_to_set = set(books_list)  <span class="hljs-comment"># Converting list to set</span>
print(list_to_set)  <span class="hljs-comment"># {'Book 2', 'Book 3', 'Book 1'}</span>


books_tuple = (<span class="hljs-string">'Book 1'</span>, <span class="hljs-string">'Book 2'</span>, <span class="hljs-string">'Book 3'</span>)
tuple_to_set = set(books_tuple)  <span class="hljs-comment"># Converting tuple to set</span>
print(tuple_to_set)  <span class="hljs-comment"># {'Book 2', 'Book 3', 'Book 1'}</span>


books_dict = {<span class="hljs-string">'1'</span>: <span class="hljs-string">'Book 1'</span>, <span class="hljs-string">'2'</span>: <span class="hljs-string">'Book 2'</span>, <span class="hljs-string">'3'</span>: <span class="hljs-string">'Book 3'</span>}
dict_to_set = set(books_dict)  <span class="hljs-comment"># Converting dict to set</span>
print(dict_to_set)  <span class="hljs-comment"># {'1', '3', '2'}</span>
</code></pre>
<h3 id="heading-conversions-to-dictionaries">Conversions to dictionaries</h3>
<p>Conversions into dictionaries cannot be done with any type of sets, lists, or tuples, since dictionaries represent data structures where each element contains both a key and a value.</p>
<p>Converting a list, or a tuple into a dictionary can be done if each element in a list is also a list with two elements, or a tuple with two elements.</p>
<pre><code class="lang-python">books_tuple_list = [(<span class="hljs-number">1</span>, <span class="hljs-string">'Book 1'</span>), (<span class="hljs-number">2</span>, <span class="hljs-string">'Book 2'</span>), (<span class="hljs-number">3</span>, <span class="hljs-string">'Book 3'</span>)]
tuple_list_to_dictionary = dict(books_tuple_list)  <span class="hljs-comment"># Converting list to dict</span>
print(tuple_list_to_dictionary)  <span class="hljs-comment"># {1: 'Book 1', 2: 'Book 2', 3: 'Book 3'}</span>

books_list_list = [[<span class="hljs-number">1</span>, <span class="hljs-string">'Book 1'</span>], [<span class="hljs-number">2</span>, <span class="hljs-string">'Book 2'</span>], [<span class="hljs-number">3</span>, <span class="hljs-string">'Book 3'</span>]]
tuple_list_to_dictionary = dict(books_list_list)  <span class="hljs-comment"># Converting list to dict</span>
print(tuple_list_to_dictionary)  <span class="hljs-comment"># {1: 'Book 1', 2: 'Book 2', 3: 'Book 3'}</span>


books_tuple_list = ([<span class="hljs-number">1</span>, <span class="hljs-string">'Book 1'</span>], [<span class="hljs-number">2</span>, <span class="hljs-string">'Book 2'</span>], [<span class="hljs-number">3</span>, <span class="hljs-string">'Book 3'</span>])
tuple_list_to_set = dict(books_tuple_list)  <span class="hljs-comment"># Converting tuple to set</span>
print(tuple_list_to_set)  <span class="hljs-comment"># {'Book 2', 'Book 3', 'Book 1'}</span>

books_list_list = ([<span class="hljs-number">1</span>, <span class="hljs-string">'Book 1'</span>], [<span class="hljs-number">2</span>, <span class="hljs-string">'Book 2'</span>], [<span class="hljs-number">3</span>, <span class="hljs-string">'Book 3'</span>])
list_list_to_set = dict(books_list_list)  <span class="hljs-comment"># Converting list to set</span>
print(list_list_to_set)  <span class="hljs-comment"># {'Book 2', 'Book 3', 'Book 1'}</span>
</code></pre>
<p>In case when we want to convert a set into a dictionary, we need to have each element as a tuple of length 2.</p>
<pre><code class="lang-python">books_tuple_set = {(<span class="hljs-string">'1'</span>, <span class="hljs-string">'Book 1'</span>), (<span class="hljs-string">'2'</span>, <span class="hljs-string">'Book 2'</span>), (<span class="hljs-string">'3'</span>, <span class="hljs-string">'Book 3'</span>)}
tuple_set_to_dict = dict(books_tuple_set)  <span class="hljs-comment"># Converting dict to set</span>
print(tuple_set_to_dict)  <span class="hljs-comment"># {'1', '3', '2'}</span>
</code></pre>
<p>If we try to do a conversion of a set that has each element as a list of length 2 into a dictionary, we are going to get an error:</p>
<pre><code class="lang-python">books_list_set = {[<span class="hljs-string">'1'</span>, <span class="hljs-string">'Book 1'</span>], [<span class="hljs-string">'2'</span>, <span class="hljs-string">'Book 2'</span>], [<span class="hljs-string">'3'</span>, <span class="hljs-string">'Book 3'</span>]}
list_set_to_dict = dict(books_list_set)  <span class="hljs-comment"># Converting dict to set</span>
print(list_set_to_dict)  <span class="hljs-comment"># {'1', '3', '2'}</span>
</code></pre>
<p>After we run the last code block, we are going to get an error:</p>
<pre><code class="lang-python">TypeError: unhashable type: <span class="hljs-string">'list'</span>
</code></pre>
<h2 id="heading-wrapping-up-data-types">Wrapping Up Data Types</h2>
<p>In conclusion, Python has a variety of data types that you can use to store data. These data types are important to know so that you can choose the right one for your needs.</p>
<p>Be sure to use the right data type for the task that is in front of you to avoid errors and optimize performance.</p>
<h1 id="heading-control-flow-in-python">Control Flow in Python</h1>
<h3 id="heading-conditional-statements">Conditional statements</h3>
<p>When you think about ways we think and also communicate with each other, you may get the impression that we are indeed always using conditions.</p>
<ul>
<li><p>If it's 8 am, I take the bus and go to work.</p>
</li>
<li><p>If I am hungry, I eat.</p>
</li>
<li><p>If this item is cheap, I can afford it.</p>
</li>
</ul>
<p>This is also something that you can do in programming. We can use conditions to control the flow of the execution.</p>
<p>To do that, we use the reserved term <em>if</em> and an expression that evaluates to a True or False value. We can then also use an <em>else</em> statement where we want the flow to continue in cases when the <em>if</em> condition is not met.</p>
<p>To make it easier to understand, let's assume that we have an example where we want to check whether a number is positive:</p>
<pre><code class="lang-python"><span class="hljs-keyword">if</span> number &gt; <span class="hljs-number">0</span>:
    print(<span class="hljs-string">"The given number is positive"</span>)
<span class="hljs-keyword">else</span>:
    print(<span class="hljs-string">"The given number is not positive"</span>)
</code></pre>
<p>If we were to have <em>number = 2</em>: we would enter into the <em>if</em> branch and execute the command that is used to print the following text in the console:</p>
<pre><code class="lang-bash">The given number is positive
</code></pre>
<p>If we would have another number, such as -1, we would see in the console the following message being printed:</p>
<pre><code class="lang-python">The given number <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> positive
</code></pre>
<p>We can also add additional conditions – and not just 2 like above – by using <em>elif</em> which is evaluated when the <em>if</em> expression is not evaluated.</p>
<p>Let's see an example to make it easier for you to understand:</p>
<pre><code class="lang-python"><span class="hljs-keyword">if</span> number &gt; <span class="hljs-number">0</span>:
    print(<span class="hljs-string">"The given number is positive"</span>)
<span class="hljs-keyword">elif</span> number == <span class="hljs-number">0</span>:
    print(<span class="hljs-string">"The given number is 0"</span>)
<span class="hljs-keyword">else</span>:
    print(<span class="hljs-string">"The given number is negative"</span>)
</code></pre>
<p>Now if we were to have <em>number = 0</em>, the first condition is not going to be met, since the value is not greater than 0. As you can guess, since the given number is equal to 0, we are going to see the following message being printed in the console:</p>
<pre><code class="lang-bash">The given number is 0
</code></pre>
<p>In cases when the value is negative, our program is going to pass the first two conditions since they are not satisfied and then jump into the <em>else</em> branch and print the following message in the console:</p>
<pre><code class="lang-bash">The given number is negative
</code></pre>
<h3 id="heading-looping-iterator">Looping / Iterator</h3>
<p>Looping represents the ability of the program to execute a set of instructions over and over again until a certain condition is met. We can do it with both <em>while</em> and <em>for</em>.</p>
<p>Let's first see the iteration with <em>for</em>.</p>
<h4 id="heading-for-loop-in-python">for loop in Python</h4>
<p>This looping is simple and quite straightforward. All you have to do is specify a starting state and mention the range in which it should iterate, as you can see in the following example:</p>
<pre><code class="lang-python"><span class="hljs-keyword">for</span> number <span class="hljs-keyword">in</span> range(<span class="hljs-number">1</span>, <span class="hljs-number">7</span>):
    print(number)
</code></pre>
<p>In this example, we are iterating from 1 to 7 and printing each number (from 1 up to 7 excluding 7) in the console.</p>
<p>We can change both the starting and the ending numbers in the range as we want. This way, we can be quite flexible depending on our specific scenarios.</p>
<h4 id="heading-while-loop-in-python">while loop in Python</h4>
<p>Let's now describe iterations with <em>while</em>. This is also another way of doing iterations that is also quite straightforward and intuitive.</p>
<p>Here we need to specify a starting condition before the <em>while</em> block and also update the condition accordingly.</p>
<p>The <strong>while</strong> loop needs a “<strong>loop condition.</strong>” If it stays True, it continues iterating. In this example, when <code>num</code> is <code>11</code> the <strong>loop condition</strong> equals <code>False</code>.</p>
<pre><code class="lang-python">number = <span class="hljs-number">1</span>

<span class="hljs-keyword">while</span> number &lt; <span class="hljs-number">7</span>:
    print(number)
    number += <span class="hljs-number">1</span>  <span class="hljs-comment"># This part is necessary for us to add so that the iteration does not last forever</span>
</code></pre>
<p>This <em>while</em> block is going to print the same statements as the code we used with the <em>for</em> block.</p>
<h4 id="heading-iteration-looping-through-data-structures">Iteration: Looping Through Data Structures</h4>
<p>Now that we have covered both iteration and lists, we can jump into ways of iterating through lists.</p>
<p>We do not just store things in data structures and leave them there for ages. We are supposed to be able to use those elements in different scenarios.</p>
<p>Let's take our list of students from before:</p>
<pre><code class="lang-python">students = [<span class="hljs-string">"Albert"</span>, <span class="hljs-string">"Besart"</span>, <span class="hljs-string">"Fisnik"</span>, <span class="hljs-string">"Festim"</span>, <span class="hljs-string">"Gazmend"</span>]
</code></pre>
<p>Now, to iterate through the list, we can simply type:</p>
<pre><code class="lang-python"><span class="hljs-keyword">for</span> student <span class="hljs-keyword">in</span> students:
    print(student)
</code></pre>
<p>Yes, it's that simple. We are iterating through each element in the list and printing their values.</p>
<p>We can do this for dictionaries as well. But since elements in dictionaries have 2 parts (key and the value), we need to specify both the key and the value as follows:</p>
<pre><code class="lang-python">german_to_english_dictionary = {
    <span class="hljs-string">"Wasser"</span>: <span class="hljs-string">"Water"</span>,
    <span class="hljs-string">"Brot"</span>: <span class="hljs-string">"Bread"</span>,
    <span class="hljs-string">"Milch"</span>: <span class="hljs-string">"Milk"</span>
}

<span class="hljs-keyword">for</span> key, value <span class="hljs-keyword">in</span> german_to_english_dictionary:
    print(<span class="hljs-string">"The German word "</span> + key + <span class="hljs-string">" means "</span> + value + <span class="hljs-string">" in English"</span>)
</code></pre>
<p>We can also get only keys from the elements of the dictionary:</p>
<pre><code class="lang-python"><span class="hljs-keyword">for</span> key <span class="hljs-keyword">in</span> german_to_english_dictionary:
    print(key)
</code></pre>
<p>Note that <em>key</em> and <em>value</em> are simply variable names that we have chosen to illustrate the iteration. But we can use any name that we want for our variables, such as the following example:</p>
<pre><code class="lang-python"><span class="hljs-keyword">for</span> german_word, english_translation <span class="hljs-keyword">in</span> german_to_english_dictionary:
    print(<span class="hljs-string">"The German word "</span> + german_word + <span class="hljs-string">" means "</span> + english_translation + <span class="hljs-string">" in English"</span>)
</code></pre>
<p>This iteration is going to print the same thing in the console as the code block before the last one.</p>
<p>We can also have nested for loops. For example, let's say that we want to iterate through a list of numbers and find a sum of each element with each other element of a list. We can do that using nested <code>for</code> loops:</p>
<pre><code class="lang-python">numbers = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]
sum_of_numbers = []  <span class="hljs-comment"># Empty list</span>

<span class="hljs-keyword">for</span> first_number <span class="hljs-keyword">in</span> numbers:
    <span class="hljs-keyword">for</span> second_number <span class="hljs-keyword">in</span> numbers:  <span class="hljs-comment"># Loop through the list and add the numbers</span>
        current_sum = first_number + second_number
        <span class="hljs-comment"># add current first_number from the first_list to the second_number from the second_list</span>
        sum_of_numbers.append(current_sum)


print(sum_of_numbers)
<span class="hljs-comment"># [2, 3, 4, 3, 4, 5, 4, 5, 6]</span>
</code></pre>
<h4 id="heading-how-to-stop-a-for-loop">How to stop a for-loop</h4>
<p>Sometimes we may need to exit a <code>for</code> loop before it reaches the end. This may be the case when a condition has been met or we have found what we were looking for and there is no need to continue any further.</p>
<p>In those situations, we can use <code>break</code> to stop any other iteration of the <code>for</code> loop.</p>
<p>Let's assume that we want to check whether there is a negative number in a list. In case we find that number, we stop searching for it.</p>
<p>Let's implement this using <code>break</code>:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">-3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">0</span>]

<span class="hljs-keyword">for</span> element <span class="hljs-keyword">in</span> my_list:
    print(<span class="hljs-string">"Current number: "</span>, element)
    <span class="hljs-keyword">if</span> element &lt; <span class="hljs-number">0</span>:
        print(<span class="hljs-string">"We just found a negative number"</span>)
        <span class="hljs-keyword">break</span>

<span class="hljs-comment"># Current number:  1</span>
<span class="hljs-comment"># Current number:  2</span>
<span class="hljs-comment"># Current number:  -3</span>
<span class="hljs-comment"># We just found a negative number</span>
</code></pre>
<p>As we can see, the moment we reach -3, we break from the <code>for</code> loop and stop.</p>
<h4 id="heading-how-to-skip-an-iteration">How to skip an iteration</h4>
<p>There can also be cases when we want to skip certain iterations since we are not interested in them and they do not matter that much. We can do that using <code>continue</code> which prevents code execution below it in that code block and moves the execution procedure towards the next iteration:</p>
<pre><code class="lang-python">my_sum = <span class="hljs-number">0</span>
my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">-3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">0</span>]

<span class="hljs-keyword">for</span> element <span class="hljs-keyword">in</span> my_list:
    <span class="hljs-keyword">if</span> element &lt; <span class="hljs-number">0</span>:  <span class="hljs-comment"># Do not include negative numbers in the sum</span>
        <span class="hljs-keyword">continue</span>
    my_sum += element

print(my_sum)  <span class="hljs-comment"># 7</span>
</code></pre>
<p><code>pass</code> is a statement we can use to help us when we are about to implement a method or something but we haven't done it yet and do not want to get errors.</p>
<p>It helps us execute the program even if some parts of the code are missing:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]

<span class="hljs-keyword">for</span> element <span class="hljs-keyword">in</span> my_list:
    <span class="hljs-keyword">pass</span>  <span class="hljs-comment"># Do nothing</span>
</code></pre>
<h2 id="heading-conditional-statement-wrap-up">Conditional Statement Wrap Up</h2>
<p>In conclusion, Python offers conditional statements to help you control the flow of your program.</p>
<p>The <code>if</code> statement lets you run a block of code only if a certain condition is met. The <code>elif</code> statement lets you run a block of code only if another condition is met. And the <code>else</code> statement lets you run a block of code only if no other condition is met.</p>
<p>These statements are very useful for controlling the flow of your program.</p>
<h1 id="heading-functions-in-python">Functions in Python</h1>
<p>There are plenty of cases when we need to use the same code block again and again. Our first guess would be to write it as many times as we want.</p>
<p>Objectively, it does work, but the truth is, this is a really bad practice. We are doing repetitive work that can be quite boring and it's also prone to more mistakes that we might overlook.</p>
<p>This is the reason why we need to start using code blocks that we can define once and then use that same code anywhere else.</p>
<p>Just think about this in real life: You see a YouTube video that has been recorded and uploaded to YouTube once. It is then going to be watched by many other people, but the video still remains the same one that was uploaded initially.</p>
<p>In other words, we use methods as a representative of a set of coding instructions that are then supposed to be called anywhere else in the code and that we do not have to write it repeatedly.</p>
<p>In cases when we want to modify this method, we simply change it at the place where it was first declared and other places where it is called do not have to do anything.</p>
<p>To define a method in Python, we start by using the <code>def</code> keyword, then the name of the function and then a list of arguments that we expect to be used. After that, we need to start writing the body of the method in a new line after an indentation.</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">add</span>(<span class="hljs-params">first_number, second_number</span>):</span>
    our_sum = first_number + second_number
    <span class="hljs-keyword">return</span> our_sum
</code></pre>
<p>As you can see from the syntax highlighting, both <code>def</code> and <code>return</code> are keywords in Python that you cannot use to name your variables.</p>
<p>Now, everywhere we want this <code>add</code>() to be called, we can just call it there and not have to worry about implementing it entirely.</p>
<p>Since we have defined this method, we can call it in the following way:</p>
<pre><code class="lang-python">result = add(<span class="hljs-number">1</span>, <span class="hljs-number">5</span>)

print(result)  <span class="hljs-comment"># 6</span>
</code></pre>
<p>You might think that this is such a simple method and start asking, why are we even bothering to write a method for it?</p>
<p>You are right. This was a very simple method just to introduce you to the way we can implement functions.</p>
<p>Let's write a function that finds the sum of numbers that are between two specified numbers:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">sum_in_range</span>(<span class="hljs-params">starting_number, ending_number</span>):</span>
    result = <span class="hljs-number">0</span>

    <span class="hljs-keyword">while</span> starting_number &lt; ending_number:
        result = result + starting_number
        starting_number = starting_number + <span class="hljs-number">1</span>

    <span class="hljs-keyword">return</span> result
</code></pre>
<p>This is now a set of instructions that you can call in other places and do not have to write all of it again.</p>
<pre><code class="lang-python">result = sum_in_range(<span class="hljs-number">1</span>, <span class="hljs-number">5</span>)

print(result)  <span class="hljs-comment"># 10</span>
</code></pre>
<p>Note that functions define a scope, which means that variables which are defined in that scope are not accessible outside it.</p>
<p>For example, we cannot access the variable named <code>product</code> outside the scope of the function:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">multiply_in_range</span>(<span class="hljs-params">starting_number, ending_number</span>):</span>
    product = <span class="hljs-number">1</span>
    <span class="hljs-keyword">while</span> starting_number &lt; ending_number:
        product = product * starting_number
        starting_number = starting_number + <span class="hljs-number">1</span>
    <span class="hljs-keyword">return</span> product
</code></pre>
<p><code>product</code> is accessible only inside the body of this method.</p>
<h2 id="heading-default-arguments-in-functions">Default Arguments in Functions</h2>
<p>When we call functions, we may make some of the arguments optional by writing an initial value for them at the header of the function.</p>
<p>Let's take an example of getting a user's first name as a required argument and let the second argument be an optional one.</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_user</span>(<span class="hljs-params">first_name, last_name=<span class="hljs-string">""</span></span>):</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">f"Hi <span class="hljs-subst">{first_name}</span> <span class="hljs-subst">{last_name}</span>"</span>
</code></pre>
<p>We'll now call this function with both arguments:</p>
<pre><code class="lang-python">user = get_user(<span class="hljs-string">"Durim"</span>, <span class="hljs-string">"Gashi"</span>)

print(user)  <span class="hljs-comment"># Hi Durim Gashi</span>
</code></pre>
<p>We can now call that same function even though the the second argument is not specified:</p>
<pre><code class="lang-python">user = get_user(<span class="hljs-string">"Durim"</span>)

print(user)  <span class="hljs-comment"># Hi Durim</span>
</code></pre>
<h2 id="heading-keyword-argument-list">Keyword Argument List</h2>
<p>We can define arguments of functions as keywords:</p>
<pre><code class="lang-python"><span class="hljs-comment"># The first argument is required. The other two are optional</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_user</span>(<span class="hljs-params">number, first_name=<span class="hljs-string">''</span>, last_name=<span class="hljs-string">''</span></span>):</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">f"Hi <span class="hljs-subst">{first_name}</span> <span class="hljs-subst">{last_name}</span>"</span>
</code></pre>
<p>Now, we can call this function by writing arguments as keywords:</p>
<pre><code class="lang-python">user = get_user(<span class="hljs-number">1</span>, last_name=<span class="hljs-string">"Gashi"</span>)

print(user)  <span class="hljs-comment"># Hi  Gashi</span>
</code></pre>
<p>As you can see, we can omit <code>first_name</code> since it is not required. We can also change the ordering of the arguments when calling the function and it will still work the same:</p>
<pre><code class="lang-python">user = get_user(<span class="hljs-number">1</span>, last_name=<span class="hljs-string">"Gashi"</span>, first_name=<span class="hljs-string">'Durim'</span>)

print(user)  <span class="hljs-comment"># Hi Durim Gashi</span>
</code></pre>
<h2 id="heading-data-lifecycle">Data Lifecycle</h2>
<p>Variables that are declared inside a function cannot be accessed outside it. They are isolated.</p>
<p>Let's see an example to illustrate this:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">counting</span>():</span>
    count = <span class="hljs-number">0</span>  <span class="hljs-comment"># This is not accessible outside of the function.</span>


counting()

print(count)  <span class="hljs-comment"># This is going to throw an error when executing, since count is only declared inside the function and is not acessible outside that</span>
</code></pre>
<p>Similarly, we cannot change variables inside functions that have been declared outside functions and that are not passed as arguments:</p>
<pre><code class="lang-python">count = <span class="hljs-number">3331</span>


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">counting</span>():</span>
    count = <span class="hljs-number">0</span>  <span class="hljs-comment"># This is a new variable</span>


counting()

print(count)  <span class="hljs-comment"># 3331</span>
<span class="hljs-comment"># This is declared outside the function and has not been changed</span>
</code></pre>
<h2 id="heading-how-to-change-data-inside-functions">How to Change Data Inside Functions</h2>
<p>We can change mutable data that is passed through a function as arguments. Mutable data represents data that we can modify even after it has been declared. Lists, for example, are mutable data.</p>
<pre><code class="lang-python">names = [<span class="hljs-string">"betim"</span>, <span class="hljs-string">"durim"</span>, <span class="hljs-string">"gezim"</span>]


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">capitalize_names</span>(<span class="hljs-params">current_list</span>):</span>

    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(len(current_list)):
        current_list[i] = current_list[i].capitalize()

    print(<span class="hljs-string">"Inside the function:"</span>, current_list)

    <span class="hljs-keyword">return</span> current_list


capitalize_names(names)  <span class="hljs-comment"># Inside the function: ['Betim', 'Durim', 'Gezim']</span>

print(<span class="hljs-string">"Outside the function:"</span>, names)  <span class="hljs-comment"># Outside the function: ['Betim', 'Durim', 'Gezim']</span>
</code></pre>
<p>In case of immutable data, we can only modify the variable inside a function, but the actual value outside that function is going to remain unchanged. Immutable data are strings and numbers:</p>
<pre><code class="lang-python">name = <span class="hljs-string">"Betim"</span>


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">say_hello</span>(<span class="hljs-params">current_param</span>):</span>
    current_param = current_param + <span class="hljs-string">" Gashi"</span>
    name = current_param  <span class="hljs-comment"># name is a local variable</span>
    print(<span class="hljs-string">"Value inside the function:"</span>, name)
    <span class="hljs-keyword">return</span> current_param


say_hello(name)  <span class="hljs-comment"># Value inside the function: Betim Gashi</span>

print(<span class="hljs-string">"Value outside the function:"</span>, name)  <span class="hljs-comment"># Value outside the function: Betim</span>
</code></pre>
<p>If we really want to update immutable variables through a function, we can assign a return value of a function to the immutable variable:</p>
<pre><code class="lang-python">name = <span class="hljs-string">"Betim"</span>


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">say_hello</span>(<span class="hljs-params">current_param</span>):</span>
    current_param = current_param + <span class="hljs-string">" Gashi"</span>
    name = current_param  <span class="hljs-comment"># name is a local variable</span>
    print(<span class="hljs-string">"Value inside the function"</span>, name)
    <span class="hljs-keyword">return</span> current_param


<span class="hljs-comment"># Here we are assigning the value of name to the current_param that is returned from the function</span>
name = say_hello(name)  <span class="hljs-comment"># Value inside the function Betim Gashi</span>

<span class="hljs-comment"># Value outside the function: Betim Gashi</span>
print(<span class="hljs-string">"Value outside the function:"</span>, name)
</code></pre>
<h2 id="heading-lambda-functions">Lambda Functions</h2>
<p>Lambda functions are anonymous functions that we can use to return an output. We can write lambda functions using the following syntax pattern:</p>
<pre><code class="lang-python"><span class="hljs-keyword">lambda</span> parameters: expression
</code></pre>
<p>The expression can only be written in a single line.</p>
<p>Let's start illustrating these anonymous functions using a few examples.</p>
<p>We'll start with a function that multiples each input with 10:</p>
<pre><code class="lang-python">tenfold = <span class="hljs-keyword">lambda</span> number : number * <span class="hljs-number">10</span>

print(tenfold(<span class="hljs-number">10</span>))  <span class="hljs-comment"># 100</span>
</code></pre>
<p>Let's write another example in which we check whether the given argument is positive or not:</p>
<pre><code class="lang-python">is_positive =  <span class="hljs-keyword">lambda</span> a : <span class="hljs-string">f'<span class="hljs-subst">{a}</span> is positive'</span> <span class="hljs-keyword">if</span> a &gt; <span class="hljs-number">0</span> <span class="hljs-keyword">else</span> <span class="hljs-string">f'<span class="hljs-subst">{a}</span> is not positive'</span>


print(is_positive(<span class="hljs-number">3</span>))  <span class="hljs-comment"># 3 is positive</span>

print(is_positive(<span class="hljs-number">-1</span>))  <span class="hljs-comment"># -1 is not positive</span>
</code></pre>
<p>Note that we cannot use the <code>if</code> clause without the <code>else</code> clause inside a lambda function.</p>
<p>At this point, you may wonder, why do we need to use lambda functions, since they seem to be almost the same as other functions?</p>
<p>We can see that illustrated in the following section.</p>
<h3 id="heading-functions-as-arguments-of-functions">Functions as arguments of functions</h3>
<p>So far, we have seen ways of calling functions using numbers and strings. We can actually call functions with any type of Python object.</p>
<p>We can even provide an entire function as the argument of a function, which can provide a level of abstraction that can be quite useful.</p>
<p>Let's see an example where we want to do a few conversions from one unit into another:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">convert_to_meters</span>(<span class="hljs-params">feet</span>):</span>
    <span class="hljs-keyword">return</span> feet * <span class="hljs-number">0.3048</span>


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">convert_to_feet</span>(<span class="hljs-params">meters</span>):</span>
    <span class="hljs-keyword">return</span> meters / <span class="hljs-number">0.3048</span>


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">convert_to_miles</span>(<span class="hljs-params">kilometers</span>):</span>
    <span class="hljs-keyword">return</span> kilometers / <span class="hljs-number">1.609344</span>


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">convert_to_kilometers</span>(<span class="hljs-params">miles</span>):</span>
    <span class="hljs-keyword">return</span> miles * <span class="hljs-number">1.609344</span>
</code></pre>
<p>Now, we can make a general function and pass another function as an argument:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">conversion</span>(<span class="hljs-params">operation, argument</span>):</span>
    <span class="hljs-keyword">return</span> operation(argument)
</code></pre>
<p>We can now call <code>conversion()</code> like this:</p>
<pre><code class="lang-python">result = conversion(convert_to_miles, <span class="hljs-number">10</span>)

print(result)  <span class="hljs-comment"># 6.2137119223733395</span>
</code></pre>
<p>As you can see, we have written <code>convert_to_miles</code> as a parameter of the function <code>conversion()</code>. We can use other already defined functions like that:</p>
<pre><code class="lang-python">result = conversion(convert_to_feet, <span class="hljs-number">310</span>)

print(result)  <span class="hljs-comment"># 1017.0603674540682</span>
</code></pre>
<p>We can now make use of lambdas and make this type of abstraction much simpler.</p>
<p>Instead of writing all those four functions, we can simply write a concise lambda function and use it as a parameter when calling the <code>conversion()</code> function:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">conversion</span>(<span class="hljs-params">operation, argument</span>):</span>
    <span class="hljs-keyword">return</span> operation(argument)


result = conversion(<span class="hljs-keyword">lambda</span> kilometers: kilometers / <span class="hljs-number">1.609344</span>, <span class="hljs-number">10</span>)

print(result)  <span class="hljs-comment"># 6.2137119223733395</span>
</code></pre>
<p>This is of course simpler.</p>
<p>Let's use a few other examples with built-in functions.</p>
<h4 id="heading-map-function"><code>map()</code> function</h4>
<p>map() is a built-in function that creates a new object by getting results by calling a function on each element of an existing list:</p>
<pre><code class="lang-python">map(function_name, my_list)
</code></pre>
<p>Let's see an example of writing a lambda function as the function of a map.</p>
<p>Let's triple each number in a list using list comprehension:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>]

triple_list = [x * <span class="hljs-number">3</span> <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> my_list]

print(triple_list)  <span class="hljs-comment"># [3, 6, 9, 12]</span>
</code></pre>
<p>We can implement that using a <code>map()</code> function and a lambda function:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>]

triple_list = map(<span class="hljs-keyword">lambda</span> x: x * <span class="hljs-number">3</span>, my_list)

print(triple_list)  <span class="hljs-comment"># [3, 6, 9, 12]</span>
</code></pre>
<p>This creates a new list. The old list is not changed.</p>
<h4 id="heading-filter-function"><code>filter()</code> function</h4>
<p>This is another built-in function that we can use to filter elements of a list that satisfy a condition.</p>
<p>Let's first filter out negative elements from a list using list comprehension:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">3</span>, <span class="hljs-number">-1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">0</span>, <span class="hljs-number">14</span>]

non_negative_list = [x <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> my_list <span class="hljs-keyword">if</span> x &gt;= <span class="hljs-number">0</span>]

print(non_negative_list)  <span class="hljs-comment"># [3, 2, 0, 14]</span>
</code></pre>
<p>Now, we'll filter elements using <code>filter()</code> and a lambda function. This function returns an object which we can convert into a list using <code>list()</code>:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">3</span>, <span class="hljs-number">-1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">0</span>, <span class="hljs-number">14</span>]

non_negative_filter_object = filter(<span class="hljs-keyword">lambda</span> x: x &gt;= <span class="hljs-number">0</span>, my_list)

non_negative_list = list(non_negative_filter_object)

print(non_negative_list)  <span class="hljs-comment"># [3, 2, 0, 14]</span>
</code></pre>
<p>You should now understand how you can call functions with other functions as arguments and why lambdas are useful and important.</p>
<h2 id="heading-decorators-in-python">Decorators in Python</h2>
<p>A decorator represents a function that accepts another function as an argument.</p>
<p>We can think of it as a dynamic way of changing the way a function, method, or class behaves without having to use subclasses.</p>
<p>Once a function is being passed as an argument to a decorator, it will be modified and then returned as a new function.</p>
<p>Let's start with a basic function that we want to decorate:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">reverse_list</span>(<span class="hljs-params">input_list</span>):</span>
    <span class="hljs-keyword">return</span> input_list[::<span class="hljs-number">-1</span>]
</code></pre>
<p>In this example, we are simply returning a reversed list.</p>
<p>We can also write a function that accepts another function as an argument:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">reverse_list</span>(<span class="hljs-params">input_list</span>):</span>
    <span class="hljs-keyword">return</span> input_list[::<span class="hljs-number">-1</span>]


<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">reverse_input_list</span>(<span class="hljs-params">another_function, input_list</span>):</span>
    <span class="hljs-comment"># we are delegating the execution to another_function() </span>
    <span class="hljs-keyword">return</span> another_function(input_list)


result = reverse_input_list(reverse_list, [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>])

print(result)  <span class="hljs-comment"># [3, 2, 1]</span>
</code></pre>
<p>We can also nest a function inside another function:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">reverse_input_list</span>(<span class="hljs-params">input_list</span>):</span>
    <span class="hljs-comment"># reverse_list() is now a local function that is not accessible from the outside</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">reverse_list</span>(<span class="hljs-params">another_list</span>):</span>
        <span class="hljs-keyword">return</span> another_list[::<span class="hljs-number">-1</span>]

    result = reverse_list(input_list)
    <span class="hljs-keyword">return</span> result               <span class="hljs-comment"># Return the result of the local function</span>


result = reverse_input_list([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>])
print(result)  <span class="hljs-comment"># [3, 2, 1]</span>
</code></pre>
<p>In this example, <code>reverse_list()</code> now is a local function and cannot be called outside the scope of the <code>reverse_input_list()</code> function.</p>
<p>Now we can write our first decorator:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">reverse_list_decorator</span>(<span class="hljs-params">input_function</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">function_wrapper</span>():</span>
        returned_result = input_function()
        reversed_list = returned_result[::<span class="hljs-number">-1</span>]
        <span class="hljs-keyword">return</span> reversed_list

    <span class="hljs-keyword">return</span> function_wrapper
</code></pre>
<p><code>reverse_list_decorator()</code> is a decorator function that takes as input another function. To call it, we need to write another function:</p>
<pre><code class="lang-python"><span class="hljs-comment"># Function that we want to decorate</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_list</span>():</span>
    <span class="hljs-keyword">return</span> [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>]
</code></pre>
<p>Now we can call the decorator with our new function as an argument:</p>
<pre><code class="lang-python">decorator = reverse_list_decorator(get_list)  <span class="hljs-comment"># This returns a reference to the function</span>

result_from_decorator = decorator()  <span class="hljs-comment"># Here we call the actual function using parenthesis</span>

<span class="hljs-comment"># We can now print the result in the console</span>
print(result_from_decorator)  <span class="hljs-comment"># [5, 4, 3, 2, 1]</span>
</code></pre>
<p>Here is the complete example:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">reverse_list_decorator</span>(<span class="hljs-params">input_function</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">function_wrapper</span>():</span>
        returned_result = input_function()
        reversed_list = returned_result[::<span class="hljs-number">-1</span>]
        <span class="hljs-keyword">return</span> reversed_list

    <span class="hljs-keyword">return</span> function_wrapper

<span class="hljs-comment"># Function that we want to decorate</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_list</span>():</span>
    <span class="hljs-keyword">return</span> [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>]


<span class="hljs-comment"># This returns a reference to the function</span>
decorator = reverse_list_decorator(get_list)

<span class="hljs-comment"># Here we call the actual function using the parenthesis</span>
result_from_decorator = decorator()

<span class="hljs-comment"># We can now print the result in the console</span>
print(result_from_decorator)  <span class="hljs-comment"># [5, 4, 3, 2, 1]</span>
</code></pre>
<p>We can also call a decorator using annotations. To do that, we use the <code>@</code> sign before the name of the decorator that we want to call and put it right above the name of the function:</p>
<pre><code class="lang-python"><span class="hljs-comment"># Function that we want to decorate</span>
<span class="hljs-meta">@reverse_list_decorator  # The annotation of the decorator function</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_list</span>():</span>
    <span class="hljs-keyword">return</span> [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>]
</code></pre>
<p>Now, we can simply call the function<code>get_list()</code> and the decorator is going to be applied in it:</p>
<pre><code class="lang-python">result_from_decorator = get_list()

print(result_from_decorator)  <span class="hljs-comment"># [5, 4, 3, 2, 1]</span>
</code></pre>
<h3 id="heading-how-to-stack-decorators">How to stack decorators</h3>
<p>We can also use more than one decorator for a single function. Their order of execution starts from top to bottom, meaning that the decorator that has been defined first is applied first, then the second one, and so on.</p>
<p>Let's do a simple experiment and apply the same decorator that we defined in the previous section twice.</p>
<p>First let's understand what that means.</p>
<p>So we first call the decorator to reverse a list:</p>
<p><code>[1, 2, 3, 4, 5]</code> to <code>[5, 4, 3, 2, 1]</code></p>
<p>Then we apply it again, but now with the returned result from the previous calling of the decorator:</p>
<p><code>[5, 4, 3, 2, 1]</code> =&gt; <code>[1, 2, 3, 4, 5]</code></p>
<p>In other words, reversing a list and then reversing that reversed list again is going to return the original ordering of the list.</p>
<p>Let's see this with decorators:</p>
<pre><code class="lang-python"><span class="hljs-meta">@reverse_list_decorator</span>
<span class="hljs-meta">@reverse_list_decorator</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_list</span>():</span>
    <span class="hljs-keyword">return</span> [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>]


result = get_list()

print(result)  <span class="hljs-comment"># [1, 2, 3, 4, 5]</span>
</code></pre>
<p>I'll explain this with another example.</p>
<p>Let's implement another decorator that only returns numbers that are larger than 1. We then want to reverse that returned list with our existing decorator.</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">positive_numbers_decorator</span>(<span class="hljs-params">input_list</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">function_wrapper</span>():</span>
        <span class="hljs-comment"># Get only numbers larger than 0</span>
        numbers = [number <span class="hljs-keyword">for</span> number <span class="hljs-keyword">in</span> input_list() <span class="hljs-keyword">if</span> number &gt; <span class="hljs-number">0</span>]
        <span class="hljs-keyword">return</span> numbers

    <span class="hljs-keyword">return</span> function_wrapper
</code></pre>
<p>Now we can call this decorator and the other decorator that we have implemented:</p>
<pre><code class="lang-python"><span class="hljs-meta">@positive_numbers_decorator</span>
<span class="hljs-meta">@reverse_list_decorator</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_list</span>():</span>
    <span class="hljs-keyword">return</span> [<span class="hljs-number">1</span>, <span class="hljs-number">-2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">-4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">-6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">-8</span>, <span class="hljs-number">9</span>]


result = get_list()
print(result)  <span class="hljs-comment"># [9, 7, 5, 3, 1]</span>
</code></pre>
<p>Here is the complete example:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">reverse_list_decorator</span>(<span class="hljs-params">input_function</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">function_wrapper</span>():</span>
        returned_result = input_function()
        reversed_list = returned_result[::<span class="hljs-number">-1</span>]  <span class="hljs-comment"># Reverse the list</span>
        <span class="hljs-keyword">return</span> reversed_list

    <span class="hljs-keyword">return</span> function_wrapper


<span class="hljs-comment"># First decoorator</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">positive_numbers_decorator</span>(<span class="hljs-params">input_list</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">function_wrapper</span>():</span>
        <span class="hljs-comment"># Get only numbers larger than 0</span>
        numbers = [number <span class="hljs-keyword">for</span> number <span class="hljs-keyword">in</span> input_list() <span class="hljs-keyword">if</span> number &gt; <span class="hljs-number">0</span>]
        <span class="hljs-keyword">return</span> numbers

    <span class="hljs-keyword">return</span> function_wrapper

<span class="hljs-comment"># Function that we want to decorate</span>


<span class="hljs-meta">@positive_numbers_decorator</span>
<span class="hljs-meta">@reverse_list_decorator</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_list</span>():</span>
    <span class="hljs-keyword">return</span> [<span class="hljs-number">1</span>, <span class="hljs-number">-2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">-4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">-6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">-8</span>, <span class="hljs-number">9</span>]


result = get_list()
print(result)  <span class="hljs-comment"># [9, 7, 5, 3, 1]</span>
</code></pre>
<h3 id="heading-how-to-pass-arguments-to-decorator-functions">How to pass arguments to decorator functions</h3>
<p>We can also pass arguments to decorator functions:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">add_numbers_decorator</span>(<span class="hljs-params">input_function</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">function_wrapper</span>(<span class="hljs-params">a, b</span>):</span>
        result = <span class="hljs-string">'The sum of {} and {} is {}'</span>.format(
            a, b, input_function(a, b))  <span class="hljs-comment"># calling the input function with arguments</span>
        <span class="hljs-keyword">return</span> result
    <span class="hljs-keyword">return</span> function_wrapper


<span class="hljs-meta">@add_numbers_decorator</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">add_numbers</span>(<span class="hljs-params">a, b</span>):</span>
    <span class="hljs-keyword">return</span> a + b


print(add_numbers(<span class="hljs-number">1</span>, <span class="hljs-number">2</span>))  <span class="hljs-comment"># The sum of 1 and 2 is 3</span>
</code></pre>
<h4 id="heading-built-in-decorators">Built-in decorators</h4>
<p>Python comes with multiple built-in decorators, such as <code>@classmethod</code>, <code>@staticmethod</code>, <code>@property</code>, and so on. We'll cover these in the next chapter.</p>
<h2 id="heading-function-wrap-up">Function Wrap Up</h2>
<p>Python is an excellent language for writing functions because they are easy to write.</p>
<p>Lambda functions are a great way to make small, concise functions in Python. They're perfect for when you don't need a full-blown function, or when you just want to test out a snippet of code.</p>
<p>Python decorators are a great way to improve code readability and maintainability. They allow you to modularize your code and make it more organized. You can also use them to perform various tasks such as logging, exception handling, and testing. So if you're looking for a way to clean up your Python code, consider using decorators.</p>
<h1 id="heading-object-oriented-programming-in-python">Object Oriented Programming in Python</h1>
<p>If you go to buy a cookie at a local store, you are going to get a version of the cookie that has been produced in many other copies.</p>
<p>There's a cookie cutter at a factory that has been used to produce a large number of cookies that are then distributed all throughout different stores where those cookies are then served to the end customers.</p>
<p>We can think of that cookie cutter as a blueprint that has been designed once and is used many times afterwards. We also use this sort of blueprint in computer programming.</p>
<p>A blueprint that is used to create countless other copies is called a <strong>class</strong>. We can think of a class like a class called <strong>Cookie</strong>, <strong>Factory</strong>, <strong>Building</strong>, <strong>Book</strong>, <strong>Pencil</strong>, and so on. We can use the class of <strong>cookie</strong> as a blueprint to create as many instances as we want of it that we call objects.</p>
<p>In other words, blueprints are classes that are used as <em>cookie cutters</em>, whereas the cookies that are served at different stores are <em>objects</em>.</p>
<p><strong>Object Oriented Programming</strong> represents a way of organizing a program using classes and objects. We use classes to create objects. Objects interact with each other.</p>
<p>We do not use the exact same blueprint for every object that is out there. There is a blueprint for producing books, another one for producing pencils, and so on. We need to categorize them based on attributes and their functionalities.</p>
<p>An object that is created from the Pencil class can have a color type, a manufacturer, a specific thickness, and so on. These are the <strong>attributes</strong>. A <em>pencil</em> object can also <em>write</em> which represents its functionality, or its <strong>method</strong>.</p>
<p>We use classes and objects in different programming languages, including Python.</p>
<p>Let's see how a very basic <em>Bicycle</em> class looks in Python:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bicycle</span>:</span>
    <span class="hljs-keyword">pass</span>
</code></pre>
<p>We have used the keyword <em>class</em> to indicate that we are about to start writing a class and then we type the name of the class.</p>
<p>We have added the <code>pass</code> because we don't want the Python interpreter to yell at us by throwing errors for not continuing to write the remaining part of the code that belongs to this class.</p>
<p>Now, if we want to create new objects from this class <em>Bicycle</em>, we can simply write the name of the object (which can be any variable name that you want) and initiailize it with the constructor method <em>Bicycle()</em> that is used to create new objects:</p>
<pre><code class="lang-python">favorite_bike = Bicycle()
</code></pre>
<p>In this case, <em>favorite_bike</em> is an object that is created from the class <em>Bicycle</em>. It gets all the functionalities and attributes of the class Bicycle.</p>
<p>We can enrich our <em>Bicycle</em> class and include additional attributes so that we can have custom <em>bikes</em>, tailored to our needs.</p>
<p>To do that, we can define a constructor method called <em>init</em> as follows:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bicycle</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, manufacturer, color, is_mountain_bike</span>):</span>
        self.manufacturer = manufacturer
        self.color = color
        self.is_mountain_bike = is_mountain_bike
</code></pre>
<p>Note the usage of underscores before and after the name <code>init</code> of the method. They represent indicators to the Python interpreter to treat that method as a special method.</p>
<p>This is a method that does not return anything. It is a good practice to define it as the first method of the class, so that other developers can also see it being at a specific line.</p>
<p>Now, if we want to create new objects using this blueprint of bicycles, we can simply write:</p>
<pre><code class="lang-python">bike = Bicycle(<span class="hljs-string">"Connondale"</span>, <span class="hljs-string">"grey"</span>, <span class="hljs-literal">True</span>)
</code></pre>
<p>We have provided our custom parameters for this bike and are passing them to the constructor method. Then we get a new bike with those specific attributes in return. As you can probably tell, we are creating a grey mountain bike of the brand <code>Connondale</code>.</p>
<p>We can also create objects from classes by using optional arguments as follows:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bicycle</span>:</span>
    <span class="hljs-comment"># All the following attributes are optional</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, manufacturer=None, color=<span class="hljs-string">'grey'</span>, is_mountain_bike=False</span>):</span>
        self.manufacturer = manufacturer
        self.color = color
        self.is_mountain_bike = is_mountain_bike
</code></pre>
<p>Now we have just created this object with these attributes, which are not currently accessible outside the scope of the class.</p>
<p>This means that we have created this new object from the <em>Bicycle</em> class, but its corresponding attributes are not accessible. To access them, we can implement methods that help us access them.</p>
<p>To do that, we are going to define <code>getters</code> and <code>setters</code>, which represent methods that we use to get and set values of attributes of objects. We are going to use an annotation called <code>@property</code> to hep us with that.</p>
<p>Let’s see it with code:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bicycle</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, manufacturer, color, is_mountain_bike</span>):</span>
        self._manufacturer = manufacturer
        self._color = color
        self._is_mountain_bike = is_mountain_bike

<span class="hljs-meta">    @property</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">manufacturer</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self._manufacturer

<span class="hljs-meta">    @manufacturer.setter</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">manufacturer</span>(<span class="hljs-params">self, manufacturer</span>):</span>
        self._manufacturer = manufacturer


bike = Bicycle(<span class="hljs-string">"Connondale"</span>, <span class="hljs-string">"Grey"</span>, <span class="hljs-literal">True</span>)

print(bike.manufacturer)  <span class="hljs-comment"># Connondale</span>
</code></pre>
<p>We can write getters and setters for all the attributes of the class:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bicycle</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, manufacturer, color, is_mountain_bike</span>):</span>
        self._manufacturer = manufacturer
        self._color = color
        self._is_mountain_bike = is_mountain_bike

<span class="hljs-meta">    @property</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">manufacturer</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self._manufacturer

<span class="hljs-meta">    @manufacturer.setter</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">manufacturer</span>(<span class="hljs-params">self, manufacturer</span>):</span>
        self._manufacturer = manufacturer

<span class="hljs-meta">    @property</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">color</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self._color

<span class="hljs-meta">    @color.setter</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">color</span>(<span class="hljs-params">self, color</span>):</span>
        self._color = color

<span class="hljs-meta">    @property</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">is_mountain_bike</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self._is_mountain_bike

<span class="hljs-meta">    @is_mountain_bike.setter</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">is_mountain_bike</span>(<span class="hljs-params">self, is_mountain_bike</span>):</span>
        self.is_mountain_bike = is_mountain_bike

bike = Bicycle(<span class="hljs-string">"Connondale"</span>, <span class="hljs-string">"Grey"</span>, <span class="hljs-literal">True</span>)
</code></pre>
<p>Now that we have defined them, we can call these getter methods as attributes:</p>
<pre><code class="lang-python">print(bike.manufacturer)  <span class="hljs-comment"># Connondale</span>
print(bike.color)  <span class="hljs-comment"># Grey</span>
print(bike.is_mountain_bike)  <span class="hljs-comment"># True</span>
</code></pre>
<p>We can also modify the value that we initially used for any attribute by simply typing the name of object and the attribute where we want to change the content:</p>
<pre><code class="lang-python">bike.is_mountain_bike = <span class="hljs-literal">False</span>
bike.color = <span class="hljs-string">"Blue"</span>
bike.manufacturer = <span class="hljs-string">"Trek"</span>
</code></pre>
<p>Our classes can also have other methods as well and not just getters and setters.</p>
<p>Let's define a method inside the class Bicycle that we can then call from any object that we have created from that class:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bicycle</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, manufacturer, color, is_mountain_bike</span>):</span>
        self._manufacturer = manufacturer
        self._color = color
        self._is_mountain_bike = is_mountain_bike

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_description</span>(<span class="hljs-params">self</span>):</span>
        desc = <span class="hljs-string">"This is a "</span> + self._color + <span class="hljs-string">" bike of the brand "</span> + self._manufacturer
        <span class="hljs-keyword">return</span> desc
</code></pre>
<p>We have created a very simple method in which we are preparing a string as a result from the attributes of the object that we are creating. We can then call this method like any other method.</p>
<p>Let's see this in action:</p>
<pre><code class="lang-python">bike = Bicycle(<span class="hljs-string">"Connondale"</span>, <span class="hljs-string">"Grey"</span>, <span class="hljs-literal">True</span>)

print(bike.get_description())  <span class="hljs-comment"># This is a Grey bike of the brand Connondale</span>
</code></pre>
<h2 id="heading-methods-in-python">Methods in Python</h2>
<p>Methods are similar to functions, which we covered above.</p>
<p>In a nutshell, we group a few statements in a code block called method. There we perform some operations that we expect to be done more than once and do not want to write them again and again. In the end, we may not return any result at all.</p>
<p>There are three types of methods in Python:</p>
<ul>
<li><p>instance methods</p>
</li>
<li><p>class methods</p>
</li>
<li><p>static methods</p>
</li>
</ul>
<p>Let's briefly talk about the overall structure of methods and then dive a little more into detail for each method type.</p>
<h4 id="heading-parameters">Parameters</h4>
<p>Parameters of a method make it possible for us to pass on dynamic values that can then be taken into consideration when executing the statements that are inside the method.</p>
<p>The <code>return</code> statement represents the statement that is going to be the last one to be executed in that method. It is an indicator for the Python interpreter to stop the execution of any other line and return a value.</p>
<h4 id="heading-the-self-argument">The self argument</h4>
<p>The first argument of a method in Python is <code>self</code> which is also one of the differences between a method and a function. It represents a reference to the object to which it belongs to. If we don't specify as the first argument of the method when being declared, the first argument is then treated as a reference to the object.</p>
<p>We only write it when we declare the method, but we do not need to include it when we invoke that particular method using an object as a caller.</p>
<p>It is not required that we name it <code>self</code>, but it is a convention that is widely practiced by developers writing Python code all around the world.</p>
<p>Let's define an instance method inside the class <code>Bicycle</code> that we can then call from any object that we have created from that class:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bicycle</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, manufacturer, color, is_mountain_bike</span>):</span>
        self._manufacturer = manufacturer
        self._color = color
        self._is_mountain_bike = is_mountain_bike

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_description</span>(<span class="hljs-params">self</span>):</span>
        desc = <span class="hljs-string">"This is a "</span> + self._color + <span class="hljs-string">" bike of the brand "</span> + self._manufacturer
        <span class="hljs-keyword">return</span> desc
</code></pre>
<p>We have created a very simple method in which we are preparing a string as a result from the attributes of the object that we are creating. We can then call this method like any other method:</p>
<pre><code class="lang-python">bike = Bicycle(<span class="hljs-string">"Connondale"</span>, <span class="hljs-string">"Grey"</span>, <span class="hljs-literal">True</span>)

print(bike.get_description())  <span class="hljs-comment"># This is a Grey bike of the brand Connondale</span>
<span class="hljs-comment"># We are not passing any argument when calling the method get_description() since we do not need to include self at all</span>
</code></pre>
<h3 id="heading-class-methods">Class methods</h3>
<p>We have covered instance methods so far. These are methods that we can call with objects.</p>
<p>Class methods are methods that we can call using class names and that we can access without needing to create any new object at all.</p>
<p>Since it is a specific type of method, we need to tell the Python interpreter that it is actually different. We do that by making a change in the syntax.</p>
<p>We use the annotation <code>@classmethod</code> above a class method and <code>cls</code> similar to the usage of <code>self</code> for instance methods. <code>cls</code> is just a conventional way of referring to the class that is calling the method – you don't have to use this name.</p>
<p>Let's declare our first class method:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Article</span>:</span>
    blog = <span class="hljs-string">'https://www.python.org/'</span>

    <span class="hljs-comment"># the init method is called when an instance of the class is created</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, title, content</span>):</span>
        self.title = title
        self.content = content

<span class="hljs-meta">    @classmethod</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_blog</span>(<span class="hljs-params">cls</span>):</span>
        <span class="hljs-keyword">return</span> cls.blog
</code></pre>
<p>Now let's call this class method that we have just declared:</p>
<pre><code class="lang-python">print(Article.get_blog())  <span class="hljs-comment"># https://www.python.org/</span>
</code></pre>
<p>Note that we did not have to write any argument when calling the <code>get_blog()</code> method. On the other hand, when we declare methods and instance methods, we should always include at least one argument.</p>
<h3 id="heading-static-methods">Static methods</h3>
<p>These are methods that do not have direct relations to class variables or instance variables. You can think of them as utility functions that are supposed to help us do something with arguments that are passed when calling them.</p>
<p>We can call them by using both the class name and an object that is created by that class where this method is declared. This means that they do not need to have their first argument related to the object or class calling them (as was the case with using parameters <code>self</code> for instance methods and <code>cls</code> for class methods).</p>
<p>There is no limit to the number of arguments that we can use to call them.</p>
<p>To create it, we need to use the <code>@staticmethod</code> annotation.</p>
<p>Let's create a static method:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Article</span>:</span>
    blog = <span class="hljs-string">'https://www.python.org/'</span>

    <span class="hljs-comment"># the init method is called when an instance of the class is created</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, title, content</span>):</span>
        self.title = title
        self.content = content

<span class="hljs-meta">    @classmethod</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_blog</span>(<span class="hljs-params">cls</span>):</span>
        <span class="hljs-keyword">return</span> cls.blog

<span class="hljs-meta">    @staticmethod</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">print_creation_date</span>(<span class="hljs-params">date</span>):</span>
        print(<span class="hljs-string">f'The blog was created on <span class="hljs-subst">{date}</span>'</span>)


article = Article(<span class="hljs-string">'First Article'</span>, <span class="hljs-string">'This is the first article'</span>)

<span class="hljs-comment"># Calling the static method using the object</span>
article.print_creation_date(<span class="hljs-string">'2022-07-18'</span>)  <span class="hljs-comment"># The blog was created on 2022-07-18</span>

<span class="hljs-comment"># Calling the static method using the class name</span>
Article.print_creation_date(<span class="hljs-string">'2022-07-21'</span>)  <span class="hljs-comment"># The blog was created on 2022-07-21</span>
</code></pre>
<p>Static methods cannot modify class or instance attributes. They are meant to be like utility functions.</p>
<p>If we try to change a class, we are going to get errors:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Article</span>:</span>
    blog = <span class="hljs-string">'https://www.python.org/'</span>

    <span class="hljs-comment"># the init method is called when an instance of the class is created</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, title, content</span>):</span>
        self.title = title
        self.content = content

<span class="hljs-meta">    @classmethod</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_blog</span>(<span class="hljs-params">cls</span>):</span>
        <span class="hljs-keyword">return</span> cls.blog

<span class="hljs-meta">    @staticmethod</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">set_title</span>(<span class="hljs-params">self, date</span>):</span>
        self.title = <span class="hljs-string">'A random title'</span>
</code></pre>
<p>If we try to call this static method now, we are going to get an error:</p>
<pre><code class="lang-python"><span class="hljs-comment"># Calling the static method using the class name</span>
Article.set_title(<span class="hljs-string">'2022-07-21'</span>)
</code></pre>
<pre><code class="lang-python">TypeError: set_title() missing <span class="hljs-number">1</span> required positional argument: <span class="hljs-string">'date'</span>
</code></pre>
<p>This is because static methods do not have any reference to <code>self</code> as they are not directly related to objects or classes and so they cannot modify attributes.</p>
<h3 id="heading-access-modifier">Access modifier</h3>
<p>When creating classes, we can restrict access to certain attributes and methods so that they are not accessible that easily.</p>
<p>We have <code>public</code>and <code>private</code> access modifiers.</p>
<p>Let's see how both of them work.</p>
<h4 id="heading-public-attributes">Public attributes</h4>
<p>Public attributes are the ones that are accessible from both inside and outside the class.</p>
<p>By default, all attributes and methods are public in Python. If we want them to be private, we need to specify that.</p>
<p>Let's see an example of public attributes:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bicycle</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, manufacturer, color, is_mountain_bike</span>):</span>
        self.manufacturer = manufacturer
        self.color = color
        self.is_mountain_bike = is_mountain_bike

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_manufacturer</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.manufacturer
</code></pre>
<p>In the previous code block, both <code>color</code> and <code>get_manufacturer()</code> are accessible outside the class since they are <code>public</code> and can be accessed both inside and outside the class:</p>
<pre><code class="lang-python">bike = Bicycle(<span class="hljs-string">"Connondale"</span>, <span class="hljs-string">"Grey"</span>, <span class="hljs-literal">True</span>)

print(bike.color)  <span class="hljs-comment"># Grey</span>
print(bike.get_manufacturer())  <span class="hljs-comment"># Connondale</span>
</code></pre>
<h4 id="heading-private-attributes">Private attributes</h4>
<p>Private attributes can be accessed directly only from inside the class.</p>
<p>We can make properties attributes by using the double underscore, as you can see in the following example:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bicycle</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, manufacturer, color, is_mountain_bike, old</span>):</span>
        self.manufacturer = manufacturer
        self.color = color
        self.is_mountain_bike = is_mountain_bike
        self.__old = old  <span class="hljs-comment"># This is a private property</span>
</code></pre>
<p>Now if we try to access <code>__old</code>, we are going to get an error:</p>
<pre><code class="lang-python">bike = Bicycle(<span class="hljs-string">"Connondale"</span>, <span class="hljs-string">"Grey"</span>, <span class="hljs-literal">True</span>, <span class="hljs-literal">False</span>)

print(bike.__old)  <span class="hljs-comment"># AttributeError: 'Bicycle' object has no attribute '__old'</span>
</code></pre>
<p>Let's now see an example where we are declaring private methods using the double underscore in front of the name of the method that we want to make private:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bicycle</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, manufacturer, color, is_mountain_bike, old</span>):</span>
        self.manufacturer = manufacturer
        self.color = color
        self.is_mountain_bike = is_mountain_bike
        self.__old = old  <span class="hljs-comment"># This is a private property</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__get_old</span>(<span class="hljs-params">self</span>):</span>  <span class="hljs-comment"># This is a private method</span>
        <span class="hljs-keyword">return</span> self.__old
</code></pre>
<p>Now, if we want to call this private method from outside the class, an error is going to be thrown:</p>
<pre><code class="lang-python">bike = Bicycle(<span class="hljs-string">"Connondale"</span>, <span class="hljs-string">"Grey"</span>, <span class="hljs-literal">True</span>, <span class="hljs-literal">False</span>)

print(bike.__get_old())  <span class="hljs-comment"># AttributeError: 'Bicycle' object has no attribute '__get_old'</span>
</code></pre>
<p>It is not a common practice to have private variables in Python. However, developers may find it necessary to restrict access so that specific variables are not carelessly accessed and modified.</p>
<h2 id="heading-how-to-hide-information-in-python">How to Hide Information in Python</h2>
<p>When you go out there and use a coffee machine, you aren't expected to know all the engineering details that are behind that machine.</p>
<p>This is the same with your car. When you sit in your driver's seat, you do not analyze and understand all the details of every part of the car. You have some basic idea about them, but other than that, you just focus on driving.</p>
<p>This is a sort of restriction of access from people outside, so that they do not have to worry about exact details that are going on inside.</p>
<p>We can do that in Python as well.</p>
<p>We have seen so far the foundational blocks of object oriented programming, such as classes and objects.</p>
<p>Classes are blueprints that are used to create instances called objects. We can use objects of different classes to interact with each other and build a robust program.</p>
<p>When we work on our own programs, we may need to not let everyone know about all the details that our classes have. So we can limit access to them, so that certain attributes are less likely to be accessed unintentionally and be modified wrongfully.</p>
<p>To help us with that, we hide parts of a class and simply provide an interface that has fewer details about the inner workings of our class.</p>
<p>We can hide data in two ways:</p>
<ol>
<li><p>Encapsulation</p>
</li>
<li><p>Abstraction</p>
</li>
</ol>
<p>Let's begin with Encapsulation.</p>
<h3 id="heading-what-is-encapsulation">What is Encapsulation?</h3>
<p>Encapsulation is not something special and unique just for Python. Other programming languages use it as well.</p>
<p>In a nutshell, we can define it as binding data and methods in a class. We then use this class to create objects.</p>
<p>We encapsulate classes by using <code>private</code> access modifiers that can then restrict direct access to such attributes. This can restrict control.</p>
<p>We are then supposed to write public methods that can provide access to the outside world.</p>
<p>These methods are called <code>getters</code> and <code>setters</code>.</p>
<p>A <strong>getter</strong> method is a method that we use to get the value of an attribute.</p>
<p>A <strong>setter</strong> is a method that we use to set the value of an attribute.</p>
<p>Let's define first define a <code>getter</code> and a <code>setter</code> method that we can use to get values:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Smartphone</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, type=None</span>):</span>  <span class="hljs-comment"># defining initializer for case of no argument</span>
        self.__type = type  <span class="hljs-comment"># setting the type here in the beginning when the object is created</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">set_type</span>(<span class="hljs-params">self, value</span>):</span>
        self.__type = value

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_type</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> (self.__type)
</code></pre>
<p>Now, let's use this class to set the type and also get the type:</p>
<pre><code class="lang-python">smartphone = Smartphone(<span class="hljs-string">'iPhone'</span>)  <span class="hljs-comment"># we are setting the type using the constructor method</span>

<span class="hljs-comment"># getting the value of the type</span>
print(smartphone.get_type())   <span class="hljs-comment"># iPhone</span>

<span class="hljs-comment"># Changing the value of the type</span>
smartphone.set_type(<span class="hljs-string">'Samsung'</span>)  

<span class="hljs-comment"># getting the new value of the type</span>
print(smartphone.get_type())    <span class="hljs-comment"># Samsung</span>
</code></pre>
<p>What we have done so far is set and also read the value of a private attribute of an object created from the <code>Smartphone</code> class.</p>
<p>We can also define <code>getters</code> and <code>setters</code> using the <code>@property</code> annotation.</p>
<p>Let’s see it with code:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bicycle</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, manufacturer, color</span>):</span>
        self._manufacturer = manufacturer
        self._color = color

<span class="hljs-meta">    @property</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">manufacturer</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self._manufacturer

<span class="hljs-meta">    @manufacturer.setter</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">manufacturer</span>(<span class="hljs-params">self, manufacturer</span>):</span>
        self._manufacturer = manufacturer

<span class="hljs-meta">    @property</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">color</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self._color

<span class="hljs-meta">    @color.setter</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">color</span>(<span class="hljs-params">self, color</span>):</span>
        self._color = color


bike = Bicycle(<span class="hljs-string">"Connondale"</span>, <span class="hljs-string">"Grey"</span>)
</code></pre>
<p>Now that we have defined them, we can call these getter methods as attributes:</p>
<pre><code class="lang-python">print(bike.manufacturer)  <span class="hljs-comment"># Connondale</span>
print(bike.color)  <span class="hljs-comment"># Grey</span>
</code></pre>
<p>We can also modify the value that we initially used for any attribute by simply typing the name of the object and the attribute that we want to modify:</p>
<pre><code class="lang-python">bike.is_mountain_bike = <span class="hljs-literal">False</span>
bike.color = <span class="hljs-string">"Blue"</span>
</code></pre>
<p>Our classes can also have other methods as well, and not just getters and setters.</p>
<p>Let's define a method inside the class Bicycle that we can then call from any object that we have created from that class:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Bicycle</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, manufacturer, color, is_mountain_bike</span>):</span>
        self._manufacturer = manufacturer
        self._color = color
        self._is_mountain_bike = is_mountain_bike

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_description</span>(<span class="hljs-params">self</span>):</span>
        desc = <span class="hljs-string">"This is a "</span> + self._color + <span class="hljs-string">" bike of the brand "</span> + self._manufacturer
        <span class="hljs-keyword">return</span> desc
</code></pre>
<p>We have created a very simple method in which we are preparing a string as a result from the attributes of the object that we are creating. We can then call this method like any other method.</p>
<p>Let's see this in action:</p>
<pre><code class="lang-python">bike = Bicycle(<span class="hljs-string">"Connondale"</span>, <span class="hljs-string">"Grey"</span>, <span class="hljs-literal">True</span>)

print(bike.get_description())  <span class="hljs-comment"># This is a Grey bike of the brand Connondale</span>
</code></pre>
<h4 id="heading-but-why-do-we-need-encapsulation">But why do we need encapsulation?</h4>
<p>This looks quite promising and fancy, but you may not get it quite yet. You might need some additional reasons why you need this type of hiding.</p>
<p>To drive this home, let's take another class, where we have a private attribute called <code>salary</code>. Let's say that we don't care about encapsulation and we are only trying to build a class fast and use it in our project for our accountant client.</p>
<p>Let's say that we have the following class:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Employee</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, name=None, email=None, salary=None</span>):</span>
        self.name = name
        self.email = email
        self.salary = salary
</code></pre>
<p>Now, let's create a new <code>employee</code> object and initialize its attributes accordingly:</p>
<pre><code class="lang-python"><span class="hljs-comment"># We are creating an object</span>
betim = Employee(<span class="hljs-string">'Betim'</span>, <span class="hljs-string">'betim@company.com'</span>, <span class="hljs-number">5000</span>)

print(betim.salary)  <span class="hljs-comment"># 5000</span>
</code></pre>
<p>Since <code>salary</code> is not being protected in any way, we can set a new salary for this new object without any problem:</p>
<pre><code class="lang-python">betim.salary = <span class="hljs-number">25000</span>

print(betim.salary)  <span class="hljs-comment"># 25000</span>
</code></pre>
<p>As we can see, this person got five times the salary of what he was getting previously without going through any type of evaluation or interviewing at all. In fact, it happened in a matter of seconds. That's probably going to hit the budget of the company heavily.</p>
<p>We do not want to do that. We want to restrict access to the <code>salary</code> attribute so that it is not called from other places. We can do that by using the double underscore before the attribute name as you can see below:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Employee</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, name=None, email=None, salary=None</span>):</span>
        self.__name = name
        self.__email = email
        self.__salary = salary
</code></pre>
<p>Let's create a new object:</p>
<pre><code class="lang-python"><span class="hljs-comment"># We are creating an object</span>
betim = Employee(<span class="hljs-string">'Betim'</span>, <span class="hljs-string">'betim@company.com'</span>, <span class="hljs-number">1000</span>)
</code></pre>
<p>Now, if we try to access its attributes, we cannot do so, since they are private attributes:</p>
<pre><code class="lang-python">print(betim.salary)  <span class="hljs-comment"># 1000</span>
</code></pre>
<p>Trying to access any of the attributes is going to be followed with an error:</p>
<pre><code class="lang-python">AttributeError: <span class="hljs-string">'Employee'</span> object has no attribute <span class="hljs-string">'salary'</span>
</code></pre>
<p>We can simply implement a method that returns the attributes but we are not providing any way for someone to increase their salary sneakily:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Employee</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, name=None, email=None, salary=None</span>):</span>
        self.__name = name
        self.__email = email
        self.__salary = salary

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_info</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.__name, self.__email, self.__salary
</code></pre>
<p>Now, we can access the information of objects created by this class:</p>
<pre><code class="lang-python"><span class="hljs-comment"># We are creating an object</span>
betim = Employee(<span class="hljs-string">'Betim'</span>, <span class="hljs-string">'betim@company.com'</span>, <span class="hljs-string">'5000'</span>)

print(betim.get_info())  <span class="hljs-comment"># ('Betim', 'betim@company.com', '5000')</span>
</code></pre>
<p>In summary, encapsulation helps us protect properties of objects and provides access them in a controlled fashion.</p>
<h2 id="heading-inheritance-in-python">Inheritance in Python</h2>
<p>In real life, we can share many characteristics with other human beings.</p>
<p>We all need to eat food, drink water, work, sleep, move, and so on. These and many other behaviors and characteristics are shared among billions of people all around the world.</p>
<p>They are not something unique that only our generation has. These traits have been around as long as humans have.</p>
<p>This is also something that is going to last for future generations to come.</p>
<p>We can also have certain shared characteristics between objects and classes that we implement ourselves in computer programming using <strong>inheritance</strong>. This includes both attributes and methods.</p>
<p>Let's imagine that we have a class called <code>Book</code>. It should contain a title, an author, a number of pages, a category, an ISBN, and so on. We are going to keep our class simple and use only two attributes:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Book</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, title, author</span>):</span>
        self.title = title
        self.author = author

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_short_book_paragraph</span>(<span class="hljs-params">self</span>):</span>
        short_paragraph = <span class="hljs-string">"This is a short paragraph of the book."</span>
        <span class="hljs-keyword">return</span> short_paragraph
</code></pre>
<p>Now, we can create an object from this class and access it:</p>
<pre><code class="lang-python">first_book = Book(<span class="hljs-string">"Atomic Habits"</span>, <span class="hljs-string">"James Clear"</span>)

print(first_book.title)  <span class="hljs-comment"># Atomic Habits</span>
print(first_book.author)  <span class="hljs-comment"># James Clear</span>
print(first_book.get_short_book_paragraph())  <span class="hljs-comment"># This is a short paragraph of the book.</span>
</code></pre>
<p>Let's now create a subclass of the class <code>Book</code> that inherits attributes and methods from the class <code>Book</code>, but also has an additional method called <code>get_book_description()</code>:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Book</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, title, author</span>):</span>
        self.title = title
        self.author = author

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_short_book_paragraph</span>(<span class="hljs-params">self</span>):</span>
        short_paragraph = <span class="hljs-string">"This is a short paragraph of the book."</span>
        <span class="hljs-keyword">return</span> short_paragraph


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">BookDetails</span>(<span class="hljs-params">Book</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, title, author</span>):</span>
        Book.__init__(self, title, author)
        <span class="hljs-comment"># Here we are call the constructor of the parent class Book</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_book_details</span>(<span class="hljs-params">self</span>):</span>
        description = <span class="hljs-string">"Title: "</span> + self.title + <span class="hljs-string">". "</span>
        description += <span class="hljs-string">"Author: "</span> + self.author
        <span class="hljs-keyword">return</span> description
</code></pre>
<p>Note the syntax in which we tell Python that <code>BookDetails</code> is a subclass of the class <code>Book</code>:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">BookDetails</span>(<span class="hljs-params">Book</span>):</span>
</code></pre>
<p>If we try to access this new method from objects of the class <code>Book</code>, we are going to get an error:</p>
<pre><code class="lang-python">first_book = Book(<span class="hljs-string">"Atomic Habits"</span>, <span class="hljs-string">"James Clear"</span>)

print(first_book.get_book_details())
<span class="hljs-comment"># AttributeError: 'Book' object has no attribute 'get_book_details'</span>
</code></pre>
<p>This happens because this method <code>get_book_details()</code> can be accessed only from objects of <code>BookDetails</code>:</p>
<pre><code class="lang-python">first_book_details = BookDetails(<span class="hljs-string">"Atomic Habits"</span>, <span class="hljs-string">"James Clear"</span>)

print(first_book_details.get_book_details())
<span class="hljs-comment"># Title: Atomic Habits. Author: James Clear</span>
</code></pre>
<p>We can, however, access any method that is defined in the parent class, which in our case is the <code>Book</code> class:</p>
<pre><code class="lang-python">first_book_details = BookDetails(<span class="hljs-string">"Atomic Habits"</span>, <span class="hljs-string">"James Clear"</span>)

print(first_book_details.get_short_book_paragraph())
<span class="hljs-comment"># This is a short paragraph of the book.</span>
</code></pre>
<p>In the previous classes, <code>Book</code> is considered a parent class or a superclass, whereas <code>BookDetails</code> is considered a child class, or a subclass.</p>
<h3 id="heading-super-function"><code>super()</code> function</h3>
<p>There is a special function called <code>super()</code> that we can use from a child class to refer to its parent class without writing the exact name of the parent class.</p>
<p>We use it with initializers, or when calling properties or methods of parent classes.</p>
<p>Let's see all three of them illustrated with examples.</p>
<h4 id="heading-how-to-use-super-with-initializers">How to use <code>super()</code> with initializers</h4>
<p>We can use <code>super()</code> inside the constructor method of the subclass and even call the constructor of the super class:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Animal</span>():</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, name, age</span>):</span>
        self.name = name
        self.age = age


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Cat</span>(<span class="hljs-params">Animal</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, name, age</span>):</span>
        super().__init__(name, age)  <span class="hljs-comment"># calling the parent class constructor</span>
        self.health = <span class="hljs-number">100</span>  <span class="hljs-comment"># initializing a new attribute that is not in the parent class</span>
</code></pre>
<p>We can also replace <code>super()</code> with the name of the parent class, which is going to work in the same way again:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Animal</span>():</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, name, age</span>):</span>
        self.name = name
        self.age = age


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Cat</span>(<span class="hljs-params">Animal</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, name, age</span>):</span>
        Animal.__init__(name, age)  <span class="hljs-comment"># calling the parent class constructor</span>
        self.health = <span class="hljs-number">100</span>  <span class="hljs-comment"># initializing a new attribute that is not in the parent class</span>
</code></pre>
<p>Even changing the order of the lines inside the child's constructor will not cause any error at all.</p>
<h4 id="heading-how-to-use-super-with-class-properties-of-the-parent-class">How to use <code>super()</code> with class properties of the parent class</h4>
<p>We can use <code>super()</code> to access class properties of the parent class, which can be useful especially when both the parent and the child class use the same name for an attribute.</p>
<p>To see that in action, let's assume that we have a class attribute called <code>name</code> which is present both in the parent and the child class. We want to access this variable from both the parent class and the child class.</p>
<p>To do that, we simply need to write <code>super()</code> and then the name of the variable:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Producer</span>:</span>  <span class="hljs-comment"># parent class</span>
    name = <span class="hljs-string">'Samsung'</span>


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Seller</span>(<span class="hljs-params">Producer</span>):</span>  <span class="hljs-comment"># child class</span>
    name = <span class="hljs-string">'Amazon'</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_product_details</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-comment"># Calling the variable from the parent class</span>
        print(<span class="hljs-string">"Producer:"</span>, super().name)

        <span class="hljs-comment"># Calling the variable from the child class</span>
        print(<span class="hljs-string">"Seller:"</span>, self.name)
</code></pre>
<p>Now, if we call method <code>get_product_details()</code>, we are going to get the following printed in the console:</p>
<pre><code class="lang-python">seller = Seller()

seller.get_product_details()

<span class="hljs-comment"># Producer: Samsung</span>
<span class="hljs-comment"># Seller: Amazon</span>
</code></pre>
<h4 id="heading-how-to-use-super-with-methods-of-the-parent-class">How to use <code>super()</code> with methods of the parent class</h4>
<p>We can similarly call methods in the parent class using <code>super()</code>.</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Producer</span>:</span>  <span class="hljs-comment"># parent class</span>
    name = <span class="hljs-string">'Samsung'</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_details</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> <span class="hljs-string">f'Producer name: <span class="hljs-subst">{self.name}</span>'</span>


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Seller</span>(<span class="hljs-params">Producer</span>):</span>  <span class="hljs-comment"># child class</span>
    name = <span class="hljs-string">'Amazon'</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_details</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-comment"># Calling the method from the parent class</span>
        print(super().get_details())

        <span class="hljs-comment"># Calling the variable from the child class</span>
        print(<span class="hljs-string">f'Seller name: <span class="hljs-subst">{self.name}</span>'</span>)


seller = Seller()
seller.get_details()

<span class="hljs-comment"># Producer name: Amazon</span>
<span class="hljs-comment"># Seller name: Amazon</span>
</code></pre>
<p>This is all you need to know about <code>super()</code>.</p>
<h3 id="heading-types-of-inheritance">Types of inheritance</h3>
<p>We can have different types of inheritance based on the relationship of parent classes and child classes:</p>
<ol>
<li><p>Single</p>
</li>
<li><p>Multi-level</p>
</li>
<li><p>Hierarchical</p>
</li>
<li><p>Multiple</p>
</li>
<li><p>Hybrid</p>
</li>
</ol>
<h5 id="heading-1-single-inheritance">1. Single inheritance</h5>
<p>We can have a class that inherits only from another class:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Animal</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self</span>):</span>
        self.health = <span class="hljs-number">100</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_health</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.health


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Cat</span>(<span class="hljs-params">Animal</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, name</span>):</span>
        super().__init__()
        self.health = <span class="hljs-number">150</span>
        self.name = name

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">move</span>(<span class="hljs-params">self</span>):</span>
        print(<span class="hljs-string">"Cat is moving"</span>)

cat = Cat(<span class="hljs-string">"Cat"</span>)

<span class="hljs-comment"># Calling the method from the parent class</span>
print(cat.get_health())  <span class="hljs-comment"># 150</span>

<span class="hljs-comment"># Calling the method from the child class</span>
cat.move()  <span class="hljs-comment"># Cat is moving</span>
</code></pre>
<h5 id="heading-2-multi-level-inheritance">2. Multi-level inheritance</h5>
<p>This is another type of inheritance where a class inherits from another class which inherits from another class: Class A inherits from Class B which inherits from Class C.</p>
<p>Let's implement this in Python:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Creature</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, alive</span>):</span>
        self.alive = alive

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">is_it_alive</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.alive


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Animal</span>(<span class="hljs-params">Creature</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self</span>):</span>
        super().__init__(<span class="hljs-literal">True</span>)
        self.health = <span class="hljs-number">100</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_health</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.health


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Cat</span>(<span class="hljs-params">Animal</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, name</span>):</span>
        super().__init__()
        self.name = name

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">move</span>(<span class="hljs-params">self</span>):</span>
        print(<span class="hljs-string">"Cat is moving"</span>)


cat = Cat(<span class="hljs-string">"Cat"</span>)

<span class="hljs-comment"># Calling the method from the parent of the parent class</span>
print(cat.is_it_alive())

<span class="hljs-comment"># Calling the method from the parent class</span>
print(cat.get_health())  <span class="hljs-comment"># 150</span>

<span class="hljs-comment"># Calling the method from the child class</span>
cat.move()  <span class="hljs-comment"># Cat is moving</span>
</code></pre>
<h5 id="heading-3-hierarchical-inheritance">3. Hierarchical inheritance</h5>
<p>When we derive multiple child classes from the same parent class, then we have hierarchical inheritance. These child classes inherit from the parent class:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Location</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, x, y</span>):</span>
        self.x = x
        self.y = y

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_location</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.x, self.y


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Continent</span>(<span class="hljs-params">Location</span>):</span>
    <span class="hljs-keyword">pass</span>


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Country</span>(<span class="hljs-params">Location</span>):</span>
    <span class="hljs-keyword">pass</span>


continent = Continent(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>)
print(continent.get_location())  <span class="hljs-comment"># (0, 0)</span>

country = Country(<span class="hljs-number">10</span>, <span class="hljs-number">30</span>)
print(country.get_location())  <span class="hljs-comment"># (10, 30)</span>
</code></pre>
<h5 id="heading-4-multiple-inheritance">4. Multiple inheritance</h5>
<p>We can have another type of inheritance, namely multiple inheritance which can help us inherit from more than one class at the same time.</p>
<p>Let's assume that we have a class called <code>Date</code> and another one called <code>Time</code>.</p>
<p>We can then implement another class then inherits from both classes:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Date</span>:</span>
    date = <span class="hljs-string">'2022-07-23'</span>  <span class="hljs-comment"># Hardcoded date</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_date</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.date


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Time</span>:</span>
    time = <span class="hljs-string">'20:20:20'</span>  <span class="hljs-comment"># Hardcoded time</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_time</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.time


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DateTime</span>(<span class="hljs-params">Date, Time</span>):</span>  <span class="hljs-comment"># Inheriting from both</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_date_time</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.get_date() + <span class="hljs-string">' '</span> + self.get_time()  <span class="hljs-comment"># getting methods from its parent classes</span>


date_time = DateTime()
print(date_time.get_date_time())  <span class="hljs-comment"># 2022-07-23 20:20:20</span>
</code></pre>
<h5 id="heading-5-hybrid-inheritance">5. Hybrid inheritance</h5>
<p>Hybrid inheritance is a combination of multiple and multi-level inheritance:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Vehicle</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">print_vehicle</span>(<span class="hljs-params">self</span>):</span>
        print(<span class="hljs-string">'Vehicle'</span>)


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Car</span>(<span class="hljs-params">Vehicle</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">print_car</span>(<span class="hljs-params">self</span>):</span>
        print(<span class="hljs-string">'Car'</span>)


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Ferrari</span>(<span class="hljs-params">Car</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">print_ferrari</span>(<span class="hljs-params">self</span>):</span>
        print(<span class="hljs-string">'Ferrari'</span>)


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Driver</span>(<span class="hljs-params">Ferrari, Car</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">print_driver</span>(<span class="hljs-params">self</span>):</span>
        print(<span class="hljs-string">'Driver'</span>)
</code></pre>
<p>Now, if we create an object from the class <code>Driver</code>, we can call all methods in all classes:</p>
<pre><code class="lang-python">driver = Driver()

<span class="hljs-comment"># Calling all methods from the subclass</span>
driver.print_vehicle()  <span class="hljs-comment"># Vehicle</span>
driver.print_car()  <span class="hljs-comment"># Car</span>
driver.print_ferrari()  <span class="hljs-comment"># Ferrari</span>
driver.print_driver()  <span class="hljs-comment"># Driver</span>
</code></pre>
<h2 id="heading-polymorphism-in-python">Polymorphism in Python</h2>
<p>This is another important concept from Object Oriented Programming that refers to the possibility of an object behaving like different forms and calling different behaviors.</p>
<p>An example of a built-in function that uses polymorphism is the method <code>len()</code> which can be used for both strings and lists:</p>
<pre><code class="lang-python">print(len(<span class="hljs-string">'Python'</span>))  <span class="hljs-comment"># 6</span>

print(len([<span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">-43</span>]))  <span class="hljs-comment"># 3</span>
</code></pre>
<p>We can take another example with a class called <code>House</code>. We can have different subclasses that inherit methods and attributes from that superclass, namely classes such as <code>Condo</code>, <code>Apartment</code>, <code>SingleFamilyHouse</code>, <code>MultiFamilyHouse</code>, and so on.</p>
<p>Let's assume that we want to implement a method in the <code>House</code> class that is supposed to get the area.</p>
<p>Each type of living residence has a different size, so each one of the subclasses should have different implementations.</p>
<p>Now we can define methods into subclasses such as:</p>
<ul>
<li><p><code>getAreaOfCondo()</code></p>
</li>
<li><p><code>getAreaOfApartment()</code></p>
</li>
<li><p><code>getAreaOfSingleFamilyHouse()</code></p>
</li>
<li><p><code>getAreaOfMultiFamilyHouse()</code></p>
</li>
</ul>
<p>This would force us to remember the names of each subclass, which can be tedious and also prone to errors when we call them.</p>
<p>Luckily, there is a simpler method that we can use that comes from polymorphism.</p>
<p>We can have polymorphism using both methods and inheritance.</p>
<p>Let's first see how we can implement polymorphism using methods.</p>
<h3 id="heading-polymorphism-using-methods">Polymorphism using methods</h3>
<p>Let's say that we have two classes, namely <code>Condo</code> and <code>Apartment</code>. Both of them have the method <code>get_area()</code> that returns a value.</p>
<p>Each of them is going to have a custom implementation.</p>
<p>Now the method that we are going to call depends on the class type of the object:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Condo</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, area</span>):</span>
        self.area = area

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_area</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.area


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Apartment</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, area</span>):</span>
        self.area = area

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_area</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.area
</code></pre>
<p>Let's create two objects from these classes:</p>
<pre><code class="lang-python">condo = Condo(<span class="hljs-number">100</span>)

apartment = Apartment(<span class="hljs-number">200</span>)
</code></pre>
<p>Now, we can put both of them in a list and call the same method for both objects:</p>
<pre><code class="lang-python">places_to_live = [condo, apartment]

<span class="hljs-keyword">for</span> place <span class="hljs-keyword">in</span> places_to_live:
    print(place.get_area())  <span class="hljs-comment"># same method for both objects</span>
</code></pre>
<p>After we execute that, we are going to see the following in the console:</p>
<pre><code class="lang-bash"><span class="hljs-comment"># 100</span>
<span class="hljs-comment"># 200</span>
</code></pre>
<p>This is how you implement polymorphism with methods.</p>
<h3 id="heading-polymorphism-with-inheritance">Polymorphism with inheritance</h3>
<p>We can not only call a method from a superclass. We can also use the same name but have a different implementation for it for each subclass.</p>
<p>Let's first define a superclass:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">House</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, area</span>):</span>
        self.area = area

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_price</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">pass</span>
</code></pre>
<p>Then we'll implement subclasses <code>Condo</code> and <code>Apartment</code> of the superclass <code>House</code>:</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">House</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, area</span>):</span>
        self.area = area

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_price</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">pass</span>


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Condo</span>(<span class="hljs-params">House</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, area</span>):</span>
        self.area = area

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_price</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.area * <span class="hljs-number">100</span> 


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Apartment</span>(<span class="hljs-params">House</span>):</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span>(<span class="hljs-params">self, area</span>):</span>
        self.area = area

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get_price</span>(<span class="hljs-params">self</span>):</span>
        <span class="hljs-keyword">return</span> self.area * <span class="hljs-number">300</span>
</code></pre>
<p>As we can see, both subclasses have the method <code>get_price()</code> but different implementations.</p>
<p>We can now create new objects from subclasses and call this method which is going to <em>polymorph</em> based on the object that calls it:</p>
<pre><code class="lang-python">condo = Condo(<span class="hljs-number">100</span>)

apartment = Apartment(<span class="hljs-number">200</span>)

places_to_live = [condo, apartment]

<span class="hljs-keyword">for</span> place <span class="hljs-keyword">in</span> places_to_live:
    print(place.get_price())
</code></pre>
<p>After we execute that, we are going to see the following in the console:</p>
<pre><code class="lang-bash"><span class="hljs-comment"># 10000</span>
<span class="hljs-comment"># 60000</span>
</code></pre>
<p>This is another example of polymorphism where we have specific implementation of a method that has the same name.</p>
<h1 id="heading-importing-in-python">Importing in Python</h1>
<p>One of the main benefits of using a popular language such as Python is its large number of libraries that you can use and benefit from.</p>
<p>Many developers around the world are generous with their time and knowledge and publish a lot of really useful libraries. These libraries can save us plenty of time both in our professional work, but also on our side projects that we may do for fun.</p>
<p>Here are some of the modules with very useful methods that you can immediately start using in your projects:</p>
<ul>
<li><p><code>time</code>: Time access and conversions</p>
</li>
<li><p><code>csv</code>: CSV File Reading and Writing</p>
</li>
<li><p><code>math</code>: Math functions</p>
</li>
<li><p><code>email</code>: Create, send, and process email</p>
</li>
<li><p><code>urllib</code>: Work with URLs</p>
</li>
</ul>
<p>To import one or more modules, we only need to write <code>import</code> and then the name of the modules that we want to import.</p>
<p>Let's import our first module:</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> os
</code></pre>
<p>Now, let's import multiple modules at once:</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> os, numbers, math
</code></pre>
<p>Once we have imported a module, we can start using methods that are inside it.</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> math

print(math.sqrt(<span class="hljs-number">81</span>))  <span class="hljs-comment"># 9.0</span>
</code></pre>
<p>We can also use new names for our imported modules by specifying an alias for them <code>as alias</code> where <code>alias</code> is any variable name that you want:</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> math <span class="hljs-keyword">as</span> math_module_that_i_just_imported

result = math_module_that_i_just_imported.sqrt(<span class="hljs-number">4</span>)

print(result)  <span class="hljs-comment"># 2.0</span>
</code></pre>
<h2 id="heading-how-to-limit-what-we-want-to-import">How to Limit What We Want to Import</h2>
<p>There are times when we do not want to import a whole package with all its methods. This is because we want to avoid overriding methods or variables that are in the module with the ones that we want to implement ourselves.</p>
<p>We can specify parts that we want to import by using the following form:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> module <span class="hljs-keyword">import</span> function
</code></pre>
<p>Let's take an example of importing only the square root function from <code>math</code> module:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> math <span class="hljs-keyword">import</span> sqrt

print(sqrt(<span class="hljs-number">100</span>))  <span class="hljs-comment"># 10.0</span>
</code></pre>
<h2 id="heading-issues-with-importing-everything-from-a-module">Issues with Importing Everything from a Module</h2>
<p>We can also import everything from a module, which can turn out to be a problem. Let's illustrate this with an example.</p>
<p>Let's assume that we want to import everything that is included in the <code>math</code> module. We can do that by using the asterisk like this:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> math <span class="hljs-keyword">import</span> *  <span class="hljs-comment"># The asterisk is an indicator to include everything when importing</span>
</code></pre>
<p>Now, let's assume that we want to declare a variable called <code>sqrt</code>:</p>
<pre><code class="lang-python">sqrt = <span class="hljs-number">25</span>
</code></pre>
<p>When we try to call the function <code>sqrt()</code> from the math module, we are going to get an error, since the interpreter is going to call the latest <code>sqrt</code> variable that we have just declared in the previous code block:</p>
<pre><code class="lang-python">print(sqrt(<span class="hljs-number">100</span>))
</code></pre>
<pre><code class="lang-python">TypeError: <span class="hljs-string">'float'</span> object <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> callable
</code></pre>
<h1 id="heading-how-to-handle-exceptions-in-python">How to Handle Exceptions in Python</h1>
<p>When we are implementing Python scripts or doing any type of implementation, we are going to get many errors that are thrown even when the syntax is correct.</p>
<p>These types of errors that happen during execution are called exceptions.</p>
<p>We indeed do not have to surrender and not do anything regarding them. We can write handlers that are there to do something so that the execution of the program does not stop.</p>
<h2 id="heading-common-exceptions-in-python">Common Exceptions in Python</h2>
<p>Here are some of the most common exceptions that happen in Python with definitions taken from the <a target="_blank" href="https://docs.python.org/3/library/exceptions.html">Python documentation</a>:</p>
<ul>
<li><p><strong>Exception</strong> – This is a class that is as a superclass of most other exception types that happen.</p>
</li>
<li><p><strong>NameError</strong> – Raised when a local or global name is not found.</p>
</li>
<li><p><strong>AttributeError</strong> – Raised when an attribute reference or assignment fails.</p>
</li>
<li><p><strong>SyntaxError</strong> – Raised when the parser encounters a syntax error.</p>
</li>
<li><p><strong>TypeError</strong> – Raised when an operation or function is applied to an object of inappropriate type. The associated value is a string giving details about the type mismatch.</p>
</li>
<li><p><strong>ZeroDivisionError</strong> – Raised when the second argument of a division or modulo operation is zero.</p>
</li>
<li><p><strong>IOError</strong> – Raised when an I/O operation (such as a print statement, the built-in open() function or a method of a file object) fails for an I/O-related reason, e.g., “file not found” or “disk full”.</p>
</li>
<li><p><strong>ImportError</strong> – Raised when an import statement fails to find the module definition or when a <strong>from … import</strong> fails to find a name that is to be imported.</p>
</li>
<li><p><strong>IndexError</strong> – Raised when a sequence subscript is out of range.</p>
</li>
<li><p><strong>KeyError</strong> – Raised when a mapping (dictionary) key is not found in the set of existing keys.</p>
</li>
<li><p><strong>ValueError</strong> – Raised when a built-in operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as IndexError.</p>
</li>
</ul>
<p>There are many other error types, but you don't really need to see about them now. It is also very unlikely that you are going to see all types of errors all the time.</p>
<p>You can see more types of exception in the <a target="_blank" href="https://docs.python.org/3/library/exceptions.html">Python documentation</a>.</p>
<h2 id="heading-how-to-handle-exceptions-in-python-1">How to Handle Exceptions in Python</h2>
<p>Let's start with a very simple example and write a program that throws an error on purpose so that we can then fix it.</p>
<p>We are going to do a division by zero, which is something that you have probably seen at school:</p>
<pre><code class="lang-python">print(<span class="hljs-number">5</span> / <span class="hljs-number">0</span>)
</code></pre>
<p>If we try to execute that, we are going to be greeted with the following error in the console:</p>
<pre><code class="lang-python">ZeroDivisionError: division by zero
</code></pre>
<p>If we were to have such occurrences inside a Python program of any kind, we should catch and wrap this error inside a <code>try/except</code> block.</p>
<p>We need to write inside the <code>try</code> block the part of the code that we expect is going to throw errors. We then catch those types of errors inside the <code>except</code> block by also specifying the type of error that we except to happen.</p>
<p>Let's see the first example.</p>
<p>Let's see how we can deal with that error so that we also get informed that such error happened:</p>
<pre><code class="lang-python"><span class="hljs-keyword">try</span>:
    <span class="hljs-number">5</span> / <span class="hljs-number">0</span>
<span class="hljs-keyword">except</span> ZeroDivisionError:
    print(<span class="hljs-string">'You cannot divide by 0 mate!'</span>)
</code></pre>
<p>As you can see, we are printing a message in the console once we have reached the part where a division by 0 is happening.</p>
<p>We can also omit the part <code>ZeroDivisionError</code> completely:</p>
<pre><code class="lang-python"><span class="hljs-keyword">try</span>:
    <span class="hljs-number">5</span> / <span class="hljs-number">0</span>
<span class="hljs-keyword">except</span>:
    print(<span class="hljs-string">'You cannot divide by 0 mate!'</span>)
</code></pre>
<p>However, this is not recommended, since we are catching all types of errors in a single <code>except</code> block and we are not sure what type of errors are being caught (which would be quite useful for us).</p>
<p>Let's continue with another type of error.</p>
<p>Now we'll try to use a variable that is not defined at all:</p>
<pre><code class="lang-python">name = <span class="hljs-string">'User'</span>

<span class="hljs-keyword">try</span>:
    person = name + surname  <span class="hljs-comment"># surname is not declared</span>
<span class="hljs-keyword">except</span> NameError:
    print(<span class="hljs-string">'A variable is not defined'</span>)
</code></pre>
<p>In the previous example, we have used variable <code>surname</code> before declaring it, therefore a <code>NameError</code>is going to be thrown.</p>
<p>Let's continue with another example that can be quite common.</p>
<p>When we use lists, it can be a common mistake to use an index that is out of range. This means that the index we've used is larger or smaller than the range of indexes of the elements in that list.</p>
<p>Let's illustrate this with an example, where an <code>IndexError</code> is going to be thrown:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>]

<span class="hljs-keyword">try</span>:
    print(my_list[<span class="hljs-number">5</span>])
    <span class="hljs-comment"># This list only has 4 elements, so its indexes range from 0 to 3</span>
<span class="hljs-keyword">except</span> IndexError:
    print(<span class="hljs-string">'You have used an index that is out of range'</span>)
</code></pre>
<p>We can also use a single <code>try</code> block with multiple <code>except</code> errors:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>]

<span class="hljs-keyword">try</span>:
    print(my_list[<span class="hljs-number">5</span>])
    <span class="hljs-comment"># This list only has 4 elements, so its indexes range from 0 to 3</span>
<span class="hljs-keyword">except</span> NameError:
    print(<span class="hljs-string">'You have used an invalid value'</span>)
<span class="hljs-keyword">except</span> ZeroDivisionError:
    print(<span class="hljs-string">'You cannot divide by zero'</span>)
<span class="hljs-keyword">except</span> IndexError:
    print(<span class="hljs-string">'You have used an index that is out of range'</span>)
</code></pre>
<p>In the previous example, we try to initially catch whether there is any variable that is used but not declared. If this error happens, then this <code>except</code> block is going to be taking over the execution flow. This execution flow is going to stop there.</p>
<p>Then, we try to check whether we are dividing by zero. If this error is thrown, then this <code>except</code> block is going to take over the execution and everything that is inside it is going to be executed. Similarly, we continue with the rest of the errors declared.</p>
<p>We can also put more than one error inside parenthesis to catch multiple exceptions. But this is not going to be helpful for us, since we do not know what specific error has been thrown. In other words, the following method does work, but it is not recommended:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>]

<span class="hljs-keyword">try</span>:
    print(my_list[<span class="hljs-number">5</span>])
    <span class="hljs-comment"># This list only has 4 elements, so its indexes range from 0 to 3</span>
<span class="hljs-keyword">except</span> (NameError, ZeroDivisionError, IndexError):
    print(<span class="hljs-string">'A NameError, ZeroDivisionError, or IndexError occurred'</span>)
</code></pre>
<h4 id="heading-the-finally-keyword">The <code>finally</code> keyword</h4>
<p>After the <code>try</code> and <code>except</code> are passed, there is another block that we can declare and execute. This block starts with the <code>finally</code> keyword and it is executed no matter whether we have an error is being thrown or not:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-string">'a'</span>, <span class="hljs-string">'b'</span>]

<span class="hljs-keyword">try</span>:
    print(my_list[<span class="hljs-number">0</span>])
<span class="hljs-keyword">except</span> IndexError:
    print(<span class="hljs-string">'An IndexError occurred'</span>)
<span class="hljs-keyword">finally</span>:
    print(<span class="hljs-string">'The program is ending. This is going to be executed.'</span>)
</code></pre>
<p>If we execute the previous block of code, we are going to see the following in the console:</p>
<pre><code class="lang-python">The program <span class="hljs-keyword">is</span> ending. This <span class="hljs-keyword">is</span> going to be executed.
</code></pre>
<p>We usually write code that we want to be as a cleanup inside the <code>finally</code> block. This includes things like closing a file, stopping a connection with a database, exiting the program entirely, and so on.</p>
<h4 id="heading-try-else-except">try, else, except</h4>
<p>We can write statements inside <code>try</code> and <code>except</code>, but we can also use an <code>else</code> block where we can write code that we want to be executed if there are no errors being thrown:</p>
<pre><code class="lang-python">my_list = [<span class="hljs-string">'a'</span>, <span class="hljs-string">'b'</span>]

<span class="hljs-keyword">try</span>:
    print(my_list[<span class="hljs-number">0</span>])
<span class="hljs-keyword">except</span> IndexError:
    print(<span class="hljs-string">'An IndexError occurred'</span>)
<span class="hljs-keyword">else</span>:
    print(<span class="hljs-string">'No error occurred. Congratulations!'</span>)
</code></pre>
<p>If we execute the code above, we are going to get the following printed in the console:</p>
<pre><code class="lang-python">No error occurred. Congratulations!
</code></pre>
<h3 id="heading-exception-wrap-up">Exception wrap up</h3>
<p>Hopefully you now understand exceptions and the various ways that you can use to handle them. If you handle them correctly, there shouldn't be any sudden interruptions that cause your program to fail unexpectedly.</p>
<h1 id="heading-user-input-in-python">User Input in Python</h1>
<p>When you want to develop an interactive program and get user input in the command line, you can call a function called <code>input()</code>.</p>
<p>It is very simple and all you have to do is declare a variable where you want to save the value that the user types:</p>
<pre><code class="lang-python">user_input = input(<span class="hljs-string">"Please type in your name."</span>)
</code></pre>
<p>We can than use that value and print it:</p>
<pre><code class="lang-python">print(<span class="hljs-string">f'Hello <span class="hljs-subst">{user_input}</span>. Nice to have you here'</span>)
</code></pre>
<h1 id="heading-wrapping-up">Wrapping Up</h1>
<p>This book represents my attempt to make it quick and easy for you to learn the essentials of Python. There are many other things to know about Python that I didn't cover in this book, but we will leave it here.</p>
<p>I hope this is a useful reference for you.</p>
<p>Now that you have had the chance to learn how to write Python, go out there and make a positive impact with your lines of code.</p>
<h2 id="heading-get-the-book-as-a-pdf">Get the book as a PDF</h2>
<p>You can read this book as a PDF by downloading it <a target="_blank" href="https://fatosmorina.gumroad.com/l/pythonprogramming">here</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Programmers Don't Have to be Socially Awkward. Here Are 10 Social Skills To Improve Your Career. ]]>
                </title>
                <description>
                    <![CDATA[ If you work as a software developer, most of your workday is spent dealing with people. Immediately when you start your work for the day, you probably check email, Skype, or Slack, as you are interested in seeing if your work colleagues have somethin... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/programmers-dont-have-to-be-socially-awkward/</link>
                <guid isPermaLink="false">66d45f059208fb118cc6cf9f</guid>
                
                    <category>
                        <![CDATA[ career advice ]]>
                    </category>
                
                    <category>
                        <![CDATA[ soft skill ]]>
                    </category>
                
                    <category>
                        <![CDATA[ teamwork ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Wed, 21 Aug 2019 04:17:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2019/08/Napoleon-Dynamite.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you work as a software developer, most of your workday is spent dealing with people.</p>
<p>Immediately when you start your work for the day, you probably check email, Skype, or Slack, as you are interested in seeing if your work colleagues have something important to tell you.</p>
<p>Then, when you write a response, the destination for your words is another person, not just another computer.</p>
<p>Your main priority at work is to solve problems, which is done while collaborating on projects and hanging out with other people as part of a software development team.</p>
<p>You attend meetings during the day and get the implementation requirements from other people.</p>
<p>When you are finally ready to do one of the most enjoyable activities for a software developer, which is writing code, you are supposed to write a code which is primarily readable for humans. You do not write your software projects in binary codes, but instead in a programming language that is supposed to be easier for both you and teammates to understand.</p>
<p>Even if you are working at a small company, or are a freelancer, you still have to deal with the non-technical people in the project that you are working on.</p>
<p>We spend a lot of our waking hours with our work colleagues. It is even possible that we spend more time with them than with our close family members.</p>
<p>Becoming aware of this will help you realize the importance of having good relationships with others, especially your co-workers.</p>
<p>In this article, you can read some general tips that can help you improve your relationships at work, but that can be applied elsewhere as well.</p>
<p>They are simpler to follow than the frameworks used to develop your applications, but these tips have a huge potential for return over investment.</p>
<h3 id="heading-1-be-very-kind"><strong>1. Be very kind</strong></h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/04/image-236.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Photo by [Unsplash](https://unsplash.com/@mimithian?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit"&gt;Mimi Thian / &lt;a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit)</em></p>
<p>You can be the smartest and the hardest-working person you know, but when you do not have good manners or you lack kindness, others in your workplace might hate collaborating with you. Not because you lack the skills and the ability to write clean and maintainable code, but because of your attitude.</p>
<p>No matter how frustrating a bug is, do not pout, whine, or yell at your colleagues. Those bad manners will not be able to fix your bug. It can even harm your personal and professional relationships and make it very difficult to get back on track later on.</p>
<p>When you are kind, you are more likely to make a good impression on others as a human being in general.</p>
<p>Simple acts of kindness, such as giving someone a ride to or from work, mentioning someone’s favor in front of others, cleaning up a colleague’s space that’s not your job to keep clean, etc., should be done repeatedly, despite knowing your colleagues for a long time.</p>
<p>Your kindness will trigger, at least, a basic human decency from your colleagues as well.</p>
<h3 id="heading-2-always-be-genuinely-interested-in-your-colleagues"><strong>2. Always be genuinely interested in your colleagues</strong></h3>
<p>Try to understand if they need your help, and do not hesitate to kindly help them. When you see that they are stressed, anxious, or going through tough times, talk to them and show readiness to brainstorm solutions about the problems they are involved in.</p>
<p>Even if you cannot help them with their current task, try to encourage them with motivational phrases that can uplift them emotionally. Make them feel that they are important to the team and capable of overcoming the obstacles they’re facing and the down times they might be in.</p>
<p>Your words alone can magically improve the mood of your colleagues.</p>
<h3 id="heading-3-smile-often"><strong>3. Smile often</strong></h3>
<p>Even printing a ‘Hello world’ statement takes more time and effort than smiling and sending smiley emoticons. It may seem trivial, but smiling can lighten up the tension.</p>
<p>A <a target="_blank" href="http://blackburnelrodortho.com/how-smiling-affects-you-and-those-around-you/">scientific study</a> conducted in 2011 at the Face Research Laboratory at the University of Aberdeen in Scotland found that smiling makes you feel more attractive, relaxed, sincere, and confident.</p>
<p>Moreover, <a target="_blank" href="http://blackburnelrodortho.com/how-smiling-affects-you-and-those-around-you/">one Swedish study</a> published in the Scandinavian Journal of Psychology found that humans have an automatic reaction that mimics the facial expressions of those they interact with.</p>
<p>In other words, when you smile often, chances are that others will smile back to you as well. This will not only make you feel better, but it also helps others that you interact with.</p>
<h3 id="heading-4-say-thank-you-and-please-a-lot"><strong>4. Say ‘thank you’ and ‘please’ a lot.</strong></h3>
<p>No matter how small a favor is, do not hesitate to say <em>thank you</em>.</p>
<p>People appreciate when you are polite and grateful, and are aware of their contribution and significance in your life.</p>
<p>This will not only make your colleagues feel better, but it will make you feel better as well, as you will know that other colleagues care about you and are willing to help you.</p>
<p><a target="_blank" href="https://www.forbes.com/sites/amymorin/2014/11/23/7-scientifically-proven-benefits-of-gratitude-that-will-motivate-you-to-give-thanks-year-round/#4463c9d0183c">Gratitude can improve your physical health</a>, mental strength, self-esteem, the quality of your sleep, and can even reduce your stress levels.</p>
<p>Another word that you should frequently use in your communication with your colleagues is <em>please</em>.</p>
<p>When you use the word <em>please</em>, you are reminding the other team member that he is not forced to do something, but it would be kind, generous, and helpful of him to assist with the task that you are working on.</p>
<p>These simple words, no matter how insignificant they may sound, can make a huge difference once you start using them.</p>
<h3 id="heading-5-praise-other-peoples-efforts-and-stay-positive"><strong>5. Praise other people’s efforts and stay positive</strong></h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/04/image-237.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Photo by Tyler Nix on Unsplash</em></p>
<p>Become aware of other people’s accomplishments and praise every improvement, large or small.</p>
<p><strong>Praising someone isn’t complicated. Common phrases like “Great job,” “Well done,” or “You did great” can be sufficient.</strong></p>
<p>It may have taken a lot of effort and strong willpower to get to the solution of a frustrating problem.</p>
<p>When you praise others on their accomplishments, you make them feel important and that they are involved in something that has grabbed your attention.</p>
<p>As software developers, we tend to forget about the privilege of the skills we possess.</p>
<p>There are times when a small bug or an urgent task can bother you or your colleague for a few moments, but you should not let that distract you from the big picture.</p>
<p>You should regularly remind yourself and your colleagues about the joyful moments that you and your team have been through, and not let an occasional difficulty or a stressful situation make you feel disappointed.</p>
<p>Start the habit of regularly recognizing the efforts of your teammates and giving credit to them whenever the opportunity arises.</p>
<h3 id="heading-6-do-not-hesitate-to-apologize"><strong>6. Do not hesitate to apologize</strong></h3>
<p>Nobody is perfect, and no matter how hard you try, you will always make a mistake here and there.</p>
<p>No matter how small your mistake is, do not hesitate to apologize about it.</p>
<p>Even though it might threaten your ego to apologize sometimes, it is a crucial way to keep good relationships with your colleagues.</p>
<p>Although you may think it will damage your reputation, by causing you to appear less confident, apologizing has the opposite effect.</p>
<p>It will remind others that you are aware of your shortcomings and that you are humble enough to admit to them.</p>
<p>Short phrases like “I am sorry” or “I apologize” can strengthen your ties with your colleagues, even during unpleasant moments.</p>
<h3 id="heading-7-do-not-criticize"><strong>7. Do not criticize</strong></h3>
<p>Criticizing is often perceived as a personal threat towards an individual’s ego, though you may not have intended to do that.</p>
<p>As a result, it is likely that they may get emotional and feel offended.</p>
<p>A better way of pointing out your colleague’s mistake is by giving them a <em>polite critique</em>: Call attention to people’s mistakes without demeaning them or making it personal.</p>
<p>Put yourself in their shoes and observe the issue from their perspective. Politely inform the other person about their mistake.</p>
<p>Do not point out a mistake in front of everybody; instead, do it privately.</p>
<p>If you want to inform everybody else about a mistake that they should not be doing, do not point fingers toward people, but toward the problem.</p>
<p>Try to focus on possible ways of solving the problem rather than on blame.</p>
<p><strong>Become the person who helps people, rather than someone who belittles them.</strong></p>
<p>When you help someone, you are going to feel your own sense of contributing and your own significance as well. Moreover, you can learn for yourself, and can also open doors to receiving help in future from the same colleagues that you have helped in the past.</p>
<h3 id="heading-8-avoid-arguments"><strong>8. Avoid arguments</strong></h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/04/image-238.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Photo by [Unsplash](https://unsplash.com/@jasonrosewell?utm_source=medium&amp;utm_medium=referral" rel="photo-creator noopener"&gt;Jason Rosewell on &lt;a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral" rel="photo-source noopener)</em></p>
<p>We tend to think of ourselves as rational human beings, but in reality, we are emotionally driven creatures that can easily get angry.</p>
<p>Those few moments of anger can lead to some unpleasant arguments, no matter whether you are right or wrong.</p>
<p>Although you may be right, and protecting your opinion sounds like a good idea, arguing furiously with others is something that can dramatically ruin your relationships.</p>
<p>As Dale Carnegie mentions in his book <a target="_blank" href="https://www.amazon.com/How-Win-Friends-Influence-People/dp/0671027034/ref=sr_1_1?ie=UTF8&amp;qid=1491286020&amp;sr=8-1"><em>How to Win Friends and Influence People</em></a>:</p>
<blockquote>
<p><em>“I have come to the conclusion that there is only one way under high heaven to get the best of an argument — and that is to avoid it. Avoid it as you would avoid rattlesnakes and earthquakes.”</em></p>
</blockquote>
<p>The best thing to do about arguments is to try your best to avoid them at all costs. It is not as easy as it sounds, but it can become easier with practice.</p>
<p>Reminding yourself that most of the time there is almost no benefit from arguing, especially with your work colleagues, can reinforce the desire to keep yourself away from arguments.</p>
<h3 id="heading-9-ask-questions-instead-of-giving-direct-orders"><strong>9. Ask questions instead of giving direct orders</strong></h3>
<p>This is something that is more relevant to team leaders or managers, but it can apply to anyone else as well.</p>
<p>People tend to be more inspired to work when they are challenged to do something, rather than ordered around.</p>
<p>When you command someone to do something, their ego may come out and make the individual think that he is being oppressed or that his autonomy is being threatened.</p>
<p>Rather than giving a direct order, ask whether a colleague would like to work on a particular task.</p>
<p>If there is no other available developer who can work on a particular task, and you are afraid that they may not like working on the front-end side, tell them you are worried that the team might look bad in front of the client if this feature is not present in the next meeting.</p>
<p>Questions like “<em>Would you mind working overtime and finishing off this task, knowing that this is critical for our project?”</em> are better than commands like <em>“You cannot go home unless you get this task done.”</em></p>
<p>Mention to them that they are an important part of the team, and they can help the team prove to the client that they are reliable for future projects as well, with questions such as, <em>“Could I possibly assign this task to you, knowing that you are already experienced with these types of work?”</em></p>
<h3 id="heading-10-avoid-dealing-with-toxic-people"><strong>10. Avoid dealing with ‘toxic’ people</strong></h3>
<p>Even though working as a software developer might be your dream job, there may nevertheless be toxic people at your workplace.</p>
<p>You thought you left those types of people behind at your high school, but it turns out that life is filled with so many of them.</p>
<p>These people are simply looking for opportunities to bring others down and may generally possess a negative perspective on everything in life.</p>
<p>You can try to change them with your well-intentioned influence, but often it is very difficult for a person to change (for a lot of reasons).</p>
<p>If you see that you are not having any positive influence, and associating with them is only causing you trouble, then you should avoid dealing with them.</p>
<p>You might be in a situation, however, where this person is your manager or a colleague in your office.</p>
<p>In these cases, your alternatives are very limited. You may consider changing your department, or start looking for a new job.</p>
<p>In cases when you do not have any other alternative but to deal with them, prepare yourself mentally ahead of time regarding their bad attitude, and tell yourself that you should not let them influence your mood and ruin your whole day.</p>
<p>Their attitude is not something that should surprise you.</p>
<p>Try to interact with them as little as possible.</p>
<h3 id="heading-conclusion"><strong>Conclusion</strong></h3>
<p>There is a lot more to the life of a software developer than just writing code. Dealing with people is one of the key factors.</p>
<p>Although they do not get mentioned or emphasized that much, social skills are among those few seemingly unimportant skills that can actually accelerate growth in your career.</p>
<p>And they are much simpler to understand and put into practice than inverting a binary tree on a whiteboard.</p>
<p>While I agree that some of these things are easier said than done, it is important to practice applying them in our lives.</p>
<p>Before you leave, let me kindly remind you about one more thing: <strong>Do not expect to always be able to apply these things all of the time</strong>.</p>
<p>We are human beings and we have our own difficult times, too.</p>
<p>However, we must not let those few moments of frustration and anger ruin our whole professional and non-professional lives.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Export a Database Table to CSV Using a Simple Ruby Script ]]>
                </title>
                <description>
                    <![CDATA[ If you have a Rails project and want to export a table as a CSV, without having to go to all the trouble of finding a gem, installing and using it, then uninstalling it when it’s no longer needed, I have some good news. Here’s an easy and quick way ]]>
                </description>
                <link>https://www.freecodecamp.org/news/export-a-database-table-to-csv-using-a-simple-ruby-script-2/</link>
                <guid isPermaLink="false">66d45ee7d1ffc3d3eb89dddf</guid>
                
                    <category>
                        <![CDATA[ Ruby ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Mon, 19 Aug 2019 05:28:00 +0000</pubDate>
                <media:content url="https://cdn-media-2.freecodecamp.org/w1280/5f9ca0cc740569d1a4ca4ada.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you have a Rails project and want to export a table as a CSV, without having to go to all the trouble of finding a gem, installing and using it, then uninstalling it when it’s no longer needed, I have some good news. Here’s an easy and quick way to export a particular table from your database as a CSV file.</p>
<p>This is the <a target="_blank" href="https://gist.github.com/foxumon/fdb30349545944eee58c7858e6bab23c">code</a> that you need to run. You can put it as a rake task and run it, or run it another way.</p>
<p>As you can see, first we import <code>CSV</code>— we need it to do the writing of the CSV file with the data from the database. We then choose the location and the name for the file that we want to export it to, which in our case will be a file called <em>data.csv</em> included under repository <em>public</em>.</p>
<p>Then we set the table that we want to export and start writing. We could also change the attributes that we want to export — we don’t have to include them all as they are in the database.</p>
<p>That’s it! It’s that simple and yet very helpful.</p>
<p><em>This article was originally published on</em> <a target="_blank" href="https://medium.com/better-programming/export-a-database-table-to-csv-using-a-simple-ruby-script-5577a0914eb0?source=friends_link&amp;sk=6debc0a92a8679247534b2e60a42f516"><em>Medium</em></a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How To Take Full-page Screenshots in Chrome Without Extensions ]]>
                </title>
                <description>
                    <![CDATA[ We spend a considerable portion of our time using a web browser. Sometimes we may need to get a screenshot of a full page in our browser. I recently learned that Google Chrome has the option to do that, without using any additional extensions. In thi... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-take-full-page-screenshots-in-chrome-without-extensions/</link>
                <guid isPermaLink="false">66d45ef933b83c4378a517d4</guid>
                
                    <category>
                        <![CDATA[ Google Chrome ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Productivity ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Fri, 16 Aug 2019 19:00:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2019/08/0_B52no-Sap8bi6AH5.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>We spend a considerable portion of our time using a web browser. Sometimes we may need to get a screenshot of a full page in our browser.</p>
<p>I recently learned that Google Chrome has the option to do that, without using any additional extensions. In this article, we will see how to do that.</p>
<h3 id="heading-open-devtools-inside-chrome">Open DevTools Inside Chrome</h3>
<p>First, we need to open <a target="_blank" href="https://developers.google.com/web/tools/chrome-devtools/">DevTools</a> inside Chrome. We can open it in different ways:</p>
<ol>
<li><p><em>Main Menu</em> (three vertical dots) in the top-right corner &gt; <em>More tools</em> &gt; <em>Developer tools.</em></p>
</li>
<li><p>We can also open it using the following keyboard shortcuts: <code>Control+Shift+I</code> in Windows and Linux, or <code>Command+Option+I</code> in Mac.</p>
</li>
<li><p>Another way to open it, is by right-clicking anywhere in the page and select <em>Inspect</em>.</p>
</li>
</ol>
<h3 id="heading-open-the-command-menu">Open the Command Menu</h3>
<p>Now we need to open the command menu. We can do that by pressing <code>Control+Shift+P</code> in Windows and Linux, or <code>Command+Shift+P</code> in Mac.</p>
<h3 id="heading-capture-screenshot">Capture Screenshot</h3>
<p>Then, we need to write and select <em>Capture full size screenshot</em>. After we have done that, we should get a PNG file as a screenshot for the full page.</p>
<p>That’s it for this quick tip. It’s really simple, but I think it can be very useful.</p>
<p><em>This article was originally</em> <a target="_blank" href="https://medium.com/better-programming/how-to-take-full-page-screenshots-in-chrome-without-extensions-be2f0cf36df1?source=friends_link&amp;sk=dac1c8b6d04c706bed5b366d44d00054"><em>published on Medium</em></a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Quickly Access the API Documentation of Your Favorite Languages ]]>
                </title>
                <description>
                    <![CDATA[ It’s no surprise that you may need to work with different programming languages, or at least use many methods. You may not be sure how to call a method, how many parameters it has, or what type of object is used for each parameter. During these cases... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/quickly-access-api-documentation-of-your-favorite-languages/</link>
                <guid isPermaLink="false">66d45f0738f2dc3808b79099</guid>
                
                    <category>
                        <![CDATA[ documentation ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Fri, 16 Aug 2019 14:51:27 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2019/08/dash-s1.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>It’s no surprise that you may need to work with different programming languages, or at least use many methods. You may not be sure how to call a method, how many parameters it has, or what type of object is used for each parameter. During these cases, having a quick way to search the API documentation helps immensely.</p>
<p>There are many ways to look up issues in the official API documentation for different languages. However, I have found two applications which are much easier than anything else I have tried. These tools can help you access the documentation with very few keystrokes.</p>
<h3 id="heading-installing-the-tools">Installing the Tools</h3>
<p><a target="_blank" href="http://t.dripemail2.com/c/eyJhY2NvdW50X2lkIjoiMzUyMjAyOCIsImRlbGl2ZXJ5X2lkIjoiODc5MDA5NTcwIiwidXJsIjoiaHR0cDovL2thcGVsaS5jb20vZGFzaD9fX3M9aDdhcHkyM3Y5ZWV3YThxbjF1aHUifQ">Dash</a> is suitable for Mac and <a target="_blank" href="http://t.dripemail2.com/c/eyJhY2NvdW50X2lkIjoiMzUyMjAyOCIsImRlbGl2ZXJ5X2lkIjoiODc5MDA5NTcwIiwidXJsIjoiaHR0cDovL3plYWxkb2NzLm9yZz9fX3M9aDdhcHkyM3Y5ZWV3YThxbjF1aHUifQ">Zeal</a> can be used for any other operating system of your choice.</p>
<p>Once you have downloaded them, the first thing you need to do is grab the documentation for the language that you will be using. For example, you may download Java, Ruby, JavaScript, or even frameworks like jQuery, Ruby on Rails, etc.</p>
<p>Then, you can set up shortcut keys on your keyboard that can help you search anything quickly with only a few keystrokes.</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>Now, when you are having dilemmas about a particular method or functionality that you are about to use, you can quickly refer to the documentation that you have downloaded on your computer.</p>
<p>There may be some cases when something may be missing from these doc sets, but in most cases, they are very helpful.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Here are Hello World app examples for every major programming language - all in one GitHub repository ]]>
                </title>
                <description>
                    <![CDATA[ One of the first things that you are instructed to do when you start to learn to program, or when you are simply learning a new programming language, is doing something really simple. One of the first steps that you do is print a simple text. As you ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/a-repository-with-the-example-of-printing-hello-world-in-a-lot-of-programming-languages/</link>
                <guid isPermaLink="false">66d45edd706b9fb1c166b930</guid>
                
                    <category>
                        <![CDATA[ GitHub ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Thu, 15 Aug 2019 13:00:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2019/08/0_4ty0Adbdg4dsVBo3.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>One of the first things that you are instructed to do when you start to learn to program, or when you are simply learning a new programming language, is doing something really simple. One of the first steps that you do is print a simple text. As you are reading this, you probably may know which text is the most common and the one that I am referring to.</p>
<p>The text that I am talking about is <em>Hello World.</em></p>
<p>This text is supposed to be for you as a way of greeting the world as you have just embarked on an important journey. A journey of learning as much as possible.</p>
<p>A GitHub <a target="_blank" href="https://github.com/Omkar-Ajnadkar/Hello-World">repository</a> has already been prepared with taking examples from as many programming languages and putting them in a commonplace so that other people can see how this same procedure is done in different programming languages.</p>
<p>This simple task implemented in Java, JavaScript, Python, Ruby, C++ and many other languages is already in there. Until now, this repository has taken a lot of contributions, to a lot of programming languages, even in many of which you and I may have never heard of before.</p>
<p>It is open-source and you can also <a target="_blank" href="https://github.com/Omkar-Ajnadkar/Hello-World">contribute</a> to it if you know any other programming language that is not listed in there.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to get easy-to-read JSON trees with this free Chrome Extension (or Firefox Plugin) ]]>
                </title>
                <description>
                    <![CDATA[ JSON is a very popular file format. Sometimes we may have a JSON object inside a browser tab that we need to read and this can be difficult. We may need to go and search for an online tool that turns it into an easy-to-read format so we can understan... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/untitleeasy-to-read-json-with-this-chrome-firefox-extensiond/</link>
                <guid isPermaLink="false">66d45f0b182810487e0ce194</guid>
                
                    <category>
                        <![CDATA[ chrome extension ]]>
                    </category>
                
                    <category>
                        <![CDATA[ json ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Wed, 14 Aug 2019 11:29:54 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2019/08/0_9FUbCPtz2dGrBmIi.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p><a target="_blank" href="https://www.json.org/">JSON</a> is a very popular file format. Sometimes we may have a JSON object inside a browser tab that we need to read and this can be difficult.</p>
<p>We may need to go and search for an online tool that turns it into an easy-to-read format so we can understand it.</p>
<p>Now, here is a Chrome and Firefox extension that does the formatting and makes your JSONs instantly pretty inside your browser, without having to perform many unnecessary steps.</p>
<p>It comes with support for JSON and JSONP and highlights the syntax so that you can differentiate different attributes and values accordingly. It also comes with the option to collapse nodes, clickable URLs that you can open in new tabs, and you see the raw, unformatted JSON.</p>
<p>It works with any JSON page, regardless of the URL you opened. It also works with local files, after you enable it in <code>chrome://extensions</code>. You can inspect the JSON by typing <code>json</code> into the console.</p>
<p>You can install the extension by going <a target="_blank" href="https://chrome.google.com/webstore/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa?hl=en">here for Chrome</a> and <a target="_blank" href="https://addons.mozilla.org/en-US/firefox/addon/basic-json-formatter/">here for Firefox</a> and then test it, for example, by visiting this <a target="_blank" href="https://efa.mvv-muenchen.de/ng/XSLT_DM_REQUEST?outputFormat=JSON&amp;language=en&amp;stateless=1&amp;coordOutputFormat=MRCV&amp;useRealtime=1&amp;zope_command=enquiry&amp;type_dm=stop&amp;name_dm=Zugspitzstra%C3%9Fe&amp;itOptionsActive=1&amp;ptOptionsActive=1&amp;mergeDep=1&amp;useAllStops=1&amp;mode=direct&amp;anyMaxSizeHitList=10000&amp;useAllStops=1">API response</a>.</p>
<p>This is what it looks like, before formatting:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/image-134.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Now, take a look at the beautiful JSON response you get with <a target="_blank" href="https://github.com/callumlocke/json-formatter">JSON Formatter</a>:</p>
<p><img src="https://cdn-images-1.medium.com/max/1600/1*c_9u3i-WVKnhGZsd5UZ6Rw.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/08/image-135.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Here is a pro tip: Hold down CTRL (or CMD on Mac) while collapsing a tree, if you want to collapse all its siblings too.</p>
<p>It is an open-source project, so you can view its <a target="_blank" href="https://github.com/callumlocke/json-formatter">source code on GitHub</a>.</p>
<p>Thanks for reading.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to create database schemas quickly and intuitively with DBDesigner ]]>
                </title>
                <description>
                    <![CDATA[ One of the most important parts of developing a project is having a clear picture in mind of the end goal. We need to know the target audience for the project, as well as the features it will include. This means that we need to be as informed as poss... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-create-database-schemas-quickly-and-intuitively-with-dbdesigner-2f4adf79a29d/</link>
                <guid isPermaLink="false">66d45ef247a8245f78752a3e</guid>
                
                    <category>
                        <![CDATA[ coding ]]>
                    </category>
                
                    <category>
                        <![CDATA[ database ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Mon, 06 Aug 2018 16:30:54 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*6Y5Szhl_pNIkjhu0Uo3rEw.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>One of the most important parts of developing a project is having a clear picture in mind of the end goal. We need to know the target audience for the project, as well as the features it will include. This means that we need to be as informed as possible about the business logic, and then implement all the features as needed.</p>
<p><a target="_blank" href="http://dbdesigner.net/">DBDesigner</a> is a great tool when it comes to creating database schemas for your application. It allows you to create any number of tables you want (as far as I am concerned). You can add any data type attribute you want to any table you have created. You can also have certain attributes serve as foreign keys. This way, when you set up primary keys and foreign keys respectively, you can see relations between tables of the database that you are trying to create.</p>
<p>You can use your email and create many projects, and get back to them whenever you want. You can also invite your colleagues via email and have them collaborate with you in the preparation of that schema.</p>
<p>When you have an initial version of your database schema, you can then export it as an SQL script for the following database technologies: PostgreSQL, SQLite, MySQL, MSSql, and Oracle.</p>
<h3 id="heading-demonstration"><strong>Demonstration</strong></h3>
<p>Let’s start by creating a new database schema to demonstrate how it works in practice.</p>
<p>We can either start with a new blank template, or use one from the many pre-existing templates that are available.</p>
<p>We will be demonstrating an empty template here, just so that we can see some of the features that are included. Otherwise, you may not notice them using existing templates.</p>
<p>First we need to create a new schema. Our example uses the “Generic” database type, and we will call it “library”.</p>
<p>So, we need to go to <em>Schema</em> &amp;g_t;_ New and then we will see a new window will pop up:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/dKGQLARUrZNYsvQzfxx65r0lfDNqFe2fTsiu" alt="Image" width="800" height="418" loading="lazy"></p>
<p>This is the image that we should see after that:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/3evdVmxCEoqv6npUjobnLH1v-1RJA7qTrIS5" alt="Image" width="800" height="507" loading="lazy"></p>
<p>Then we need to add new tables into our schema, which we can do by right clicking anywhere on the grid, and selecting the “Table” option:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/JdF6W8rIb5S1G6s0mItsmb0rRpBhRJaZIGIS" alt="Image" width="800" height="413" loading="lazy"></p>
<p>Now we need to add fields to the table. All we have to do is go to <em>Add field</em>, after which a new window will show up. In it you can choose the type, and also set up a few constraints to your new table column:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/SiFU1HH-YjlF8zl2LL3Bo-Lwo-LIqAzImh76" alt="Image" width="506" height="424" loading="lazy"></p>
<p>Here we can see how it looks like after we have added a few columns:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/8JJt351B9ZkdPyeWdRDBgf3rcykpCz1c8h9R" alt="Image" width="800" height="522" loading="lazy"></p>
<p>Then we can add relations between tables. We will take the example of creating a <em>many-to-many</em> relation between two tables: <em>Authors</em> and <em>Books.</em> For this, we initially need to create a new table called <em>AuthorBooks,</em> in which we add foreign keys that reference the <em>Authors</em> table and the <em>Books</em> table, respectively:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/9QbhYFaIoE9xEMDnINK5-MsqMlMP85NCEOAa" alt="Image" width="518" height="498" loading="lazy"></p>
<p>Here we have the connection with the <em>Books</em> table:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/RUzIA5zXMBg8rQufWIb43FIkfiBp8E0HR0H-" alt="Image" width="520" height="504" loading="lazy"></p>
<p>After we are done with that, we should see a schema similar to the following:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/kx7-qxvknuSAt85PbjOU37BP-XiHDSEe9vev" alt="Image" width="800" height="258" loading="lazy"></p>
<p>A really great feature of <em>dbdesigner</em> is the flexibility it gives you to move your tables around the grid as you wish:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/EstgpMYYjO7hwLR7ug5pwniVvUV54uif2KQn" alt="Image" width="800" height="505" loading="lazy"></p>
<p>We can also share the schema with up to five collaborators in the free version. We simply need to go to _Schema &gt; Sha_re and a new window will pop up, like the following:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/yMNJVmGA6UCGGRUGNFMlAKqxdtG97Vhcb9r1" alt="Image" width="800" height="577" loading="lazy"></p>
<p>We can save this schema as an image by going to: _Export &gt; Im_age.</p>
<p>We can also generate the corresponding SQL script the following way:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/pQz9K1zslWpL3MFBUwCqqmEpmOvU7MVMPEHZ" alt="Image" width="788" height="178" loading="lazy"></p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/lcpubCJYZNuusWp1YfBjkmUxu7dyMYviPN62" alt="Image" width="800" height="594" loading="lazy"></p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/ftc3d8sSxITbljXkA7z4gjJ2Tv-UcuhKkEb9" alt="Image" width="800" height="631" loading="lazy"></p>
<p>We can also import our own SQL into the schema and see it represented graphically:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/imO4ID01-K3ANkILlUQ-hSNHvIq9R9JYJueT" alt="Image" width="668" height="528" loading="lazy"></p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>I heard about this tool when I was doing a pair-programming with a colleague, and have found it really helpful. I hope you benefit from it as well.</p>
<p><a target="_blank" href="https://www.dbdesigner.net/designer/schema/187386">DBDesigner</a> has other features, and I would definitely recommend that you give them a try.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Free Tutorial Mega-List: How to Build Your Own Cryptocurrency, Operating System, Programming Language, and More ]]>
                </title>
                <description>
                    <![CDATA[ I recently stumbled upon a new GitHub repository that had a long list of tutorials about how to build many technologies. The list includes tutorials on how to Build your own Blockchain / Cryptocurrency, Web Server, Template Engine,_ and many more. I ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/free-tutorial-mega-list-how-to-build-your-own-cryptocurrency-operating-system-programming-d72593cfa75d/</link>
                <guid isPermaLink="false">66d45eeec7632f8bfbf1e430</guid>
                
                    <category>
                        <![CDATA[ Blockchain ]]>
                    </category>
                
                    <category>
                        <![CDATA[ GitHub ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Sun, 13 May 2018 18:34:46 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/0*gQTr9gKaNodOaDgi.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>I recently stumbled upon a new GitHub <a target="_blank" href="https://github.com/danistefanovic/build-your-own-x">repository</a> that had a long list of tutorials about how to build many technologies. The list includes tutorials on how to <strong>Build your own Blockchain / Cryptocurrency, Web Server, Template Engine,</strong>_ and many more.</p>
<p>I stumbled upon this repository while browsing through the most popular GitHub repositories in a new Chrome tab using <a target="_blank" href="http://www.fatosmorina.com/get-trending-github-projects-chrome-tab-githunt/">GitHunt</a>. It is a really long list, and may overwhelm you a bit, but this repository is worth checking out. You can always watch it and come back to it. Maybe you need to learn something better by building it, or perhaps you’ll find some tutorial you need.</p>
<p>Here is the <a target="_blank" href="https://github.com/danistefanovic/build-your-own-x">complete list</a> that has been added to GitHub and made public by the author <a target="_blank" href="https://www.freecodecamp.org/news/free-tutorial-mega-list-how-to-build-your-own-cryptocurrency-operating-system-programming-d72593cfa75d/undefined">Daniel Stefanovic</a> at the time of this writing.</p>
<p>Here, I’ll list/link to some of the articles from each category to give you an idea of what’s on offer:</p>
<h4 id="heading-build-your-own-3d-renderer"><strong>Build your own 3D Renderer</strong></h4>
<ul>
<li><p><a target="_blank" href="https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing/how-does-it-work">C++: <em>Introduction to Ray Tracing: a Simple Method for Creating 3D Images</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/ssloy/tinyrenderer/wiki">C++: <em>How OpenGL works: software rendering in 500 lines of code</em></a></p>
</li>
<li><p><a target="_blank" href="https://avik-das.github.io/build-your-own-raytracer/">Java + JavaScript: <em>Build your own 3D renderer</em></a></p>
</li>
<li><p><a target="_blank" href="http://blog.rogach.org/2015/08/how-to-create-your-own-simple-3d-render.html">Java: <em>How to create your own simple 3D render engine in pure Java</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-blockchain-cryptocurrency"><strong>Build your own Blockchain / Cryptocurrency</strong></h4>
<ul>
<li><p><a target="_blank" href="https://www.toptal.com/bitcoin/cryptocurrency-for-dummies-bitcoin-and-beyond">Cryptocurrency for Dummies: Bitcoin and Beyond</a></p>
</li>
<li><p><a target="_blank" href="https://beta.observablehq.com/@galletti94/functional-blockchain">ATS: <em>Functional Blockchain</em></a></p>
</li>
<li><p><a target="_blank" href="https://medium.freecodecamp.org/from-what-is-blockchain-to-building-a-blockchain-within-an-hour-4e738efc819d">Ethereum: <em>From “What is Blockchain?” to building a blockchain in less than an hour</em></a></p>
</li>
<li><p><a target="_blank" href="https://jeiwan.cc/posts/building-blockchain-in-go-part-1/">Go: <em>Building Blockchain in Go</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/adjoint-io/nanocoin">Haskell: <em>A simple cryptocurrency implementation, written to illustrate the basic components of a Proof-of-Work based public distributed ledger</em></a></p>
</li>
<li><p><a target="_blank" href="https://medium.com/programmers-blockchain/create-simple-blockchain-java-tutorial-from-scratch-6eeed3cb03fa">Java: <em>Creating Your First Blockchain with Java</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/conradoqg/naivecoin">JavaScript: <em>A cryptocurrency implementation in less than 1500 lines of code</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/nambrot/blockchain-in-js">JavaScript: <em>Build your own Blockchain in Javascript</em></a></p>
</li>
<li><p><a target="_blank" href="https://medium.com/digital-alchemy-holdings/learn-build-a-javascript-blockchain-part-1-ca61c285821e">JavaScript: <em>Learn &amp; Build a Javascript Blockchain</em></a></p>
</li>
<li><p><a target="_blank" href="https://hackernoon.com/learn-blockchains-by-building-one-117428612f46">Python: <em>Learn Blockchains by Building One</em></a></p>
</li>
<li><p><a target="_blank" href="http://ecomunsing.com/build-your-own-blockchain">Python: <em>Build your own blockchain: a Python tutorial</em></a></p>
</li>
<li><p><a target="_blank" href="https://lhartikk.github.io/">TypeScript: <em>Naivecoin: a tutorial for building a cryptocurrency</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-bot"><strong>Build your own Bot</strong></h4>
<ul>
<li><p><a target="_blank" href="https://wiki.haskell.org/Roll_your_own_IRC_bot">Haskell: <em>Roll your own IRC bot</em></a></p>
</li>
<li><p><a target="_blank" href="https://tutorials.botsfloor.com/creating-a-simple-facebook-messenger-ai-bot-with-api-ai-in-node-js-50ae2fa5c80d">Node.js: <em>Creating a Simple Facebook Messenger AI Bot with API.ai in Node.js</em></a></p>
</li>
<li><p><a target="_blank" href="https://medium.freecodecamp.org/easily-set-up-your-own-twitter-bot-4aeed5e61f7f">Node.js: <em>Why you should have your own Twitter bot, and how to build one in less than 30 minutes</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.sohamkamani.com/blog/2016/09/21/making-a-telegram-bot/">Node.js: <em>How to make a responsive telegram bot</em></a></p>
</li>
<li><p><a target="_blank" href="https://discordjs.guide/">Node.js: <em>Create a Discord bot</em></a></p>
</li>
<li><p><a target="_blank" href="https://medium.com/@joeldg/an-advanced-tutorial-a-new-crypto-currency-trading-bot-boilerplate-framework-e777733607ae">PHP: <em>Let’s write a cryptocurrency bot</em></a></p>
</li>
<li><p><a target="_blank" href="https://blog.hartleybrody.com/fb-messenger-bot/">Python: <em>Step-by-Step Instructions for Building a Basic Facebook Chat Bot</em></a></p>
</li>
<li><p><a target="_blank" href="http://pythonforengineers.com/build-a-reddit-bot-part-1/">Python: <em>Build a Reddit Bot</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/watch?v=krTUf7BpTc0">Python: <em>How To Make A reddit Bot</em></a></p>
</li>
<li><p><a target="_blank" href="https://khashtamov.com/en/how-to-create-a-telegram-bot-using-python/">Python: <em>How To Create a Telegram Bot Using Python</em></a></p>
</li>
<li><p><a target="_blank" href="https://medium.freecodecamp.org/creating-a-twitter-bot-in-python-with-tweepy-ac524157a607">Python: <em>Create a Twitter Bot in Python Using Tweepy</em></a></p>
</li>
<li><p><a target="_blank" href="https://towardsdatascience.com/build-a-cryptocurrency-trading-bot-with-r-1445c429e1b1">R: <em>Build A Cryptocurrency Trading Bot with R</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-database"><strong>Build your own Database</strong></h4>
<ul>
<li><p><a target="_blank" href="https://cstack.github.io/db_tutorial/">C: <em>Let’s Build a Simple Database</em></a></p>
</li>
<li><p><a target="_blank" href="http://codecapsule.com/2012/11/07/ikvs-implementing-a-key-value-store-table-of-contents/">C++: <em>Implementing a Key-Value Store</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.codeproject.com/Articles/1029838/Build-Your-Own-Database">C#: <em>Build Your Own Database</em></a></p>
</li>
<li><p><a target="_blank" href="http://aosabook.org/en/500L/an-archaeology-inspired-database.html">Clojure: <em>An Archaeology-Inspired Database</em></a></p>
</li>
<li><p><a target="_blank" href="http://aosabook.org/en/500L/dagoba-an-in-memory-graph-database.html">JavaScript: <em>Dagoba: an in-memory graph database</em></a></p>
</li>
<li><p><a target="_blank" href="http://aosabook.org/en/500L/dbdb-dog-bed-database.html">Python: <em>DBDB: Dog Bed Database</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-front-end-framework-library"><strong>Build your own Front-end Framework / Library</strong></h4>
<ul>
<li><p><a target="_blank" href="https://github.com/hexacta/didact">JavaScript: <em>A DIY guide to build your own React</em></a></p>
</li>
<li><p><a target="_blank" href="https://vimeo.com/album/3930691">JavaScript: <em>Reverse Engineering React</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/watch?v=_MAD4Oly9yg">JavaScript: <em>Building React From Scratch</em></a></p>
</li>
<li><p><a target="_blank" href="https://blog.javascripting.com/2016/10/05/building-your-own-react-clone-in-five-easy-steps/">JavaScript: <em>Building Your Own React Clone in Five Easy Steps</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/jsrebuild/build-your-own-vuejs">JavaScript: <em>Build your own Vuejs</em></a></p>
</li>
<li><p><a target="_blank" href="https://zapier.com/engineering/how-to-build-redux/">JavaScript: <em>Build Yourself a Redux</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.jamasoftware.com/blog/lets-write-redux/">JavaScript: <em>Let’s Write Redux!</em></a></p>
</li>
<li><p><a target="_blank" href="https://egghead.io/lessons/react-redux-implementing-store-from-scratch">JavaScript: <em>Redux: Implementing Store from Scratch</em></a></p>
</li>
<li><p><a target="_blank" href="https://blog.mgechev.com/2015/03/09/build-learn-your-own-light-lightweight-angularjs/">JavaScript: <em>Build Your own Simplified AngularJS in 200 Lines of JavaScript</em></a></p>
</li>
<li><p><a target="_blank" href="https://medium.com/@deathmood/how-to-write-your-own-virtual-dom-ee74acc13060">JavaScript: <em>How to write your own Virtual DOM</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-docker"><strong>Build your own Docker</strong></h4>
<ul>
<li><p><a target="_blank" href="https://blog.lizzie.io/linux-containers-in-500-loc.html">C: <em>Linux containers in 500 lines of code</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/watch?v=Utf-A4rODH8">Go: <em>Building a container from scratch in Go</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/Fewbytes/rubber-docker">Python: <em>A workshop on Linux containers: Rebuild Docker from Scratch</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/tonybaloney/mocker">Python: <em>A proof-of-concept imitation of Docker, written in 100% Python</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/p8952/bocker">Shell: <em>Docker implemented in around 100 lines of bash</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-game"><strong>Build your own Game</strong></h4>
<ul>
<li><p><a target="_blank" href="https://handmadehero.org/">C: <em>Handmade Hero</em></a></p>
</li>
<li><p><a target="_blank" href="https://nesdoug.com/">C: <em>How to Program an NES game in C</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/playlist?list=PLZ1QII7yudbc-Ky058TEaOstZHVbT-2hg">C: <em>Chess Engine In C</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/playlist?list=PLSkJey49cOgTSj465v2KbLZ7LMn10bCF9">C: <em>Let’s Make: Dangerous Dave</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/playlist?list=PLT6WFYYZE6uLMcPGS3qfpYm7T_gViYMMt">C: <em>Learn Video Game Programming in C</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/playlist?list=PLkTXsX7igf8edTYU92nU-f5Ntzuf-RKvW">C: <em>Coding A Sudoku Solver in C</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/playlist?list=PLkTXsX7igf8erbWGYT4iSAhpnJLJ0Nk5G">C: <em>Coding a Rogue/Nethack RPG in C</em></a></p>
</li>
<li><p><a target="_blank" href="https://dashgl.com/">C: <em>Tutorial For a Brickout Clone</em></a></p>
</li>
<li><p><a target="_blank" href="https://dashgl.com/Invaders/">C: <em>A tutorials for a basic Invaders game made in C with GTK: and OpenGL</em></a></p>
</li>
<li><p><a target="_blank" href="https://dashgl.com/Astroids/">C: <em>Astroids Tutorial written in C using GTK with OpenGL and DashGL for matrix manipulation</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/playlist?list=PLMZ_9w2XRxiZq1vfw1lrpCMRDufe2MKV_">C++: <em>How To Make Minecraft in C++/ OpenGL</em></a></p>
</li>
<li><p><a target="_blank" href="https://learnopengl.com/In-Practice/2D-Game/Breakout">C++: <em>Breakout</em></a></p>
</li>
<li><p><a target="_blank" href="http://lazyfoo.net/tutorials/SDL/">C++: <em>Beginning Game Programming v2.0</em></a></p>
</li>
<li><p><a target="_blank" href="http://scottlilly.com/learn-c-by-building-a-simple-rpg-index/">C#: <em>Learn C# by Building a Simple RPG</em></a></p>
</li>
<li><p><a target="_blank" href="https://roguesharp.wordpress.com/">C#: <em>Creating a Roguelike Game in C#</em></a></p>
</li>
<li><p><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_breakout_game_Phaser">JavaScript: <em>2D breakout game using Phaser</em></a></p>
</li>
<li><p><a target="_blank" href="http://www.lessmilk.com/tutorial/flappy-bird-phaser-1">JavaScript: <em>How to Make Flappy Bird in HTML5 With Phaser</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/SSYGEN/blog/issues/30">Lua: <em>BYTEPATH</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/thoughtbot/write-yourself-a-roguelike">Ruby: <em>Write Yourself a Roguelike</em></a></p>
</li>
<li><p><a target="_blank" href="https://leanpub.com/developing-games-with-ruby/read">Ruby: <em>Developing Games With Ruby</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-git"><strong>Build your own Git</strong></h4>
<ul>
<li><p><a target="_blank" href="http://gitlet.maryrosecook.com/docs/gitlet.html">JavaScript: <em>Gitlet</em></a></p>
</li>
<li><p><a target="_blank" href="https://kushagragour.in/blog/2014/01/build-git-learn-git/">JavaScript: <em>Build GIT — Learn GIT</em></a></p>
</li>
<li><p><a target="_blank" href="https://benhoyt.com/writings/pygit/">Python: <em>Just enough of a Git client to create a repo, commit, and push itself to GitHub</em></a></p>
</li>
<li><p><a target="_blank" href="https://robots.thoughtbot.com/rebuilding-git-in-ruby">Ruby: <em>Rebuilding Git in Ruby</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-neural-network"><strong>Build your own Neural Network</strong></h4>
<ul>
<li><p><a target="_blank" href="https://www.codeproject.com/Articles/11285/Neural-Network-OCR">C#: <em>Neural Network OCR</em></a></p>
</li>
<li><p><a target="_blank" href="https://made2591.github.io/posts/neuralnetwork">Go: <em>Build a multilayer perceptron with Golang</em></a></p>
</li>
<li><p><a target="_blank" href="https://sausheong.github.io/posts/how-to-build-a-simple-artificial-neural-network-with-go/">Go: <em>How to build a simple artificial neural network with Go</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.datadan.io/building-a-neural-net-from-scratch-in-go/">Go: <em>Building a Neural Net from Scratch in Go</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/watch?v=ntKn5TPHHAk&amp;feature=youtu.be">Java: <em>Neural Networks: Perceptron</em></a></p>
</li>
<li><p><a target="_blank" href="https://franpapers.com/en/machine-learning-ai-en/2017-neural-network-implementation-in-javascript-by-an-example/">JavaScript: <em>Neural Network implementation in Javascript, by an example</em></a></p>
</li>
<li><p><a target="_blank" href="https://hackernoon.com/neural-networks-from-scratch-for-javascript-linguists-part1-the-perceptron-632a4d1fbad2">JavaScript: <em>Neural networks from scratch for Javascript linguists (Part1 — The Perceptron)</em></a></p>
</li>
<li><p><a target="_blank" href="https://itnext.io/you-can-build-a-neural-network-in-javascript-even-if-you-dont-really-understand-neural-networks-e63e12713a3">JavaScript: <em>You can build a neural network in JavaScript even if you don’t really understand neural networks</em></a></p>
</li>
<li><p><a target="_blank" href="https://medium.freecodecamp.org/how-to-create-a-neural-network-in-javascript-in-only-30-lines-of-code-343dafc50d49">JavaScript: <em>How to create a Neural Network in JavaScript in only 30 lines of code</em></a></p>
</li>
<li><p><a target="_blank" href="http://aosabook.org/en/500L/optical-character-recognition-ocr.html">Python: <em>Optical Character Recognition (OCR)</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-network-stack"><strong>Build your own Network Stack</strong></h4>
<ul>
<li><p><a target="_blank" href="http://beej.us/guide/bgnet/html/multi/index.html">C: <em>Beej’s Guide to Network Programming</em></a></p>
</li>
<li><p><a target="_blank" href="http://www.saminiir.com/lets-code-tcp-ip-stack-1-ethernet-arp/">C: <em>Let’s code a TCP/IP stack</em></a></p>
</li>
<li><p><a target="_blank" href="https://medium.com/geckoboard-under-the-hood/how-to-build-a-network-stack-in-ruby-f73aeb1b661b">Ruby: <em>How to build a network stack in Ruby</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-operating-system"><strong>Build your own Operating System</strong></h4>
<ul>
<li><p><a target="_blank" href="http://joebergeron.io/posts/post_two.html">Assembly: <em>Writing a Tiny x86 Bootloader</em></a></p>
</li>
<li><p><a target="_blank" href="https://tuhdo.github.io/os01/">C: <em>Operating Systems: From 0 to 1</em></a></p>
</li>
<li><p><a target="_blank" href="https://littleosbook.github.io/">C: <em>The little book about OS development</em></a></p>
</li>
<li><p><a target="_blank" href="https://arjunsreedharan.org/post/82710718100/kernel-101-lets-write-a-kernel">C: <em>Kernel 101 –Let’s write a Kernel</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/jserv/mini-arm-os">C: <em>Build a minimal multi-tasking kernel for ARM from scratch</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/cfenollosa/os-tutorial">C: <em>How to create an OS from scratch</em></a></p>
</li>
<li><p><a target="_blank" href="https://danluu.com/malloc-tutorial/">C: <em>Malloc tutorial</em></a></p>
</li>
<li><p><a target="_blank" href="https://blog.holbertonschool.com/hack-the-virtual-memory-c-strings-proc/">C: <em>Hack the virtual memory</em></a></p>
</li>
<li><p><a target="_blank" href="http://3zanders.co.uk/2017/10/13/writing-a-bootloader/">C++: <em>Writing a Bootloader</em></a></p>
</li>
<li><p><a target="_blank" href="https://os.phil-opp.com/first-edition/">Rust: <em>Writing an OS in Rust</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-programming-language"><strong>Build your own Programming Language</strong></h4>
<ul>
<li><p><a target="_blank" href="http://www.craftinginterpreters.com/">C: <em>Crafting interpreters: A handbook for making programming languages</em></a></p>
</li>
<li><p><a target="_blank" href="http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/">C: <em>Baby’s First Garbage Collector</em></a></p>
</li>
<li><p><a target="_blank" href="http://www.buildyourownlisp.com/">C: <em>Build Your Own Lisp: Learn C and build your own programming language in 1000 lines of code</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.slideshare.net/jserv/jit-compiler">C: <em>Implement a minimal interpreter, Compiler (x86/Arm) and JIT compiler from scratch</em></a></p>
</li>
<li><p><a target="_blank" href="http://maplant.com/gc.html">C: <em>Writing a Simple Garbage Collector in C</em></a></p>
</li>
<li><p><a target="_blank" href="https://gnuu.org/2009/09/18/writing-your-own-toy-compiler/">C++: <em>Writing Your Own Toy Compiler Using Flex</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/watch?v=HxaD_trXwRE">Go: <em>Lexical Scanning in Go</em></a></p>
</li>
<li><p><a target="_blank" href="http://alephnullplex.github.io/cradle/">Haskell: <em>Let’s Build a Compiler</em></a></p>
</li>
<li><p><a target="_blank" href="http://dev.stephendiehl.com/fun/">Haskell: <em>Write You a Haskell</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/jamiebuilds/the-super-tiny-compiler">JavaScript: <em>The Super Tiny Compiler</em></a></p>
</li>
<li><p><a target="_blank" href="https://norasandler.com/2017/11/29/Write-a-Compiler.html">OCaml: <em>Writing a C Compiler</em></a></p>
</li>
<li><p><a target="_blank" href="https://beautifulracket.com/">Racket: <em>Beautiful Racket: How to make your own programming languages with Racket</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.destroyallsoftware.com/screencasts/catalog/a-compiler-from-scratch">Ruby: <em>A Compiler From Scratch</em></a></p>
</li>
<li><p><a target="_blank" href="http://aosabook.org/en/500L/a-python-interpreter-written-in-python.html">Python: <em>A Python Interpreter Written in Python</em></a></p>
</li>
<li><p><a target="_blank" href="http://khamidou.com/compilers/lisp.py/">Python: <em>lisp.py: Make your own Lisp interpreter</em></a></p>
</li>
<li><p><a target="_blank" href="http://effbot.org/zone/simple-iterator-parser.htm">Python: <em>Simple Iterator-based Parsing</em></a></p>
</li>
<li><p><a target="_blank" href="http://effbot.org/zone/simple-top-down-parsing.htm">Python: <em>Simple Top-Down Parsing in Python</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-regex-engine"><strong>Build your own Regex Engine</strong></h4>
<ul>
<li><p><a target="_blank" href="https://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html">C: <em>A Regular Expression Matcher</em></a></p>
</li>
<li><p><a target="_blank" href="https://swtch.com/~rsc/regexp/regexp1.html">C: <em>Regular Expression Matching Can Be Simple And Fast</em></a></p>
</li>
<li><p><a target="_blank" href="https://nickdrane.com/build-your-own-regex/">JavaScript: <em>Build a Regex Engine in Less than 40 Lines of Code</em></a></p>
</li>
<li><p><a target="_blank" href="https://perl.plover.com/Regex/article.html">Perl: <em>How Regexes Work</em></a></p>
</li>
<li><p><a target="_blank" href="https://rcoh.svbtle.com/no-magic-regular-expressions">Scala: <em>No Magic: Regular Expressions</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-shell"><strong>Build your own Shell</strong></h4>
<ul>
<li><p><a target="_blank" href="https://brennan.io/2015/01/16/write-a-shell-in-c/">C: <em>Tutorial — Write a Shell in C</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/kamalmarhubi/shell-workshop">C: <em>Let’s build a shell!</em></a></p>
</li>
<li><p><a target="_blank" href="https://indradhanush.github.io/blog/writing-a-unix-shell-part-1/">C: <em>Writing a UNIX Shell — Part I</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.jstorimer.com/blogs/workingwithcode/7766107-a-unix-shell-in-ruby">Ruby: <em>A Unix Shell in Ruby</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-template-engine"><strong>Build your own Template Engine</strong></h4>
<ul>
<li><p><a target="_blank" href="http://krasimirtsonev.com/blog/article/Javascript-template-engine-in-just-20-line">JavaScript: <em>JavaScript template engine in just 20 lines</em></a></p>
</li>
<li><p><a target="_blank" href="http://alexmic.net/building-a-template-engine/">Python: <em>Approach: Building a toy template engine in Python</em></a></p>
</li>
<li><p><a target="_blank" href="http://aosabook.org/en/500L/a-template-engine.html">Python: <em>A Template Engine</em></a></p>
</li>
<li><p><a target="_blank" href="http://bits.citrusbyte.com/how-to-write-a-template-library/">Ruby: <em>How to write a template engine in less than 30 lines of code</em></a></p>
</li>
</ul>
<h4 id="heading-build-your-own-web-server"><strong>Build your own Web Server</strong></h4>
<ul>
<li><p><a target="_blank" href="https://www.codeproject.com/Articles/859108/Writing-a-Web-Server-from-Scratch">C#: <em>Writing a Web Server from Scratch</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.codementor.io/ziad-saab/let-s-code-a-web-server-from-scratch-with-nodejs-streams-h4uc9utji">Node.js: <em>Let’s code a web server from scratch with NodeJS Streams</em></a></p>
</li>
<li><p><a target="_blank" href="http://station.clancats.com/writing-a-webserver-in-pure-php/">PHP: <em>Writing a webserver in pure PHP</em></a></p>
</li>
<li><p><a target="_blank" href="http://aosabook.org/en/500L/a-simple-web-server.html">Python: <em>A Simple Web Server</em></a></p>
</li>
<li><p><a target="_blank" href="https://ruslanspivak.com/lsbaws-part1/">Python: <em>Let’s Build A Web Server.</em></a></p>
</li>
<li><p><a target="_blank" href="https://defn.io/2018/02/25/web-app-from-scratch-01/">Python: <em>Web application from scratch</em></a></p>
</li>
<li><p><a target="_blank" href="http://joaoventura.net/blog/2017/python-webserver/">Python: <em>Building a basic HTTP Server from scratch in Python</em></a></p>
</li>
<li><p><a target="_blank" href="http://blog.honeybadger.io/building-a-simple-websockets-server-from-scratch-in-ruby/">Ruby: <em>Building a simple websockets server from scratch in Ruby</em></a></p>
</li>
</ul>
<h4 id="heading-uncategorized"><strong>Uncategorized</strong></h4>
<ul>
<li><p><a target="_blank" href="http://aosabook.org/en/500L/the-same-origin-policy.html">Alloy: <em>The Same-Origin Policy</em></a></p>
</li>
<li><p><a target="_blank" href="https://viewsourcecode.org/snaptoken/kilo/">C: <em>Build Your Own Text Editor</em></a></p>
</li>
<li><p><a target="_blank" href="http://dranger.com/ffmpeg/ffmpeg.html">C: <em>How to Write a Video Player in Less Than 1000 Lines</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/jamesroutley/write-a-hash-table">C: <em>Learn how to write a hash table in C</em></a></p>
</li>
<li><p><a target="_blank" href="http://www.code-in-c.com/writing-svg-library-c/">C: <em>Writing an SVG Library</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/relativty/Relativ">C++: <em>Build your own VR headset for $100</em></a></p>
</li>
<li><p><a target="_blank" href="http://www.multigesture.net/articles/how-to-write-an-emulator-chip-8-interpreter/">C++: <em>How to write an emulator (CHIP-8 interpreter)</em></a></p>
</li>
<li><p><a target="_blank" href="https://blog.tartanllama.xyz/writing-a-linux-debugger-setup/">C++: <em>Writing a Linux Debugger</em></a></p>
</li>
<li><p><a target="_blank" href="http://www.lofibucket.com/articles/64k_intro.html">C++: <em>How a 64k intro is made</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.sohamkamani.com/blog/2017/09/13/how-to-build-a-web-application-in-golang/">Go: <em>Build a web application in Go</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.youtube.com/watch?v=dhWL4DC7Krs">Java: <em>Build a Flashlight App</em></a></p>
</li>
<li><p><a target="_blank" href="https://levelup.gitconnected.com/understand-javascript-promises-by-building-a-promise-from-scratch-84c0fd855720">JavaScript: <em>Learn JavaScript Promises by Building a Promise from Scratch</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.pyimagesearch.com/2014/09/01/build-kick-ass-mobile-document-scanner-just-5-minutes/">Python: <em>How to Build a Kick-Ass Mobile Document Scanner in Just 5 Minutes</em></a></p>
</li>
<li><p><a target="_blank" href="http://aosabook.org/en/500L/a-continuous-integration-system.html">Python: <em>Continuous Integration System</em></a></p>
</li>
<li><p><a target="_blank" href="https://hackernoon.com/building-a-facial-recognition-pipeline-with-deep-learning-in-tensorflow-66e7645015b8">Python: <em>Building a Facial Recognition Pipeline with Deep Learning in Tensorflow</em></a></p>
</li>
<li><p><a target="_blank" href="https://www.datacamp.com/community/tutorials/recommender-systems-python">Python: <em>Recommender Systems in Python: Beginner Tutorial</em></a></p>
</li>
<li><p><a target="_blank" href="http://aosabook.org/en/500L/a-pedometer-in-the-real-world.html">Ruby: <em>A Pedometer in the Real World</em></a></p>
</li>
<li><p><a target="_blank" href="https://limpet.net/mbrubeck/2014/08/08/toy-layout-engine-1.html">Rust: <em>Let’s build a browser engine</em></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/EmilHernvall/dnsguide/blob/master/README.md">Rust: <em>Building a DNS server in Rust</em></a></p>
</li>
</ul>
<p>I hope you find this <a target="_blank" href="https://github.com/danistefanovic/build-your-own-x">repository</a> helpful. I certainly did. You can contribute to the complete list on <a target="_blank" href="https://github.com/danistefanovic/build-your-own-x">GitHub</a>.</p>
<p>Happy learning!</p>
<p><em>This post was originally published on</em> <a target="_blank" href="https://medium.com/@FatosMorina/85-free-udacity-nanodegree-courses-16310e6cc29e"><em>Medium</em></a><em>.</em></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Set up your macOS development environment using Thoughtbot’s Laptop script ]]>
                </title>
                <description>
                    <![CDATA[ One of the things that may prevent us from changing or even thinking of changing our working environment is the necessity to do all the installations and the configurations that we have already set up for software development. Fortunately, there is a... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/set-up-your-macos-development-environment-using-thoughtbots-laptop-script-e6bf9b2e03dd/</link>
                <guid isPermaLink="false">66d45f09d1ffc3d3eb89ddf1</guid>
                
                    <category>
                        <![CDATA[ education ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ startup ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Thu, 08 Feb 2018 15:12:22 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*cNXpArTQUERq8nbe9nllqw.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>One of the things that may prevent us from changing or even thinking of changing our working environment is the necessity to do all the installations and the configurations that we have already set up for software development.</p>
<p>Fortunately, there is a cure for this <em>pain</em>. <em>Laptop</em> is a script that prepares your working macOS machine for web and mobile development.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/TYlh5-0uZtwVDI1AstOGORoIqEBT5OIAyYVM" alt="Image" width="800" height="671" loading="lazy"></p>
<p>The script setup is made up of:</p>
<ol>
<li>macOS tools:</li>
</ol>
<ul>
<li><a target="_blank" href="http://brew.sh/">Homebrew</a> for managing operating system libraries.</li>
</ul>
<ol start="2">
<li>Unix tools:</li>
</ol>
<ul>
<li><p><a target="_blank" href="http://ctags.sourceforge.net/">Exuberant Ctags</a> for indexing files for vim tab completion</p>
</li>
<li><p><a target="_blank" href="https://git-scm.com/">Git</a> for version control</p>
</li>
<li><p><a target="_blank" href="https://www.openssl.org/">OpenSSL</a> for Transport Layer Security (TLS)</p>
</li>
<li><p><a target="_blank" href="https://github.com/thoughtbot/rcm">RCM</a> for managing company and personal dotfiles</p>
</li>
<li><p><a target="_blank" href="https://github.com/ggreer/the_silver_searcher">The Silver Searcher</a> for finding things in files</p>
</li>
<li><p><a target="_blank" href="http://tmux.github.io/">Tmux</a> for saving project state and switching between projects</p>
</li>
<li><p><a target="_blank" href="https://facebook.github.io/watchman/">Watchman</a> for watching for filesystem events</p>
</li>
<li><p><a target="_blank" href="http://www.zsh.org/">Zsh</a> as your shell</p>
</li>
</ul>
<ol start="3">
<li>Heroku tools:</li>
</ol>
<ul>
<li><a target="_blank" href="https://devcenter.heroku.com/articles/heroku-cli">Heroku CLI</a> and <a target="_blank" href="https://github.com/thoughtbot/parity">Parity</a> for interacting with the Heroku API</li>
</ul>
<ol start="4">
<li>GitHub tools:</li>
</ol>
<ul>
<li><a target="_blank" href="http://hub.github.com/">Hub</a> for interacting with the GitHub API</li>
</ul>
<ol start="5">
<li>Image tools:</li>
</ol>
<ul>
<li><a target="_blank" href="http://www.imagemagick.org/">ImageMagick</a> for cropping and resizing images</li>
</ul>
<ol start="6">
<li>Testing tools:</li>
</ol>
<ul>
<li><a target="_blank" href="http://qt-project.org/">Qt 5</a> for headless JavaScript testing via <a target="_blank" href="https://github.com/thoughtbot/capybara-webkit">Capybara Webkit</a></li>
</ul>
<ol start="7">
<li>Programming languages, package managers, and configuration:</li>
</ol>
<ul>
<li><p><a target="_blank" href="https://github.com/asdf-vm/asdf">ASDF</a> for managing programming language versions</p>
</li>
<li><p><a target="_blank" href="http://bundler.io/">Bundler</a> for managing Ruby libraries</p>
</li>
<li><p><a target="_blank" href="http://nodejs.org/">Node.js</a> and <a target="_blank" href="https://www.npmjs.org/">NPM</a>, for running apps and installing JavaScript packages</p>
</li>
<li><p><a target="_blank" href="https://www.ruby-lang.org/en/">Ruby</a> stable for writing general-purpose code</p>
</li>
<li><p><a target="_blank" href="https://yarnpkg.com/en/">Yarn</a> for managing JavaScript packages</p>
</li>
</ul>
<ol start="8">
<li>Databases:</li>
</ol>
<ul>
<li><p><a target="_blank" href="http://www.postgresql.org/">Postgres</a> for storing relational data</p>
</li>
<li><p><a target="_blank" href="http://redis.io/">Redis</a> for storing key-value data</p>
</li>
</ul>
<p>Its installation is pretty straightforward and can be done very quickly.</p>
<p>First, you need to download the script:</p>
<pre><code class="lang-python">curl --remote-name https://raw.githubusercontent.com/thoughtbot/laptop/master/mac
</code></pre>
<p>You should review the script before you run it:</p>
<pre><code class="lang-python">less mac
</code></pre>
<p>Then you can execute the downloaded script:</p>
<pre><code class="lang-python">sh mac <span class="hljs-number">2</span>&gt;&amp;<span class="hljs-number">1</span> | tee ~/laptop.log
</code></pre>
<p>Finally, you can review the log:</p>
<pre><code class="lang-python">less ~/laptop.log
</code></pre>
<p>It should take less than 15 minutes to install (depends on your machine).</p>
<p>macOS versions that are supported at the time of this writing are:</p>
<ul>
<li><p>macOS Mavericks (10.9)</p>
</li>
<li><p>macOS Yosemite (10.10)</p>
</li>
<li><p>macOS El Capitan (10.11)</p>
</li>
<li><p>macOS Sierra (10.12)</p>
</li>
</ul>
<p>According to the Laptop’s <a target="_blank" href="https://github.com/thoughtbot/laptop">description</a>, older versions of macOS may work but aren’t regularly tested.</p>
<p>Laptop is an open source project, initiated and maintained by <a target="_blank" href="https://thoughtbot.com/?utm_source=github">Thoughtbot</a>. You can view more information about it and its implementation and also have the opportunity to contribute to it by visiting its GitHub <a target="_blank" href="https://github.com/thoughtbot/laptop">page</a>.</p>
<p><em>This article was initially published on my blog,</em> <a target="_blank" href="http://www.fatosmorina.com/set-macos-development-environment-using-thoughtbots-laptop-script/"><em>FatosMorina.com</em></a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Jump between words using keyboard shortcuts in iTerm ]]>
                </title>
                <description>
                    <![CDATA[ iTerm is a great terminal replacement that I like to use. One feature that I wanted after my migration from Windows to OS X was the ability to jump between words in the command line, and not having to go through the whole line, character by character... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/jump-between-words-using-keyboard-shortcuts-in-iterm-fb1a70cecf79/</link>
                <guid isPermaLink="false">66d45efc7df3a1f32ee7f865</guid>
                
                    <category>
                        <![CDATA[ education ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Life lessons ]]>
                    </category>
                
                    <category>
                        <![CDATA[ self-improvement  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ startup ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Sun, 28 Jan 2018 18:49:35 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/0*PgviMTnKvX_ivYIG.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>iTerm is a great terminal replacement that I like to use. One feature that I wanted after my migration from Windows to OS X was the ability to jump between words in the command line, and not having to go through the whole line, character by character.</p>
<p>It turns out that this is quite possible and doesn’t cause much pain and effort on your side. You do not need to pay 1 BTC to Apple to get this working. You only need to make a few keystroke changes in your iTerm preferences and you are done.</p>
<p>In other words, you do not need to install anything else in your OS X. All you have to do is make a few configurations in the iTerm preferences, and you are good to go.</p>
<p>It’s that easy.</p>
<p>Let’s get started.</p>
<p>To make this work for the right option key, you need to set the key modifier to act as an escape sequence.</p>
<p>First, you need to set your left ⌥ key to act as an escape character.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/rdEDhYcmDHmBVijhouwsFatN18kEY6ZD08ST" alt="Image" width="800" height="482" loading="lazy"></p>
<p>After that, you can either change the current shortcut for ⌥ ← or create a new one, in the profile shortcut keys, with the following settings:</p>
<ul>
<li><p>Keyboard Shortcut: ⌥←</p>
</li>
<li><p>Action: Send Escape Sequence</p>
</li>
<li><p>Esc+: b</p>
</li>
</ul>
<p><img src="https://cdn-media-1.freecodecamp.org/images/LqVy4VYF8AHtoeyBTt5FiwraeY3X2IZrQ46j" alt="Image" width="800" height="482" loading="lazy"></p>
<p>Now we need to repeat a similar process for the ⌥→ keyboard shortcut with the following settings:</p>
<ul>
<li><p>Keyboard Shortcut: ⌥→</p>
</li>
<li><p>Action: Send Escape Sequence</p>
</li>
<li><p>Esc+: f</p>
</li>
</ul>
<p>That’s all we need to do. After we are done, we may need to restart the iTerm to be able to use the changes that we just made.</p>
<p>Now we can skip entire words on the command line interface by holding down the left ⌥ key and hitting ← or →.</p>
<p>I hope you find this article helpful.</p>
<p><em>This article was first published by the author on his</em> <a target="_blank" href="http://www.fatosmorina.com/jump-words-using-keyboard-shortcuts-iterm/"><em>blog</em></a><em>.</em></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ I became a Ruby on Rails and React contributor and you can too ]]>
                </title>
                <description>
                    <![CDATA[ I am really grateful to have contributed to a few open source projects, including two I currently use on a regular basis: Ruby on Rails and React. My contributions are very minor fixes and suggestions, and may not be worthy of much praise, but I want... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/why-you-should-contribute-to-projects-like-ruby-on-rails-and-react-e6af32a43440/</link>
                <guid isPermaLink="false">66d45f0f182810487e0ce198</guid>
                
                    <category>
                        <![CDATA[ how-to ]]>
                    </category>
                
                    <category>
                        <![CDATA[ lifestyle ]]>
                    </category>
                
                    <category>
                        <![CDATA[ open source ]]>
                    </category>
                
                    <category>
                        <![CDATA[ React ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Ruby ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Sun, 10 Dec 2017 23:47:44 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/0*owwiuHZkUm4AMr-i.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>I am really grateful to have contributed to a few open source projects, including two I currently use on a regular basis: <a target="_blank" href="http://contributors.rubyonrails.org/contributors/fatos-morina/commits">Ruby on Rails</a> and <a target="_blank" href="https://github.com/reactjs/reactjs.org/commits?author=fatosmorina">React</a>.</p>
<p>My contributions are very minor fixes and suggestions, and may not be worthy of much praise, but I want to use this article to inspire you to go and make your own contributions as well.</p>
<p>One of my core values is contribution and helping others. That’s one of the reasons I love to write articles, and also contribute back to the very projects that I have benefitted from over the years.</p>
<p>Although major frameworks that are widely used have gone through tons of reviews and careful analysis over the years, there is always room for improvement or addition. This means that you are not only able to fix bugs, or improve something that is already implemented, but you can also implement new features as well.</p>
<h3 id="heading-why-contribute-to-famous-open-source-projects">Why contribute to famous open source projects?</h3>
<p><img src="https://cdn-media-1.freecodecamp.org/images/TzpJKOca0VvLtFLTI1zx3YOWSKBwWKy6FtUW" alt="Image" width="471" height="370" loading="lazy"></p>
<p>Before explaining how you can contribute to famous open source projects, it is better to cover the reasons why I believe it is very important to participate in such endeavours.</p>
<h4 id="heading-1-you-will-learn-from-the-very-best">1. You will learn from the very best</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/MEmKcbrYFtiKUMPKs3gVCzl5l9LWTfRZqj3D" alt="Image" width="770" height="578" loading="lazy"></p>
<p>Famous open source projects like Ruby on Rails, React JS, Spring, etc., have been used by a lot of projects. They have made countless developers’ lives a lot easier.</p>
<p>Since they are products of many brilliant minds, analyzing their code and trying to make improvements can be a tremendous source of learning.</p>
<p>You will not only better learn the frameworks and libraries that you use, but also some of the best practices and timeless principles that make these projects really great. You can then apply these lessons in your own work as well.</p>
<p>By trying to do contributions, you are more likely to learn a framework better, in comparison to someone who only uses it. In a <a target="_blank" href="http://go.linuxfoundation.org/download-2016-open-source-jobs-report">2016 report conducted by the Linux Foundation</a>, 86% of technology professionals said that open source had helped them in their careers.</p>
<h4 id="heading-2-you-can-have-a-major-impact">2. You can have a major impact</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/MT60uGuN48rVil7uLcHw4JYwCLzSIlTFvBs9" alt="Image" width="536" height="337" loading="lazy"></p>
<p>If you have been working on small projects that have not had much attention, then contributing to famous open source projects can give you the opportunity to have a larger impact.</p>
<p>By making such contributions, you are potentially going to have a major impact with the work that you do, which can be a very fulfilling experience. No matter how small your contributions are, you are also going to have a feeling of significance, simply because you know that your work has made that project that you love a little better.</p>
<h4 id="heading-3-you-can-boost-your-reputation">3. You can boost your reputation</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/Yhn2-wZ9KVJ0SUdy9xKuo8OMkrFWAZSkGk39" alt="Image" width="660" height="400" loading="lazy"></p>
<p>If you go to the list of contributors to your famous open source projects, you may spot a common pattern. Top contributors are usually developers that are working for big companies, or on large projects.</p>
<p>As a result, making important contributions to such projects can be difficult, simply because these developers may have already finished implementing a particular feature really well. This means that entering into that list represents a noticeable demonstration of your skills for a recruiter that is looking for a new developer.</p>
<p>This also means that you are also more likely to receive better job offers, or higher consulting session rates. Companies are always looking to hire bright and skilled developers that are experienced on open source projects, and there are only few better ways to demonstrate your knowledge about a framework than to actually write some of the code for that project.</p>
<h3 id="heading-how-can-you-contribute-to-famous-open-source-projects">How can you contribute to famous open source projects?</h3>
<p>Now that we have mentioned three major reasons why I believe it is worth contributing to famous open source projects, let’s see how you can do that.</p>
<h4 id="heading-1-understand-how-things-work">1. Understand how things work</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/mlwo2BBAqH1jqZgmqSlctMxFz2Z00H18D0ZI" alt="Image" width="800" height="479" loading="lazy"></p>
<p>Curiosity may have killed the cat, but it also helped Taylor Wilson <a target="_blank" href="https://www.theguardian.com/science/2015/jun/20/taylor-wilson-nuclear-teen-genius-science-interview">become</a> the 32nd person in human history to achieve nuclear fusion… at the age of 14.</p>
<p>Similarly, if you want to contribute to famous open source projects, you have to understand how things work behind the scenes. You need to learn from books. You have to be curious to understand the implementations of a particular function, or how routes invoke a particular controller. This way, you may also be able to spot strange things that you can improve, or implement a more efficient method for a particular task.</p>
<p>The more you understand a framework, the more you tend to like using it in your projects, <a target="_blank" href="https://medium.freecodecamp.org/vim-isnt-that-scary-here-are-5-free-resources-you-can-use-to-learn-it-ab78f5726f8d">as we may usually get away from the unknown and from the things that are not clear to us</a>.</p>
<h4 id="heading-2-check-the-reported-issues">2. Check the reported issues</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/sqMoBm3fY2XUziTvLIqjXBht4MHM39NNvdOu" alt="Image" width="800" height="450" loading="lazy"></p>
<p>Issues may represent bugs, concerns, or simply suggestions that other people have noticed or that want to express regarding a project. They also represent a great source of contribution ideas that you may use as inspiration.</p>
<p>Look at the issues of a project that you can to contribute to, and make an assessment whether you can contribute to them or not.</p>
<p>Although some issues may seem very difficult at first, you should not be afraid to try fixing a bug, or implementing a new feature in that framework. You can also use it as a way for you to learn new things, expand your current limits and go out of your comfort zone.</p>
<p>You can also ask questions for more clarity about the issues, and contribute with your answers to other people’s questions.</p>
<h4 id="heading-3-do-not-ignore-small-things">3. Do not ignore small things</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/yy8QhavHgR0xBfGJIcPt2mMRFjNwAo5Eq-FD" alt="Image" width="468" height="311" loading="lazy"></p>
<p>You may suppose that famous open source projects have very few opportunities left to contribute to, so maybe you tend to give up on the idea about contributing.</p>
<p>Even though that’s not the case, there are some frequently neglected responsibilities that you can take when it comes to open source projects. Aside from code, projects also need writers to help with documentation, translators to convert locale files into other languages, and also designers to make interfaces more intuitive and attractive.</p>
<p>You do not have to write the whole documentation, or translate everything into another language. You can simply start something you believe is worth being included, and then also ask for help for the improvement, or simply push your minor changes and ask for feedback by project maintainers.</p>
<p>You can also contribute by writing tests, or fix the ones that are already failing, or create new issues about bugs, and also answer the questions that people have asked on existing issues.</p>
<p>There is also another indirect way that you can contribute to open source projects.</p>
<p>That is by sending greeting letters to maintainers and thanking them for their time and the work that they are doing. Most of them contribute to open source on a volunteer basis, so thanking them can make them aware of the importance of their contributions. This way, you are making them feel better about their efforts, and also inspire them to continue with their contributions.</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>Contributing to famous open source projects is something that anyone can do.</p>
<p>The key is to be patient, as it may take some time until you find something that you want to contribute. You should also have fun and enjoy the process. After all, this is why Linus Torvalds titled his book “Just for Fun”, in which he describes the story of how he created Linux.</p>
<p><em>I am a Passionate Software Engineer, currently serving as a Team Lead Developer for a group of enthusiastic developers that specialize in developing web and mobile applications, mostly using Ruby on Rails and React JS.</em></p>
<p><em>I am an</em> <a target="_blank" href="https://github.com/fatosmorina"><em>open source enthusiast</em></a> <em>and also a</em> <a target="_blank" href="http://fatosmorina.com"><em>blogger</em></a><em>.</em></p>
<p><em>I am currently looking for a remote job. Please</em> <a target="_blank" href="mailto:fatosi.morina@gmail.com"><em>contact me</em></a> <em>with new opportunities.</em></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to get trending GitHub projects in your Chrome new tab screen with GitHunt ]]>
                </title>
                <description>
                    <![CDATA[ GitHub is widely known as one of the most famous version control repositories. In it, you can find almost countless public projects in many programming languages. It makes it easy for you to collaborate with your team members and fellow developers ar... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-find-trending-github-projects-using-githunt-in-chrome-cb2d2a8f2468/</link>
                <guid isPermaLink="false">66d45ef5c7632f8bfbf1e433</guid>
                
                    <category>
                        <![CDATA[ Productivity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ startup ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Sun, 22 Oct 2017 10:20:47 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*vRt4wESDkhVaPC8qs0ljQg.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>GitHub is widely known as one of the most famous version control repositories. In it, you can find almost countless public projects in many programming languages. It makes it easy for you to collaborate with your team members and fellow developers around the globe. Together, you can learn from and also contribute to these projects.</p>
<h4 id="heading-finding-and-working-on-trending-projects">Finding and working on Trending Projects</h4>
<p>Among many other things, GitHub displays <strong>Trending Projects</strong>. This makes it easier for you to know which projects have received the most attention. You can find projects that have received a lot of stars from fellow developers in the recent past.</p>
<p>The process of finding new trending projects has gotten even easier: there’s now a Chrome extension, called GitHunt, dedicated to increasing your exposure to open source projects.</p>
<p>GitHunt can be installed as a Chrome extension in your browser, giving you the ability to see top trending projects on GitHub right in your <strong>new tabs</strong>. You can see trending projects on a daily, weekly, or monthly basis.</p>
<p>You can choose to display trending projects in only one language or in all languages. But there is currently no option to choose more than one language without including all of them.</p>
<p>Aside from the project title and the number of stars, you can also view a short project description (if it has already been added) and the number of issues opened. You can also visit that project by simply clicking on the project displayed in the new tab.</p>
<h3 id="heading-why-should-you-install-this-extension">Why should you install this extension?</h3>
<p>GitHub has been <a target="_blank" href="http://code.dblock.org/2011/07/14/github-is-your-new-resume.html">called the new resume</a> for software developers. It is a great way to promote your knowledge, skills, expertise, and style of coding to potential recruiters.</p>
<p>As a result, many developers publish some of their best work on GitHub. This allows other developers to learn from it, contribute to it, and publish their own innovations.</p>
<p>Even so, it is sometimes difficult to stumble upon the very best projects. You might not be in the habit of checking GitHub directly just to see the trending projects. But if you have them right in your new tabs in Chrome, you’ll increase your chances of discovering new and interesting projects that can help you.</p>
<p>Large companies like <a target="_blank" href="https://readwrite.com/2013/10/17/is-facebook-the-worlds-largest-open-source-company/">Facebook, Google,</a> and <a target="_blank" href="https://opensource.org/node/901">Microsoft</a> benefit so much from open source projects. Let this convince you to use this extension in your browser even more.</p>
<p>You might find a simple project in your new tabs that has already solved the problem that has been bothering you for a long time. Maybe you planned to search Google for a plausible solution, but that solution might be right there.</p>
<p>These projects can also inspire you with new knowledge, ideas, and patterns to help you build your next trending open source projects.</p>
<p>GitHunt is also an open-source project that you can <a target="_blank" href="https://github.com/kamranahmedse/githunt">find on GitHub</a>. If you have any ideas about how to improve it, the <a target="_blank" href="https://github.com/kamranahmedse">author</a> has already called for your contributions. I have already made a few <a target="_blank" href="https://github.com/kamranahmedse/githunt/pull/15">minor typo fixes</a> and invite you to continue improving this great project.</p>
<p>You can read more and see the source code of this extension by visiting its <a target="_blank" href="https://github.com/kamranahmedse/githunt">GitHub page</a>. You can download and install it via <a target="_blank" href="https://chrome.google.com/webstore/detail/githunt/khpcnaokfebphakjgdgpinmglconplhp">Chrome Webstore</a>.</p>
<p><em>This post was originally published on</em> <a target="_blank" href="https://medium.com/better-programming/githunt-trending-github-projects-in-your-chrome-new-tab-screen-d57168922918"><em>Medium</em></a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Vim isn’t that scary. Here are 5 free resources you can use to learn it. ]]>
                </title>
                <description>
                    <![CDATA[ The unknown things can be frightening. The unknown is usually followed by a type of resistance. Vim is not an exception. Still, despite the fact that a StackOverflow question asking about ways of exiting from it has been seen more than one million ti... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/vim-isnt-that-scary-here-are-5-free-resources-you-can-use-to-learn-it-ab78f5726f8d/</link>
                <guid isPermaLink="false">66d45f0d9208fb118cc6cfa7</guid>
                
                    <category>
                        <![CDATA[ learning to code ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ self-improvement  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Fatos Morina ]]>
                </dc:creator>
                <pubDate>Thu, 17 Aug 2017 04:15:27 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*NGluQ6fac_adZZWWlQ3VFw.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The unknown things can be frightening. The unknown is usually followed by a type of resistance. Vim is not an exception. Still, despite the fact that a StackOverflow question asking about ways of exiting from it has been seen <a target="_blank" href="https://stackoverflow.blog/2017/05/23/stack-overflow-helping-one-million-developers-exit-vim/">more than one million times</a>, Vim is still <a target="_blank" href="https://insights.stackoverflow.com/survey/2017#technology-most-popular-developer-environments-by-occupation">one of the most used editors by developers around the world</a>.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/iUoTDOBtY0gfLCfuQF2VFcB5O25EbCESvi23" alt="Image" width="800" height="439" loading="lazy"></p>
<p>_This is a view from this [open source](https://github.com/fatosmorina/cryptocurrencies_graphs" rel="noopener" target="<em>blank" title=") project that displays cryptocurrencies values like Bitcoin, Ethereum and Nasdaq</em></p>
<p>Many people who do not use Vim are accustomed to other editors and think that they do not need to switch to it. They do not want to leave their comfort zone. They think that Vim takes too much time and effort to learn and that it does not make that much of a difference after all.</p>
<p>By taking the time to read this article, you have shown that you already have some type of interest about Vim. Before we see some resources that make it easier for you to learn Vim, let’s see the reasons why should we even consider using this 1980s text editor.</p>
<h3 id="heading-why-should-you-learn-vim-in-the-first-place">Why should you learn Vim in the first place?</h3>
<p><img src="https://cdn-media-1.freecodecamp.org/images/JH9oJvo7m1DPy1qHqlJ746ss76VbtwkdQw2T" alt="Image" width="800" height="539" loading="lazy"></p>
<p>_Image: [http://amzn.to/2umsBaY](http://amzn.to/2umsBaY" rel="noopener" target="<em>blank" title=")</em></p>
<blockquote>
<p><em>“To use Vim is one of the best choices I’ve made in my programming career.” —</em> <a target="_blank" href="https://stackoverflow.com/users/6726/lucas-oman"><em>Lucas Oman</em></a></p>
</blockquote>
<p>It is reasonable that you may need some reasons to know why learning Vim is worth the effort. After all, it may affect your entire workflow. It may even seem unreasonable to start learning something that does not look suitable for you.</p>
<p>Vim is used by <a target="_blank" href="https://robots.thoughtbot.com/the-vim-learning-curve-is-a-myth">almost everybody at thoughtbot</a> which is one of the <a target="_blank" href="https://www.quora.com/What-are-some-of-the-best-recommended-dev-shops-in-Bay-Area">most recommended</a> companies in Bay Area. Knowing this might make it compelling for you to start learning it. Aside from that, there are other reasons worth mentioning. Let’s begin.</p>
<h4 id="heading-it-is-like-playing-a-game">It is like playing a game</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/T16SNCcn74ixAL8upiY5GQThc30gtS7iQJq-" alt="Image" width="800" height="317" loading="lazy"></p>
<p>When you want to start playing a game, you do not step back from playing it just because it is hard. You actually get motivated to play it because it gives you pleasure. Developing with Vim is similar. When you start to see that it is fast and intuitive, you may start to enjoy the experience. You can even get more hooked on it once you learn some of the more advanced commands that increase your productivity.</p>
<h4 id="heading-no-need-for-a-mouse">No need for a mouse</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/xtPiYjNkjRxOIYkvi7g7nMphHpRKezKTautf" alt="Image" width="640" height="428" loading="lazy"></p>
<p>You have many shortcuts to navigate through the code and files, which can actually help you get rid of the need to use your mouse at all. As a result, you do not need to get your fingers off the keyboard, which speeds up your coding.</p>
<p>In other words, you can code in Vim as fast you can type. It is fast. Even the word Vim means <strong>energy</strong> and <strong>enthusiasm</strong>.</p>
<h4 id="heading-many-powerful-commands">Many powerful commands</h4>
<p>The list of commands that you can use is pretty long. You do not have to learn each one, you simply need to learn a few in the beginning and then try to learn new ones as you go. You may learn something new and important that is in Vim even many years after your first lesson.</p>
<h4 id="heading-highly-customizable">Highly customizable</h4>
<p>There are configurations that you can use and change based on your own preference. There are hundreds of colors schemes that you can download. Moreover, you can use a large number of plugins that enhance your editor and make it as powerful as modern IDEs.</p>
<h4 id="heading-it-is-text-centered">It is text-centered</h4>
<p>Modern IDEs have a lot of built in features. They usually come with a lot of buttons and a rich user interface to make it easier for you to use all the functionalities that are in it. Vim on the other hand is generally text centered. This makes it easier for you to focus only on the code and get rid of other distractive icons and options that are not code related.</p>
<h4 id="heading-it-is-present-in-every-linux-machine">It is present in every Linux machine</h4>
<p>The vast majority of servers use Linux as their operating system. When you are familiar with the basics of Vim, you may become comfortable with the deployments and server maintenance.</p>
<p>These are not the only reasons why Vim needs your attention. But they represent some of the most important ones. If they resonate with you, then you may give learning Vim a chance.</p>
<h3 id="heading-5-free-online-resources-to-learn-vim">5 free online resources to learn Vim</h3>
<p>Here are a few resources that you can use to help you in your learning journey. Do not pretend to learn everything related to Vim at once. There are people who have been using Vim for <a target="_blank" href="https://stackoverflow.com/a/597086/3609067">20 years and they are still learning new things related to it</a>.</p>
<h4 id="heading-vimtutor">VimTutor</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/ZnAi3-E4pFrTREwTcRbuC0QPvevFS6lqQaMC" alt="Image" width="731" height="722" loading="lazy"></p>
<p>If you are using a Unix-based machine, you can go to your shell and type <strong>vimtutor</strong>. If you are on Windows, you can see some of the answers to open it <a target="_blank" href="https://superuser.com/questions/270938/how-to-run-vimtutor-on-windows">here</a>.</p>
<p>You will have an excellent tutorial that will help you learn the basics of Vim in a few minutes. When you are done, you will already see why Vim is amazing.</p>
<h4 id="heading-openvimhttpwwwopenvimcomtutorialhtml"><a target="_blank" href="http://www.openvim.com/tutorial.html">OpenVim</a></h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/3gj72SJz0WAQGxLDle-R7AhGUtc4EzSuhcif" alt="Image" width="800" height="362" loading="lazy"></p>
<p>This is an interactive tutorial that you can use to get a solid understanding of the basics in Vim. You can also use it to test your existing Vim skills.</p>
<h4 id="heading-vim-adventureshttpvim-adventurescom"><a target="_blank" href="http://vim-adventures.com/">Vim Adventures</a></h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/gN2nZ7OHBkXCGPiwl02RhWx38xrEl26zoxD6" alt="Image" width="800" height="386" loading="lazy"></p>
<p>If you like learning while playing games, then this resource may be valuable for you. In this game, you can learn to use Vim commands for navigation, which are essential for you to navigate the maze. You can always type <code>:help</code> for any hint.</p>
<h4 id="heading-the-basics-of-vimhttpsvimeocomalbum2838732"><a target="_blank" href="https://vimeo.com/album/2838732">The basics of Vim</a></h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/axcnqcGTywh1CCw1zviNYpdu-4UtYF48Dk1Y" alt="Image" width="800" height="397" loading="lazy"></p>
<p><a target="_blank" href="https://vimeo.com/user1690209">Derek Wyatt</a> has prepared an album with 13 videos where he teaches Vim. These videos have been seen several thousand times and are very valuable resources for you to learn the basics of Vim. If you are still doubting whether you should learn Vim, then these videos can give you more reasons to learn.</p>
<h4 id="heading-vim-cheat-sheethttpsvimrtorrcom"><a target="_blank" href="https://vim.rtorr.com/">Vim Cheat Sheet</a></h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/yQ9ix1KlNEoiM6BuAlehZ-iI6gw3pnuynRzP" alt="Image" width="800" height="552" loading="lazy"></p>
<p>Print this cheat sheet and leave it next to your desk. From time to time, take a few seconds to look through the list and try to use something from it. This way you can memorize new commands on the go and also reinforce the ones that you already one.</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>If you’re new to Vim, then it may be better to not start to use it immediately in your work projects, because you may get frustrated and never get back to it. You should initially use it in your side projects, and only start using it in your full time job once you are pretty comfortable.</p>
<p>Try using Vim for a few days in a side project that you have and see how it goes. If you enjoy using it, then you can stick to it.</p>
<p><em>I am a Passionate Software Engineer, currently serving as a Team Lead Developer for a group of enthusiastic developers that specialize in developing web and mobile applications, mostly using Ruby on Rails and React JS.</em></p>
<p><em>I am an</em> <a target="_blank" href="https://github.com/fatosmorina"><em>open source enthusiast</em></a> <em>and also a</em> <a target="_blank" href="http://fatosmorina.com"><em>blogger</em></a><em>.</em></p>
<p><em>I am currently looking for a remote job. Please</em> <a target="_blank" href="mailto:fatosi.morina@gmail.com"><em>contact me</em></a> <em>for new opportunities.</em></p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
