<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Boot.dev</title>
    <description>The latest articles on DEV Community by Boot.dev (@bootdotdev).</description>
    <link>https://dev.to/bootdotdev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F3396%2Fcfa9c27f-30c4-4758-8208-eba7a2f90b80.png</url>
      <title>DEV Community: Boot.dev</title>
      <link>https://dev.to/bootdotdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bootdotdev"/>
    <language>en</language>
    <item>
      <title>Learn to Code the Slow Way</title>
      <dc:creator>Lane Wagner</dc:creator>
      <pubDate>Mon, 11 Sep 2023 15:51:34 +0000</pubDate>
      <link>https://dev.to/bootdotdev/learn-to-code-the-slow-way-2g60</link>
      <guid>https://dev.to/bootdotdev/learn-to-code-the-slow-way-2g60</guid>
      <description>&lt;p&gt;Ever since starting &lt;a href="https://www.boot.dev" rel="noopener noreferrer"&gt;Boot.dev&lt;/a&gt;, I've been flooded with what I call "quicksand questions". On the surface, a quicksand question &lt;em&gt;seems&lt;/em&gt; like a good question. If you could answer it, it would catapult you from where you are (nightshift at the Wendy's drive-in) to where you want to be (telling friends that you work at Netflix btw).&lt;/p&gt;

&lt;p&gt;Quicksand questions are all about finding shortcuts.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I need a developer job in 3 months, what's the best way to do that?&lt;/p&gt;

&lt;p&gt;I see you've laid out 20 courses in your backend learning path, but, *wink* which ones can I skip?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What's wrong with shortcuts?
&lt;/h2&gt;

&lt;p&gt;Now, I want to be &lt;em&gt;clear&lt;/em&gt;, there is &lt;em&gt;absolutely nothing wrong&lt;/em&gt; with wanting to take a shorter path toward your career goal. Anything else would be insanity. If there was a pill to turn you into a senior developer overnight, I'd encourage you to pop that sucker.&lt;/p&gt;

&lt;p&gt;In theory, educational min-maxing seems like a solid strategy, but in practice it just doesn't work.&lt;/p&gt;

&lt;p&gt;Why? Because the destination is &lt;em&gt;unknown&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Dijkstra's algorithm is great if you know where you're going. If you don't, you need something else.&lt;/p&gt;

&lt;h2&gt;
  
  
  No one knows where they're going
&lt;/h2&gt;

&lt;p&gt;The tech scene is a clusterf*ck of complexity. I learned like 10 different programming languages in college, and even 3 years into my degree, I still didn't know that I'd end up working as a backend engineer writing Go.&lt;/p&gt;

&lt;p&gt;I interviewed for all sorts of nonsense, from embedded systems to frontend development. Yeah, turns out that my Prolog class didn't help much in my first interview, but you know what? It didn't &lt;em&gt;hurt&lt;/em&gt;, and now when someone says "it's a declarative system" my facial expression doesn't betray ignorance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F451bzxm8hpmo8lyhbx8x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F451bzxm8hpmo8lyhbx8x.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you knew &lt;em&gt;exactly&lt;/em&gt; which concepts you'd need to master to pass your first interview, then you could might be able to find an effective shortcut. The trouble is, there is no &lt;em&gt;precise&lt;/em&gt; subset of knowledge that will always be enough to pass every possible first interview.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every company has its own janky tech stack&lt;/li&gt;
&lt;li&gt;Every PM has their own version of "agile"&lt;/li&gt;
&lt;li&gt;Every hiring manager has their own 7-step interview process&lt;/li&gt;
&lt;li&gt;Every job requires different bits of arcane knowledge&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You have &lt;em&gt;no idea&lt;/em&gt; what you'll be doing day to day at your first job when you're starting to learn to code. I hear people say things like "I never even use my DSA skills at work", and upon further inspection, it turns out they're a WordPress "developer".&lt;/p&gt;

&lt;h2&gt;
  
  
  So I shouldn't be interested in the shortest path?
&lt;/h2&gt;

&lt;p&gt;You should, it's just not where you think you'll find it. The shortest path to a job as a programmer does &lt;em&gt;not&lt;/em&gt; involve minimizing the amount of things you need to learn and build. That sort of thinking results in a much longer, more mentally exhausting journey. Something like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Jump directly into a web framework (probably Next.js since you're basic af)&lt;/li&gt;
&lt;li&gt;Find you have a talent for building TODO apps&lt;/li&gt;
&lt;li&gt;Realize you can't build "hello world" without a tutorial&lt;/li&gt;
&lt;li&gt;Attempt to remedy that by doing more tutorials&lt;/li&gt;
&lt;li&gt;Read on Twitter that ackshaully Rust is the best language&lt;/li&gt;
&lt;li&gt;Admit defeat at the hands of the borrow checker&lt;/li&gt;
&lt;li&gt;Repeat steps 1-4 &lt;code&gt;n&lt;/code&gt; times, where &lt;code&gt;n&lt;/code&gt; is a &lt;code&gt;d4_roll * your_stubbornness&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The shortest path (or at least short*er* path) usually looks like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Learn core programming/cs &lt;em&gt;concepts&lt;/em&gt; in some language&lt;/li&gt;
&lt;li&gt;Tentatively decide on the kind of programming you want to do (frontend, backend, mobile, etc)&lt;/li&gt;
&lt;li&gt;Learn the fundamentals of that kind of programming in technologies well suited for it&lt;/li&gt;
&lt;li&gt;Never stop learning and building while you search for a job&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Don't get me wrong, this second path still isn't short. Programming isn't easy, sorry if you were told it was, but if you're willing to put in the effort you can avoid an aimless stroll through the 9th circle of tutorial hell.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't be scared of work
&lt;/h2&gt;

&lt;p&gt;Folks spend eons trying to find the shortest learning path, or trying to avoid learning things that "they'll never use again". They're fine wasting &lt;em&gt;months or years&lt;/em&gt; learning absolutely nothing to avoid doing &lt;em&gt;any&lt;/em&gt; unnecessary work. Why not bite the bullet and risk spending a few &lt;em&gt;days&lt;/em&gt; learning something that's not directly applicable to the job you'll eventually land?&lt;/p&gt;

&lt;h2&gt;
  
  
  Dogecoin to the mooon?
&lt;/h2&gt;

&lt;p&gt;Let's be 100000000% honest. Some folks are looking for a good 'ol fasioned get rich quick scheme. After a few weeks of struggling with loops, they'll give up and purchase an AI-powered crypto trading bot on Fiverr. Don't be like those folks.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Becoming a software engineer is NOT a "get-rich-quick" scheme. It's a "get-upper-middle-class-slow" scheme&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The trick to "making it"? You have to actually get good.&lt;/p&gt;

&lt;p&gt;So, instead of copy/pasting haphazardly from StackOverflow to "fix" the next error you encounter, take the extra minutes to figure out what it &lt;em&gt;means&lt;/em&gt;. I can't begin tell you how many PRs I've reviewed that "fix" something, but are just a patch of a patch because the dev never grokked the underlying problem.&lt;/p&gt;

&lt;p&gt;For example, an ex-Java dev (it's always a Java dev) finds that &lt;em&gt;sometimes&lt;/em&gt; this function (in Go) panics:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// sendEmail sends emails, but sometimes panics&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;sendEmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They go straight to Google and find that panicking in Go can be "solved" with a &lt;code&gt;recover&lt;/code&gt;. So they open a pull request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;sendEmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nb"&gt;recover&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"recovered from panic in sendEmail"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}()&lt;/span&gt;

  &lt;span class="c"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This kinda works? But a better developer would try to understand and fix the underlying problem in the code. They would add &lt;code&gt;nil&lt;/code&gt; checks, or just stop using pointers altogether for this function...&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// now sendEmail never panics&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;sendEmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You want to have a bias toward becoming better, not reaching the end. There isn't an "end", there's just too much out there to learn. The scope of all of software engineering is larger than the scope of your last program's global namespace.&lt;/p&gt;

&lt;h2&gt;
  
  
  It's not the advice you wanted
&lt;/h2&gt;

&lt;p&gt;Getting fit, giving up addiction, building a business, and yes, getting your first dev job are all &lt;em&gt;hard&lt;/em&gt;. Don't make it harder on yourself by wasting your time searching for shortcuts.&lt;/p&gt;

&lt;p&gt;Learn evergreen foundational stuff, build projects that interest you, and you'll be amazed how far you can get in just a year or two of consistent effort.&lt;/p&gt;

</description>
      <category>learning</category>
      <category>career</category>
      <category>backenddevelopment</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Build Your First Coding Project and Avoid Tutorial Hell</title>
      <dc:creator>Lane Wagner</dc:creator>
      <pubDate>Wed, 05 Jul 2023 13:47:00 +0000</pubDate>
      <link>https://dev.to/bootdotdev/build-your-first-coding-project-and-avoid-tutorial-hell-ioa</link>
      <guid>https://dev.to/bootdotdev/build-your-first-coding-project-and-avoid-tutorial-hell-ioa</guid>
      <description>&lt;p&gt;While "real" hell may or may not exist (no need to get into religious beliefs here), tutorial hell is &lt;em&gt;very&lt;/em&gt; real.&lt;/p&gt;

&lt;p&gt;My definition of tutorial hell goes something like this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Tutorial hell is where you write code that others are explaining to you how to write, but you don't understand how to write it yourself when given a blank slate.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At some point, it's time to take the training wheels off and build something &lt;em&gt;on your own&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When is it time to build your own project?
&lt;/h2&gt;

&lt;p&gt;At &lt;a href="https://boot.dev"&gt;Boot.dev&lt;/a&gt;, students write their first non-tutorial project after completing the following modules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Learn Python (course)&lt;/li&gt;
&lt;li&gt;Learn OOP (course)&lt;/li&gt;
&lt;li&gt;Build a Python CLI (project)&lt;/li&gt;
&lt;li&gt;Learn Algorithms (course)&lt;/li&gt;
&lt;li&gt;Learn Data Structures (course)&lt;/li&gt;
&lt;li&gt;Build a Maze Solver (project)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Personal Project 1&lt;/strong&gt; (when they build their first fully custom project) &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, keep in mind that Boot.dev students are hands-on-keyboard 100% of the time. I'm not saying you should watch 40 hours of video before building anything, but I &lt;em&gt;am&lt;/em&gt; saying you should have a solid understanding of coding fundamentals before building your &lt;em&gt;own idea&lt;/em&gt;. You should learn those fundamentals by &lt;em&gt;writing code&lt;/em&gt;, but it's best if the projects and challenges you're working on are &lt;em&gt;guided&lt;/em&gt; so that you can focus more on learning the &lt;em&gt;concepts&lt;/em&gt; and less on figuring out what to build.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's the goal of your first project?
&lt;/h2&gt;

&lt;p&gt;Your goal here is &lt;em&gt;not&lt;/em&gt; to build something that makes money, or even to build something that will make its way onto your resume.&lt;/p&gt;

&lt;p&gt;The goal of this &lt;em&gt;first&lt;/em&gt; project is simply to get you used to the process of building something from scratch. You just need to get some practice breaking down a project into smaller pieces. You need to experience that first breath of fresh air as you emerge from the depths of tutorial hell for the first time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are some good requirements for your first project?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Try to spend 20-40 hours on this project.&lt;/li&gt;
&lt;li&gt;Use a programming language you're already familiar with.&lt;/li&gt;
&lt;li&gt;Commit your code to Git often, and push it up to Github.&lt;/li&gt;
&lt;li&gt;Create a &lt;a href="https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes#about-readmes"&gt;README.md file&lt;/a&gt; for your project. It should explain to readers:

&lt;ul&gt;
&lt;li&gt;What the project is, and what it does&lt;/li&gt;
&lt;li&gt;How to clone and run it&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;It's okay for (I'd even encourage) you to use third-party libraries! That said, make sure that some of the code that &lt;em&gt;you&lt;/em&gt; write is doing something interesting. You don't want a razor-thin wrapper around a third-party library to be the only thing you've written.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  But what should I build?
&lt;/h2&gt;

&lt;p&gt;The whole point of a personal project is that it's &lt;em&gt;personal&lt;/em&gt;. The idea needs to be &lt;em&gt;yours&lt;/em&gt;. Even if the project you build is &lt;em&gt;simple&lt;/em&gt; for now, at least it's &lt;em&gt;yours&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build something that you find interesting.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This probably isn't a project that will make its way onto your portfolio or resume, but it's still good to get into the habit of building things that are &lt;em&gt;interesting&lt;/em&gt; and &lt;em&gt;useful&lt;/em&gt;. Interesting and useful projects have many benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They're more fun to work on&lt;/li&gt;
&lt;li&gt;They have more interesting and difficult problems to solve&lt;/li&gt;
&lt;li&gt;You (or someone else) might actually use them&lt;/li&gt;
&lt;li&gt;They're more likely to grab the attention of other people&lt;/li&gt;
&lt;li&gt;Attention from other people can lead to career opportunities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use a programming language that you're already at least somewhat familiar with. Assuming you haven't been writing a ton of code outside of Boot.dev, your project should probably be a Python program that runs on the command line. That's fine!&lt;/p&gt;

&lt;p&gt;I want to provide a few ideas to get your creative juices flowing, but &lt;em&gt;please&lt;/em&gt; don't choose a project from this list without at least putting your own spin on it&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A text-based adventure game in the terminal&lt;/li&gt;
&lt;li&gt;A CLI tool to detect the strength of a password, or to validate it&lt;/li&gt;
&lt;li&gt;Tic-Tac-Toe in a tkinter GUI&lt;/li&gt;
&lt;li&gt;A tool that creates ASCII art from an image&lt;/li&gt;
&lt;li&gt;A command line tool to view Reddit feeds in the terminal&lt;/li&gt;
&lt;li&gt;A command line tool that parses a CSV file of pokemon data and lets you search for pokemon by name, type, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  But, but, but... I don't know how to build "X"!
&lt;/h3&gt;

&lt;p&gt;Your job as a developer is to &lt;em&gt;constantly&lt;/em&gt; build stuff that you've never built before. Don't shy away from an idea because you're not sure where to start. Google it. Ask ChatGPT. Ask the Discord community. You might need to put in an hour of research before starting to decide if your idea is feasible within a 40-hour time frame, but that's fine!&lt;/p&gt;

&lt;p&gt;Assuming that you'll be doing something you've never done before! You have some fundamentals under your belt. Now it's time to piece it all together and research as you go.&lt;/p&gt;

&lt;h2&gt;
  
  
  You'll need help
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;You're going to get stuck.&lt;/strong&gt; If you don't get stuck, you probably chose an idea that's way too easy.&lt;/p&gt;

&lt;p&gt;The trick is developing a skillset for getting &lt;em&gt;unstuck&lt;/em&gt;. This is a skill that will serve you well (and is absolutely necessary) in your career as a developer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Get used to Googling
&lt;/h3&gt;

&lt;p&gt;Start with Google. Do some research on your idea. See what others have done when building similar projects. See if there are any libraries you can install to make your life easier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use ChatGPT
&lt;/h3&gt;

&lt;p&gt;Talking through your issues with ChatGPT (&lt;a href="https://en.wikipedia.org/wiki/Rubber_duck_debugging"&gt;rubber duck&lt;/a&gt; debugging) can be a great way to get unstuck.&lt;/p&gt;

&lt;p&gt;Don't have ChatGPT write your code for you! You won't learn that way, and you'll be dreadfully slow if you get stuck in that habit. Instead, use ChatGPT to help you think through your problems, and ask it to try to find bugs in your code or explain code snippets you don't understand.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Keep in mind that ChatGPT can be confidently wrong, so don't take its word as law.&lt;/em&gt; Use it to get back on track, but verify the information it feeds you with other sources.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Discord
&lt;/h3&gt;

&lt;p&gt;Ask questions in the &lt;a href="https://boot.dev/community"&gt;Boot.dev Discord server&lt;/a&gt;, especially if you're a current student (but you're welcome either way)! As with all question-asking, provide as much context as you can so that when your fellow students and mentors help they can efficiently provide you with the information you need.&lt;/p&gt;

&lt;h2&gt;
  
  
  Publish and share
&lt;/h2&gt;

&lt;p&gt;Get your project out into the world! Again, the purpose of your &lt;em&gt;first-ever&lt;/em&gt; personal coding project probably shouldn't be to build something amazing for your resume. That said, I still think you should put enough love into it that you're not ashamed to make it public on your &lt;a href="https://blog.boot.dev/jobs/build-github-profile/"&gt;GitHub profile&lt;/a&gt; and share it with other devs you know. Get some feedback, ask for code reviews, and you can always iterate on it later and improve it as your skills improve.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>codenewbie</category>
      <category>learning</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Awww, do I Really Need to Learn X to Get a Job as a Developer?</title>
      <dc:creator>Lane Wagner</dc:creator>
      <pubDate>Mon, 26 Jun 2023 14:20:00 +0000</pubDate>
      <link>https://dev.to/bootdotdev/awww-do-i-really-need-to-learn-x-to-get-a-job-as-a-developer-29oa</link>
      <guid>https://dev.to/bootdotdev/awww-do-i-really-need-to-learn-x-to-get-a-job-as-a-developer-29oa</guid>
      <description>&lt;p&gt;A developer's life is a never-ending saga of learning new things. It's like you're playing Diablo where every new Jira ticket can feel like the next mini boss to slay. Exciting? Absolutely. Scary? Sure. Especially at first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do we resist learning new things?
&lt;/h2&gt;

&lt;p&gt;We're creatures of comfort. We like what we know, and the unknown can be as intimidating as a null dereference in prod. But here's the deal: the software development industry moves fast and there's a near-infinite amount of stuff to learn. This isn't mechanical engineering. We have 3 new JavaScript frameworks &lt;em&gt;per day&lt;/em&gt; people.&lt;/p&gt;

&lt;p&gt;Imagine this. You're squaring off against another candidate for a job, and you both are qualified in that you check all the boxes in the listed job requirements (I know, super unrealistic). The only difference between you two? &lt;em&gt;They know a heckofa lot more about the non-essential stuff than you do.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Who do &lt;em&gt;you&lt;/em&gt; think the employer will choose?&lt;/p&gt;

&lt;h2&gt;
  
  
  The necessity vs curiosity dilemma
&lt;/h2&gt;

&lt;p&gt;Now, I'm not saying you should learn every design pattern, language or tool that comes onto the scene. What you need is a balance between &lt;strong&gt;necessity&lt;/strong&gt; and &lt;strong&gt;curiosity&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Before you panic about not knowing the ins and outs of Kubernetes or TensorFlow, remember this: &lt;strong&gt;you don't need to learn everything before getting a job&lt;/strong&gt;. Real growth happens on the job, through tackling &lt;em&gt;real&lt;/em&gt; problems, not hypothetical ones.&lt;/p&gt;

&lt;p&gt;But if you want to stand out in this vast sea of developers, a spark of intellectual curiosity can be your purple cow. Go ahead and explore an interesting algorithm, RTFM when you're working with a new library, or take a minute to watch FireShip's latest video about that language you've been eyeing. You might be surprised by the doors it can open. &lt;/p&gt;

&lt;h2&gt;
  
  
  Increasing your "starting point"
&lt;/h2&gt;

&lt;p&gt;Learning isn't about hoarding answers like Scrat hoards that acorn. It's about pushing the boundary of your ignorance a little further with each passing day. I like to call this your &lt;strong&gt;"starting point"&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Think back to when you first started coding. You probably spent a lot of time googling basics like &lt;em&gt;"how to write a for loop"&lt;/em&gt; or &lt;em&gt;"what's a git branch?"&lt;/em&gt; (We've all been there, no shame.) But as you learn and grow, your starting point moves ahead. Now, you're probably googling something like &lt;em&gt;"how to specify a PUT endpoint in the go-CHI library"&lt;/em&gt; or &lt;em&gt;"best practices for asynchronous error handling in Node.js"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;See the difference? Your journey from 'for loops' to 'PUT endpoints' is a testament to your growth, and each new concept or tool you learn pushes your starting point even further. You'll never be done Googling or asking Chat GPT, but you'll be able to tackle more complex problems more efficiently with each passing day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Take the scenic route
&lt;/h2&gt;

&lt;p&gt;Learning to code isn't part of the problem set solved by Dijkstra's shortest-path algorithm. You don't need to find the &lt;em&gt;shortest&lt;/em&gt; path to success. &lt;strong&gt;Taking the scenic route isn't just okay, it's better in the long run and can be good for your career&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Dare to venture off the beaten path. Those side quests where you learn a random library because it looked cool, or spend a weekend building a game in a language you just stumbled upon, can do wonders for your skillset. Even if you never go on to use those tools again, you'll have learned a new way of thinking about problems, and that's invaluable.&lt;/p&gt;

&lt;p&gt;Each time you solve a new problem, or the same problem in a new way, you add flavor to your developer identity. Plus, that random knowledge often magically pops up in interviews and projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Moving forward, not sideways
&lt;/h2&gt;

&lt;p&gt;Now, while I encourage you to embrace deviations, it's crucial not to lose sight of your core learning path (If you're a Boot.dev student, it's probably this &lt;a href="https://boot.dev/tracks/backend"&gt;backend learning path&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;You don't want to end up in tutorial hell. &lt;/p&gt;

&lt;p&gt;Ah, tutorial hell. The Bermuda Triangle of coding, where you're lost in a sea of online courses and YouTube tutorials, endlessly copy-pasting code without truly understanding anything. The only way out of tutorial hell is to continuously progress along a learning path so you can make sure that you're actually learning &lt;em&gt;new, important things&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Well, that and you need to actually build something. Lots of somethings. Lots of somethings where each step isn't spelled out for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Embrace learning, embrace growth
&lt;/h2&gt;

&lt;p&gt;As developers, we're not just coders—we're lifelong learners. It's part of the job description, like being able to survive grueling &lt;a href="https://wagslane.dev/posts/leave-scrum-to-rugby/"&gt;Scrum&lt;/a&gt; meetings.&lt;/p&gt;

&lt;p&gt;So, don't shirk from learning new things. Embrace it. The fear, the excitement, the occasional frustration, it's all part of the package. And remember, you're not running away from learning. You're just taking a consistent jog towards success. &lt;/p&gt;

</description>
      <category>job</category>
      <category>career</category>
      <category>education</category>
      <category>webdev</category>
    </item>
    <item>
      <title>JavaScript? Python? Go? Which Tech Stack Should You Learn?</title>
      <dc:creator>Lane Wagner</dc:creator>
      <pubDate>Tue, 25 Apr 2023 14:51:00 +0000</pubDate>
      <link>https://dev.to/bootdotdev/javascript-python-go-which-tech-stack-should-you-learn-4178</link>
      <guid>https://dev.to/bootdotdev/javascript-python-go-which-tech-stack-should-you-learn-4178</guid>
      <description>&lt;p&gt;Ah, the age-old question: which tech stack should I learn? Aspiring developers often get bogged down in this dilemma, and it's not hard to see why. The tech industry is an ocean of opportunities, and the fear of diving into the wrong waters can be paralyzing.&lt;/p&gt;

&lt;p&gt;But here's a little secret for you: &lt;strong&gt;it's more important to be insatiably curious and willing to learn new things than to stress over learning exactly the right things.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Don't try to &lt;a href="https://www.urbandictionary.com/define.php?term=min%2Fmax"&gt;minmax&lt;/a&gt; your programming education"&lt;/p&gt;

&lt;p&gt;-- Paraphrased from &lt;a href="https://www.twitch.tv/theprimeagen"&gt;ThePrimeagen&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  It doesn't matter much. There are jobs in every stack
&lt;/h2&gt;

&lt;p&gt;There are jobs in every tech stack. From popular ones like &lt;a href="https://boot.dev/learn/learn-javascript"&gt;JavaScript&lt;/a&gt;, &lt;a href="https://boot.dev/learn/learn-python"&gt;Python&lt;/a&gt;, and Ruby to newer languages like &lt;a href="https://boot.dev/learn/learn-golang"&gt;Go&lt;/a&gt;, Elixir, or Rust, there's a market for each of them.&lt;/p&gt;

&lt;p&gt;Take JavaScript, for example. It's the go-to language for front-end development, and &lt;a href="https://blog.boot.dev/javascript/nodejs-vs-javascript/"&gt;Node.js&lt;/a&gt; has made it incredibly versatile on the back-end too. With the rise of serverless architectures and the popularity of React and Angular, JavaScript devs are in high demand.&lt;/p&gt;

&lt;p&gt;But what if you're more into Python? No problem! Python is not only the darling of data scientists and machine learning engineers but also a solid choice for web development with frameworks like Django and Flask.&lt;/p&gt;

&lt;p&gt;The point is: whatever tech stack you choose, there's a job out there for you &lt;em&gt;if you know what you're doing&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Total number of jobs doesn't matter, you only need &lt;em&gt;one&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;Let's say you're a Golang aficionado, but you're worried because there aren't as many Go jobs as there are for JavaScript. Well, remember this: you only need to land &lt;em&gt;one&lt;/em&gt; job.&lt;/p&gt;

&lt;p&gt;Instead of fretting over the total number of available jobs, focus on finding the right fit for your skills and passions. After all, the perfect job in a smaller market is better than being miserable in a sea of JavaScript gigs. I actually wrote an &lt;a href="https://blog.boot.dev/jobs/not-about-job-openings/"&gt;entire article about how the ratio of openings/developers&lt;/a&gt; is a much more important consideration than the total number of jobs.&lt;/p&gt;

&lt;h2&gt;
  
  
  You'll fail because you give up and stop learning, not because your tech stack is unpopular
&lt;/h2&gt;

&lt;p&gt;The tech industry rewards adaptability and growth. Technologies come and go, but the core skills and mindset of a developer persist. Expect to be constantly learning new programming languages, frameworks, and tools throughout your career.&lt;/p&gt;

&lt;p&gt;In fact, dabbling in &lt;a href="https://blog.boot.dev/education/learn-multiple-programming-languages/"&gt;multiple languages and frameworks&lt;/a&gt; can make you a more well-rounded and versatile developer. By exposing yourself to different ways of thinking and solving problems, you'll develop a more comprehensive understanding of programming concepts.&lt;/p&gt;

&lt;p&gt;I've seen hundreds of learners fail in their journey to become developers because they gave up and stopped learning. &lt;em&gt;I've never seen a single person fail because they started with the wrong stack.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Anything will work, but some choices &lt;em&gt;are&lt;/em&gt; better than others
&lt;/h2&gt;

&lt;p&gt;Alright, so we've established that you can find a job in any tech stack, but does that mean all choices are equally good? Not quite.&lt;/p&gt;

&lt;p&gt;When choosing a tech stack, there are factors to consider that can impact your career development. Let's dive into a few key things to keep in mind.&lt;/p&gt;

&lt;h3&gt;
  
  
  Try to learn something that has jobs in your area
&lt;/h3&gt;

&lt;p&gt;Before picking a tech stack, do some research on local job markets and industry trends. Find out which languages and frameworks are in high demand in your area, and which ones are on the rise.&lt;/p&gt;

&lt;p&gt;Working with a tech stack that has a strong community and support network can help you stay up-to-date and make it easier to find jobs or freelance gigs. I've also found that for junior developers it's typically easier to land a job in your local area than to find a remote gig. That's not a hard and fast rule, but it's something to keep in mind.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose a tech stack that you enjoy
&lt;/h2&gt;

&lt;p&gt;Remember: your tech stack choice should align with your personal interests and career goals.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you're passionate about data science and machine learning, &lt;a href="https://boot.dev/learn/learn-python"&gt;Python&lt;/a&gt; might be a better choice for you than PHP&lt;/li&gt;
&lt;li&gt;If you're interested in cloud-native back-end development, I'd certainly recommend &lt;a href="https://boot.dev/learn/learn-golang"&gt;Golang&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;f you're all about building sleek and interactive web apps, &lt;a href="https://boot.dev/learn/learn-javascript"&gt;JavaScript&lt;/a&gt; and its various frameworks could be right up your alley&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Don't be afraid to learn technologies that you won't use at work
&lt;/h2&gt;

&lt;p&gt;To become a well-rounded developer, there are a slew of &lt;em&gt;concepts&lt;/em&gt; that are important to learn. When designing the &lt;a href="https://boot.dev/tracks/backend"&gt;learning path on Boot.dev&lt;/a&gt;, I'm not only interested in teaching students a cluster of technologies, I'm focused on getting those concepts to stick. As it turns out, some languages and frameworks are better at teaching certain concepts than others.&lt;/p&gt;

&lt;p&gt;For example, if you're working to become a back-end developer, here are some of the important concepts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://boot.dev/learn/learn-object-oriented-programming"&gt;OOP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://boot.dev/learn/learn-algorithms"&gt;DSA&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://boot.dev/learn/learn-sql"&gt;Databases&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://boot.dev/learn/learn-http"&gt;HTTP + Basic networking&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://boot.dev/learn/learn-web-servers"&gt;REST APIs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://boot.dev/learn/learn-functional-programming"&gt;Functional programming basics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://boot.dev/learn/learn-cryptography"&gt;Security&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Don't worry, you can always learn more
&lt;/h2&gt;

&lt;p&gt;Once you've learned one programming language, picking up another one becomes &lt;em&gt;way&lt;/em&gt; easier. &lt;strong&gt;I'm talking like 80+% easier.&lt;/strong&gt; Most new developers don't realize this, but it's why you don't need to stress over the perfect first language.&lt;/p&gt;

&lt;p&gt;Programming languages may have different syntax and nuances, but the underlying concepts remain consistent. Once you've got the fundamentals down, learning a new language or framework becomes more about understanding the specific quirks and less about grappling with entirely new ideas. Binary trees, encapsulation, and function closures are all pretty universal concepts, you'll never need to re-learn them.&lt;/p&gt;

&lt;p&gt;Let me give you an example: if you're proficient in Python and decide to learn JavaScript, you'll find that many of the core programming concepts, like loops, conditionals, and functions, are pretty similar. JavaScript has its quirks (looking at you, &lt;code&gt;this&lt;/code&gt; keyword), but you'll be surprised at how quickly you can pick it up.&lt;/p&gt;

&lt;p&gt;Go forth. Embrace the challenges, learn from setbacks, and above all, never stop being curious. The most successful developers I've met never ask "Do I really need to learn X?" They say "X looks exciting! I'm going to build something with it."&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>codenewbie</category>
      <category>coding</category>
      <category>education</category>
    </item>
    <item>
      <title>Which is More Important: Hard or Soft Skills for Programmers?</title>
      <dc:creator>Lane Wagner</dc:creator>
      <pubDate>Mon, 24 Apr 2023 14:02:00 +0000</pubDate>
      <link>https://dev.to/bootdotdev/which-is-more-important-hard-or-soft-skills-for-programmers-lh7</link>
      <guid>https://dev.to/bootdotdev/which-is-more-important-hard-or-soft-skills-for-programmers-lh7</guid>
      <description>&lt;p&gt;You're waiting at the front-desk of Google's campus in Boulder, Colorado, waiting for your coding interview to start. Across from you in the lobby sit two other candidates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A charismatic airpods-flaunting developer who can charm the pants off of anyone in the room but requires an agonizing 8 hours to get a linked list working&lt;/li&gt;
&lt;li&gt;A programming prodigy who writes games in assembly, but is such a colossal jerk that nobody will play their game anyways&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which of them will provide more fierce competition for the &lt;a href="https://blog.boot.dev/jobs/not-about-job-openings/"&gt;job spot&lt;/a&gt;? Let's tackle the age-old question: &lt;strong&gt;Which is more important, hard or soft skills for programmers?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First I'll annoyingly explain what hard and soft skills are, but then we'll dive into the reason I wanted to write this article: &lt;em&gt;the rectangle analogy&lt;/em&gt;. This analogy will help you understand where you should be spending your time improving to maximize your chances of landing a job.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hard Skills: The Foundation
&lt;/h2&gt;

&lt;p&gt;First things first: what are hard skills? These are the tangible, measurable abilities that you &lt;em&gt;need&lt;/em&gt; to get the job done. As a developer, you'll need to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Code in specific languages&lt;/strong&gt; - like &lt;a href="https://boot.dev/learn/learn-python"&gt;Python&lt;/a&gt;, &lt;a href="https://boot.dev/learn/learn-javascript"&gt;JavaScript&lt;/a&gt;, or &lt;a href="https://boot.dev/learn/learn-golang"&gt;Golang&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use technologies and tools&lt;/strong&gt; - such as Git, &lt;a href="https://boot.dev/learn/learn-docker"&gt;Docker&lt;/a&gt;, or AWS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Understand &lt;a href="https://boot.dev/learn/learn-algorithms"&gt;algorithms&lt;/a&gt; and &lt;a href="https://boot.dev/learn/learn-data-structures"&gt;data structures&lt;/a&gt;&lt;/strong&gt; - because nobody wants to be that developer who can't reverse a string without Googling it first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A boatload of other things&lt;/strong&gt; - because programming is a vast and ever-expanding field.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Importance of hard skills for landing a job
&lt;/h3&gt;

&lt;p&gt;Hard skills are the bread and butter of your programming career. They're an absolute requirement for most programming positions, and they demonstrate your technical competency. In fact, if you could only have one type of skill, hard skills would be more important. After all, it's pretty tough to write code without, you know, actually knowing how to code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep hardening your hard skills
&lt;/h3&gt;

&lt;p&gt;The tech world moves at breakneck speed, and if you're not continuously leveling up your hard skills, you're gonna get left in the dust. Remember, Rome wasn't built in a day, and neither is your programming expertise. Invest time and effort in learning new languages, tools, and techniques over time.&lt;/p&gt;

&lt;p&gt;You don't need to be an expert on &lt;em&gt;everything&lt;/em&gt;, but you need to know how to deliver working code that solves real problems within your domain. If you want to &lt;a href="https://boot.dev"&gt;be a back-end developer&lt;/a&gt; and work at SaaS companies, then you should at the very least:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Have a solid understanding of a couple of programming languages like Python and Go&lt;/li&gt;
&lt;li&gt;Be able to set up and use a &lt;a href="https://boot.dev/learn/learn-sql"&gt;SQL database&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Know how to &lt;a href="https://boot.dev/learn/learn-web-servers"&gt;build a REST API&lt;/a&gt; using those technologies&lt;/li&gt;
&lt;li&gt;Know how to deploy that API to a cloud platform like AWS or GCP &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Soft Skills
&lt;/h2&gt;

&lt;p&gt;Soft skills, on the other hand, are the intangible, interpersonal abilities that can give your career a nice boots. They might not be as easy to quantify as hard skills but they're nearly as vital. Soft skills include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Charisma&lt;/strong&gt; - people like working with fun people.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Communication and writing abilities&lt;/strong&gt; - so you can articulate your ideas and keep everyone in the loop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kindness and empathy&lt;/strong&gt; - because you're working with humans, and humans don't like assholes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hard work and follow-through&lt;/strong&gt; - if you're good, but you don't deliver, then no one cares.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Importance of soft skills for long-term success
&lt;/h3&gt;

&lt;p&gt;Soft skills are the secret sauce that can propel your career to new heights. They facilitate collaboration and teamwork, making it easier for you to work with others and get the job done. Plus, having solid soft skills can enhance your overall job satisfaction and career growth. After all, nobody wants to work with a genius who's also a jerk.&lt;/p&gt;

&lt;p&gt;Hard skills are a requirement to get a job in tech, but assuming the gap in hard skills between two candidates is similar, I've actually seen the more charismatic and likable candidate get the job over the slightly more technically competent one. Why? Managers are people, and people like working with other people they like.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I improve my soft skills?
&lt;/h3&gt;

&lt;p&gt;If you have a crappy personality, don't worry too much. You don't need to be a brilliant orator or a master of the written word just to get a job as a code monkey. The number one rule should be easy to follow: &lt;strong&gt;don't be an asshole.&lt;/strong&gt; If you do that, you're halfway there.&lt;/p&gt;

&lt;p&gt;The related follow-up rule is to balance &lt;a href="https://blog.boot.dev/jobs/confidence-in-job-interviews/"&gt;confidence and humility&lt;/a&gt;. If you're a kind, open-minded developer that knows what you're talking about, you'll do great.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Rectangle Analogy: Combining Hard and Soft Skills
&lt;/h2&gt;

&lt;p&gt;Now that we've explored both hard and soft skills, let's dive into the rectangle analogy to understand how they work together. Imagine your hard skills are the length of a rectangle, while your soft skills represent the width. The area of this rectangle corresponds to your probability of landing a job. The larger the area, the better your chances of finding a gig that suits your skillset.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Wh7EFIx5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vvr3rscngigei1wqg9fo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wh7EFIx5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vvr3rscngigei1wqg9fo.png" alt="job probability" width="800" height="488"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This means the equation for your job probability is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hard_skills * soft_skills = job_probability
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To maximize &lt;code&gt;job_probability&lt;/code&gt; with the least amount of effort, spend more time on whichever skill you tend to lack. The area of a square is larger than the area of a lopsided rectangle with the same perimeter.&lt;/p&gt;

&lt;h2&gt;
  
  
  The misconception of limited skill points
&lt;/h2&gt;

&lt;p&gt;If you're thinking this sounds a bit like a Dungeons &amp;amp; Dragons character sheet where you have a limited number of skill points to allocate, that's not how the real world works. In the real world, you can just &lt;em&gt;get more skill points&lt;/em&gt;. You can excel in both hard and soft skills.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I've worked with amazing people who are easy to get along with and are brilliant programmers&lt;/li&gt;
&lt;li&gt;I've also worked with incompetent jerks who are somehow also bad at writing code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you work hard and do your best, you can be both a great programmer and a great person. It's not an either-or situation. In the immortal words of Shia LaBeouf, "Just do it!"&lt;/p&gt;

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

</description>
      <category>learning</category>
      <category>jobs</category>
      <category>jobsearch</category>
      <category>learntocode</category>
    </item>
    <item>
      <title>As a Developer, What Hardware Do You Truly Need?</title>
      <dc:creator>Lane Wagner</dc:creator>
      <pubDate>Fri, 21 Apr 2023 14:37:53 +0000</pubDate>
      <link>https://dev.to/bootdotdev/as-a-developer-what-hardware-do-you-truly-need-1ih5</link>
      <guid>https://dev.to/bootdotdev/as-a-developer-what-hardware-do-you-truly-need-1ih5</guid>
      <description>&lt;p&gt;Let's be real here: we live in an age where everyone and their dog seems to think they need the latest, most expensive gadgets to get anything done. But when it comes to &lt;a href="https://boot.dev"&gt;learning how to code&lt;/a&gt;, do you really need that shiny, wallet-draining powerhouse of a machine?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nope.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's chat about the hardware you need to get started with coding, and dispel the myth that you need to spend a fortune on your setup like a Macbook-toting &lt;a href="https://www.urbandictionary.com/define.php?term=Soydev"&gt;soydev&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory: The real MVP
&lt;/h2&gt;

&lt;p&gt;RAM (Random Access Memory) is where it's at, and this is where you're not going to want to cheap out. If you're not familiar with what RAM does, let me give you the lowdown.&lt;/p&gt;

&lt;p&gt;RAM is the temporary storage your computer uses to maintain the data it needs to run apps. More RAM means you can run more apps simultaneously, which is super important when you're coding, because you'll likely have a bunch of programs open at once. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text editor&lt;/li&gt;
&lt;li&gt;Web browser with 50+ tabs (guilty!)&lt;/li&gt;
&lt;li&gt;Terminal&lt;/li&gt;
&lt;li&gt;Slack&lt;/li&gt;
&lt;li&gt;Discord&lt;/li&gt;
&lt;li&gt;Spotify&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Opening files: When you open a file, the data is loaded into RAM, so having more of it means you can open larger files without your machine choking.&lt;/p&gt;

&lt;p&gt;Compiling code: Compiling is the process of turning your code into an executable program. This can be a memory-intensive operation, especially for larger projects. More RAM helps speed up the process.&lt;/p&gt;

&lt;p&gt;For most use cases, you probably won't want less than 4GB of RAM. There isn't a true minimum, because, depending on the programs you use, you can get away with quite little, but if you can get 8 you'll be in a good place, and 16+ will feel like a dream.&lt;/p&gt;

&lt;h2&gt;
  
  
  CPU: Nothing too wild
&lt;/h2&gt;

&lt;p&gt;The CPU (Central Processing Unit) is the brain of your computer, executing instructions and performing calculations.&lt;/p&gt;

&lt;p&gt;It might seem counter-intuitive, but a powerful CPU isn't always necessary for coding. As long as your editors and day-to-day apps aren't lagging, you're going to be fine. Remember, a good CPU won't make the programs you write any faster. You need great hardware for running in production, but not necessarily for development.&lt;/p&gt;

&lt;p&gt;So, while a good CPU can certainly help, you don't &lt;em&gt;need&lt;/em&gt; the latest, most powerful CPU to get started. A mid-range processor from the last few years should be more than enough for most coding tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hard Drive: SSDs slap hard
&lt;/h2&gt;

&lt;p&gt;You'll just save so much time when you start up your computer and load applications if you have a solid-state drive (SSD). SSDs are faster than traditional magnetic (spinning disk) hard drives, and they're also more reliable.&lt;/p&gt;

&lt;p&gt;You don't &lt;em&gt;need&lt;/em&gt; one, but you'll be much more productive if you have one. As far as storage space goes, I would hesitate to ever go below 256 GB, just because you'll probably have a lot of apps and data on your local device. That said, if you can get a full TB of storage you'll be in a fantastic place.&lt;/p&gt;

&lt;h2&gt;
  
  
  GPU: Nice, but far from necessary
&lt;/h2&gt;

&lt;p&gt;The GPU (Graphics Processing Unit) is another piece of hardware you might be curious about. But unlike RAM, a powerful GPU isn't always necessary for coding.&lt;/p&gt;

&lt;p&gt;The GPU is responsible for rendering images, animations, and other visual elements on your screen. While it's &lt;em&gt;critical&lt;/em&gt; for tasks like gaming and video editing, coding web apps usually doesn't require much GPU horsepower. That said, here are some tasks that do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Machine learning:&lt;/strong&gt; If you're diving into the world of AI and machine learning, a beefy GPU is your best friend. It'll help you train models faster, allowing you to iterate and improve your algorithms more quickly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Game development:&lt;/strong&gt; If you're creating the next gaming masterpiece, a solid GPU will help you render graphics, run game engines, and test your creations in real-time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;3D rendering:&lt;/strong&gt; For 3D modeling or animation, a powerful GPU will make your life a lot easier by speeding up rendering times.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Peripherals: Keyboards, mice, and monitors
&lt;/h2&gt;

&lt;p&gt;A comfortable keyboard and mouse can make a big difference in your coding experience, but if you're just getting started you probably won't have a strong opinion about what you like yet. You can get started with super cheap stuff and it probably won't hinder your productivity very much. Later on, as you understand your own workflow and preferences, you can invest in a different mouse/keyboard combo.&lt;/p&gt;

&lt;p&gt;As far as monitors go, I would never recommend working with a screen less than 1080p. If you can get a 1440p or 4K monitor, you'll be in a great place. But again, you don't &lt;em&gt;need&lt;/em&gt; a fancy monitor to get started. I know "10x" devs that work with 1, 2, or even 4 monitors, but the truth is you won't know what works best for you until you've been coding for a while. I'd start with a simple single monitor setup, and only make changes if you feel like you need to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using lightweight apps
&lt;/h2&gt;

&lt;p&gt;Now that we've covered the core hardware components, let's talk about the software side of things. Choosing the right tools for coding can make a huge difference in terms of hardware requirements and overall efficiency.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.vim.org/"&gt;Vim&lt;/a&gt; (or &lt;a href="https://neovim.io/s"&gt;NeoVim&lt;/a&gt;) is a prime example of a lightweight tool that doesn't require much in terms of hardware. It's a text editor with a small memory footprint, making it ideal for coding on less powerful machines. But Vim is just one example—there are plenty of other lightweight tools out there, each catering to different programming languages and tasks.&lt;/p&gt;

&lt;p&gt;Lightweight tools put less strain on your system, so you'll experience fewer slowdowns and crashes, even if your hardware isn't top-of-the-line. Since lightweight tools use fewer resources, they generally load and run faster, which means you can write, test, and debug your code more quickly. Generally speaking, if you're happy and efficient using the lighter-weight stuff, there's no reason not to use it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using bloatware
&lt;/h2&gt;

&lt;p&gt;In contrast to lightweight tools, heavier apps like Electron and full-fledged IDEs (Integrated Development Environments) like Visual Studio can consume a &lt;em&gt;lot&lt;/em&gt; more resources. These tools typically offer more features and integrations, which can be helpful for development but also require more memory and processing power. They may also include graphical interfaces and other fancy visual elements, which can further bloat their resource usage.&lt;/p&gt;

&lt;p&gt;Generally speaking, I'd stay as far away as you can from the &lt;em&gt;truly&lt;/em&gt; heavy apps like Visual Studio, Android Studio, and XCode. If it takes 30+ seconds to start up, it's just not going to be fun to work with. Of course, sometimes you can't escape depending on what you're trying to accomplish, but if you can avoid it, do.&lt;/p&gt;

&lt;p&gt;Electron apps are essentially just more browser windows. They work by running web technologies (HTML, CSS, and JavaScript) inside a sandboxed browser. They're certainly not as efficient as command-line tools like Vim, but they're often not as bad as some of the bloaty IDEs listed above. As long as you aren't opening too many of them, and as long as you have a decent amount of RAM, you'll probably be okay.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Memory (RAM) is crucial for running applications, opening files, and compiling code. Aim for at least 8GB, but 16
GB is even better.&lt;/li&gt;
&lt;li&gt;A mid-range CPU should be sufficient, but if you have the budget, this isn't a bad place to spend it.&lt;/li&gt;
&lt;li&gt;An SSD somewhere between 256-1024 GBs will put you in a great spot.&lt;/li&gt;
&lt;li&gt;A great GPU is only important for specific tasks like machine learning, game development, or 3D rendering.&lt;/li&gt;
&lt;li&gt;In terms of performance: command line tools &amp;gt; Electron apps &amp;gt; IDEs.&lt;/li&gt;
&lt;li&gt;If you don't know what you like, start with cheap peripherals and a single 1080p monitor. You can always upgrade later.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The bottom line is that learning to code is possible with a wide range of hardware configurations. It's not about having the most expensive, high-powered machine—it's about understanding what you actually need for the tasks you'll be working on and finding the tools that best suit your needs and budget. At the end of the day, you can realistically learn to code on a Raspberry Pi; you just might have to be a little more patient.&lt;/p&gt;

&lt;p&gt;Don't let hardware be a barrier to entry. Dive into some code, explore your options, and remember that the most important tool in your arsenal is your own determination and curiosity. As they say, necessity is the mother of invention, so let your passion for coding be the driving force behind your success, not the latest shiny gadgets.&lt;/p&gt;

</description>
      <category>hardware</category>
      <category>learning</category>
      <category>codenewbie</category>
      <category>career</category>
    </item>
    <item>
      <title>Do You Need to Blog to Get a Coding Job?</title>
      <dc:creator>Lane Wagner</dc:creator>
      <pubDate>Mon, 17 Apr 2023 14:28:36 +0000</pubDate>
      <link>https://dev.to/bootdotdev/do-you-need-to-blog-to-get-a-coding-job-25gm</link>
      <guid>https://dev.to/bootdotdev/do-you-need-to-blog-to-get-a-coding-job-25gm</guid>
      <description>&lt;p&gt;As the founder of &lt;a href="https://boot.dev"&gt;Boot.dev&lt;/a&gt;, I've worked with countless students who are eager to break into the tech industry. And time and time again, I see the same question pop up: "Do I need to start a blog to get a coding job?"&lt;/p&gt;

&lt;p&gt;It's a valid question. There's a lot of buzz around personal branding and the importance of building an online presence. But as someone who worked (and I guess still works) as a hiring manager, I can tell you that blogs are &lt;em&gt;mostly&lt;/em&gt; overrated.&lt;/p&gt;

&lt;p&gt;Let's break down the pros and cons of blogging as a developer. I'll share my own experiences and insights, and offer some practical tips for those who do choose to start a blog. So if you're wondering whether or not you need to blog to get a coding job, keep reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  You don't need to blog, you should only do it if you enjoy it
&lt;/h2&gt;

&lt;p&gt;Let's start with the most important point: &lt;strong&gt;you don't need to start a blog to get a job as a developer.&lt;/strong&gt; I was the only developer at my last company of roughly 100 engineers that had a blog.&lt;/p&gt;

&lt;p&gt;A blog can certainly help you stand out in a crowded job market, as it has for me, it's absolutely not a requirement. Your skills, experience, and ability to solve problems are ultimately what will get you hired. If you're not interested in blogging or don't enjoy writing, then there's no need to force yourself to do it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Blogging will only help land jobs if you write bangers
&lt;/h2&gt;

&lt;p&gt;Assuming you &lt;em&gt;do&lt;/em&gt; decide to start a blog, it's important to note that not all blog posts are created equal. For a blog to ackchyually help your job search, you need to write amazing content that showcases your expertise and adds &lt;em&gt;new value&lt;/em&gt; to your readers.&lt;/p&gt;

&lt;p&gt;Regurgitating information that can be found elsewhere on the inter-webs net won't do you any favors. Your blog posts need to be original, well-written, and packed with insights that can't be found elsewhere. If you're going to invest time and effort into creating a blog, make sure that you're creating content that's truly worth reading.&lt;/p&gt;

&lt;p&gt;If you're going to start a blog, write content that slaps. Don't waste your time and energy on mediocre stuff that won't get you noticed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Write &lt;em&gt;your&lt;/em&gt; story
&lt;/h3&gt;

&lt;p&gt;If you're gonna write a blog post, make it &lt;em&gt;yours&lt;/em&gt;. No one else should be able to write it better than you. Anyone can explain how a binary tree works for the 42,690th time. But what makes a great blog post is when you share your own experiences and insights.&lt;/p&gt;

&lt;p&gt;If you've worked on a niche problem that you're particularly proud of, write about it. If you have a story about how you or your team overcame a unique challenge, write about it. If you've learned something new or personally changed your mind about something, write about it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tech influencers overestimate the importance of a personal brand
&lt;/h2&gt;

&lt;p&gt;If you spend any time on Twitter or LinkedIn, you've probably seen countless posts from tech-fluencers talking about the importance of building a personal brand. While a personal brand has value in &lt;em&gt;some&lt;/em&gt; scenarios, influencers drastically overestimate the importance of a personal brand when it comes to getting your first job as a developer.&lt;/p&gt;

&lt;p&gt;Vanishingly few real-world (non-twitter) developers have a personal brand. Of the hundreds I've worked with personally, I can count on one hand the number that have a large following online, and that hasn't prevented them from finding success in their careers.&lt;/p&gt;

&lt;p&gt;At the end of the day, what matters is your ability to solve problems, create value for your employer, and prove that you can do so in an interview. If you can tangibly demonstrate those skills, you'll be in good shape. I think these are much better ways to stand out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.boot.dev/jobs/build-github-profile/"&gt;A good portfolio of GitHub projects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Solid open-source contributions&lt;/li&gt;
&lt;li&gt;Networking with other developers at meetups in &lt;a href="https://boot.dev/community"&gt;online communities&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Don't let the hype around personal branding make you feel like you're not doing enough if you don't have a large following on social media. Focus on building skills in order to write amazing code that solves real-world problems. The rest will follow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Learning to write is a valuable communication skill
&lt;/h2&gt;

&lt;p&gt;Personal branding nonsense aside, I &lt;em&gt;do&lt;/em&gt; believe that writing a blog to clarify your thoughts and improve your communication skills is a valuable endeavor.&lt;/p&gt;

&lt;p&gt;Being able to communicate your ideas clearly and concisely in written form can make a big difference in your ability to collaborate with teammates and work on projects effectively. In today's world of Slack, Discord, and other asynchronous communication mediums, being able to articulate your thoughts in writing is a necessity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Should you blog? Meh. Only do it if you like it.
&lt;/h2&gt;

&lt;p&gt;So, do you need to blog to get a coding job? Nope. A blog might help if you write some bangers that skyrocket to the top of Hacker News, but if your posts are fairly average, they probably won't move the needle. Your skills, experience, and ability to solve problems are ultimately what will get you hired.&lt;/p&gt;

&lt;p&gt;All that said, learning to write effectively is still an immensely valuable skill for any developer. Being able to communicate your ideas clearly and concisely in written form can make a big difference in your ability to collaborate with teammates and work on projects effectively. So, if you enjoy writing, I'd encourage you to write to be &lt;em&gt;a great writer and to write useful things&lt;/em&gt;, not to be an "influencer".&lt;/p&gt;

&lt;p&gt;Don't stress too much about building a personal brand or starting a blog. Focus on building real skills and creating value through code, and the rest will follow. If you do decide to start a blog, make sure that you're writing articles that &lt;strong&gt;slap&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>coding</category>
      <category>job</category>
      <category>career</category>
      <category>writing</category>
    </item>
    <item>
      <title>Complete Python Tutorial for Absolute Beginners in 2023</title>
      <dc:creator>Lane Wagner</dc:creator>
      <pubDate>Tue, 04 Apr 2023 12:45:00 +0000</pubDate>
      <link>https://dev.to/bootdotdev/complete-python-tutorial-for-absolute-beginners-in-2023-5ain</link>
      <guid>https://dev.to/bootdotdev/complete-python-tutorial-for-absolute-beginners-in-2023-5ain</guid>
      <description>&lt;p&gt;Python is an unbelievably powerful programming language that is used by millions of developers in production systems around the world. It's easy to learn, free to use, and has a huge community of developers that are always willing to help.&lt;/p&gt;

&lt;p&gt;If you're interested in &lt;a href="https://blog.boot.dev/backend/become-backend-developer/"&gt;back-end web development&lt;/a&gt;, data science, &lt;a href="https://blog.boot.dev/backend/backend-engineer-vs-data-engineer/"&gt;data engineering&lt;/a&gt;, or just want to automate some of your boring tasks, Python is a great place to start.&lt;/p&gt;

&lt;h2&gt;
  
  
  Would you rather learn by doing?
&lt;/h2&gt;

&lt;p&gt;I've included all the static read-only material you'll need here in this tutorial, but if you would like a &lt;strong&gt;more hands-on experience&lt;/strong&gt;, you can take the interactive version of this course, complete with coding challenges and projects on &lt;a href="https://boot.dev/learn/learn-python"&gt;Boot.dev here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 1: Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GdQaHm1Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/s2j2b4e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GdQaHm1Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://i.imgur.com/s2j2b4e.png" alt="python" width="400" height="100"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thousands of students start their coding journey right here with Python. We think it's the best programming language to get started with. Python is famous for being a simple language that's easy to read and write.&lt;/p&gt;

&lt;p&gt;However, just because it's simple that doesn't mean it's not useful! Python is an &lt;em&gt;extremely&lt;/em&gt; popular language in the industry, and is well-known for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Backend web servers&lt;/li&gt;
&lt;li&gt;DevOps and cloud engineering&lt;/li&gt;
&lt;li&gt;Machine learning&lt;/li&gt;
&lt;li&gt;Scripting and automation&lt;/li&gt;
&lt;li&gt;etc...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the other hand, it's not particularly well-known for front-end work. While it's &lt;em&gt;possible&lt;/em&gt; to do so, Python isn't typically used to build visual user interfaces.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setup a Local Development Environment
&lt;/h3&gt;

&lt;p&gt;To get started with Python, you'll need to install the &lt;code&gt;python&lt;/code&gt; command on your computer, and then install a text editor or IDE. If you're not already familiar with how to do that, I have a full step-by-step &lt;a href="https://boot.dev/build/build-local-dev-environment-python"&gt;project guide here&lt;/a&gt; that you can follow.&lt;/p&gt;

&lt;p&gt;If you're able to edit and run Python code on your computer, you're ready to continue!&lt;/p&gt;

&lt;h3&gt;
  
  
  What is "Code"?
&lt;/h3&gt;

&lt;p&gt;Code is just a series of instructions that computers can follow. Computers obey each instruction, &lt;em&gt;one after another&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Programs can be comprised of &lt;em&gt;many&lt;/em&gt; instructions. Like many. Like millions.&lt;/p&gt;

&lt;p&gt;Addition is one of the most common instructions in coding.&lt;/p&gt;

&lt;h3&gt;
  
  
  Printing numbers
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;print()&lt;/code&gt; can print text using quotes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"some text here"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but it can also print numbers without quotes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and you can do math directly inside the parentheses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try some of these code snippets in your editor! For example, you could create a file called &lt;code&gt;hello.py&lt;/code&gt; and write the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, world!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, run the file with &lt;code&gt;python hello.py&lt;/code&gt; and see what happens.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multiple Instructions
&lt;/h3&gt;

&lt;p&gt;Code runs in order, starting at the top of the program. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"this prints first"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"this prints second"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"this prints last"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Syntax Errors
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Syntax_(programming_languages)"&gt;Syntax&lt;/a&gt; is jargon for "valid code that the computer can understand". For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;prnt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hello world"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;is invalid &lt;a href="https://en.wikipedia.org/wiki/Syntax_(programming_languages)"&gt;syntax&lt;/a&gt; because &lt;code&gt;prnt()&lt;/code&gt; is not a valid function, "print" is spelled incorrectly. As a result, an error will be thrown and the code won't execute.&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntax varies from langauge to language
&lt;/h3&gt;

&lt;p&gt;A coding language's syntax makes up the rules that define what properly structured expressions and statements look like in that language. For example, in Python, the following would be considered &lt;em&gt;correct&lt;/em&gt; syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hello world"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While in a different programming language, like Go, the correct syntax would be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hello world"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Code can have many different problems that prevent it from working as intended. Some examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A bug in the logic. For example, a program that should add numbers multiplies them instead&lt;/li&gt;
&lt;li&gt;A problem with speed. A program that calculates how to play the perfect game of chess might never be able to finish because it requires too many calculations.&lt;/li&gt;
&lt;li&gt;A problem with syntax. This is the most common problem for new developers. Luckily the Python interpreter will try to give you a descriptive error message in the console to help you find the problem.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Chapter 2: Variables
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.cs.utah.edu/~germain/PPS/Topics/variables.html"&gt;Variables&lt;/a&gt; are how we store data in our program. So far we've been directly printing data by passing it directly into the &lt;code&gt;print()&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;Now we are going to learn to save the data in variables so we can use and change it before we need to print it.&lt;/p&gt;

&lt;p&gt;A variable is a name that we define that will point to some data. For example, I could define a new variable called &lt;code&gt;my_height&lt;/code&gt; and set its value to 100. I could also define a variable called &lt;code&gt;my_name&lt;/code&gt; and set it equal to "Lane".&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating variables
&lt;/h3&gt;

&lt;p&gt;To create a new variable in Python we use the following syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;my_new_variable_two&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="n"&gt;this_can_be_called_anything&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Variables Vary
&lt;/h3&gt;

&lt;p&gt;Variables are called "variables" because they can hold any value and that value can change (it varies).&lt;/p&gt;

&lt;p&gt;For example, the following will print &lt;code&gt;20&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;acceleration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;acceleration&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acceleration&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The line &lt;code&gt;acceleration = 20&lt;/code&gt; &lt;em&gt;reassigns&lt;/em&gt; the value of &lt;code&gt;acceleration&lt;/code&gt; to 20. It &lt;em&gt;overwrites&lt;/em&gt; whatever was being held in the &lt;code&gt;acceleration&lt;/code&gt; variable before.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let's do some math
&lt;/h3&gt;

&lt;p&gt;Now that we know how to store and change the value of variables let's do some math!&lt;/p&gt;

&lt;p&gt;Here are some examples of common mathematical operators in Python syntax.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nb"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;span class="n"&gt;difference&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;span class="n"&gt;product&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;span class="n"&gt;quotient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Comments
&lt;/h3&gt;

&lt;p&gt;Comments don't run like code, they are &lt;em&gt;ignored&lt;/em&gt; by the computer. Comments are useful for adding reminders or explaining what a piece of code does in plain English.&lt;/p&gt;

&lt;h4&gt;
  
  
  Single line comment
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# speed is a variable describing how fast your player moves
&lt;/span&gt;&lt;span class="n"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Multi-line comments (aka docstrings)
&lt;/h4&gt;

&lt;p&gt;You can use triple quotes to start and end multi-line comments as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="s"&gt;"""
    the code found below 
    will print 'Hello, World!' to the console
"""&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Hello, World!'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is useful if you don't want to add the &lt;code&gt;#&lt;/code&gt; to the start of each line when writing paragraphs of comments.&lt;/p&gt;

&lt;h3&gt;
  
  
  Variable Names
&lt;/h3&gt;

&lt;p&gt;Variable names can't have spaces, they're continuous strings of characters.&lt;/p&gt;

&lt;p&gt;In Python you should use "&lt;a href="https://blog.boot.dev/clean-code/casings-in-coding/"&gt;snake_case&lt;/a&gt;" when creating variable names - it's become the "rule of thumb" for the language. By way of comparison, "camel case" is where the beginning of each new word except the first is capitalized.&lt;/p&gt;

&lt;h4&gt;
  
  
  No casing (pure insanity)
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;somevariablehere&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Camel Case
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;someVariableHere&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Snake Case
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;some_variable_here&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Basic Variable Types
&lt;/h3&gt;

&lt;p&gt;In Python there are several basic data types.&lt;/p&gt;

&lt;h4&gt;
  
  
  String Type
&lt;/h4&gt;

&lt;p&gt;"Strings" are raw text in coding speak. They are called "strings" because they are a list of characters strung together. Strings are declared in Python by using single quotes or double quotes. That said, for consistency's sake, we prefer double quotes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;name_with_single_quotes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'boot.dev'&lt;/span&gt;
&lt;span class="n"&gt;name_with_double_quotes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"boot.dev"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Numeric Types
&lt;/h4&gt;

&lt;p&gt;Numbers aren't surrounded by quotes when created, but they can have decimals and negative signs.&lt;/p&gt;

&lt;h4&gt;
  
  
  Integers are numbers without a decimal
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  A "Float" is a number with a decimal
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;5.2&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;5.2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Boolean Type
&lt;/h4&gt;

&lt;p&gt;A "Boolean" (or "bool") is a type that can only have one of two values: &lt;code&gt;True&lt;/code&gt; or &lt;code&gt;False&lt;/code&gt;. As you may have heard computers really only use 1's and 0's. These 1's and 0's are just &lt;code&gt;Boolean&lt;/code&gt; values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 = False
1 = True
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;is_tall&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  NoneType Variables
&lt;/h3&gt;

&lt;p&gt;Not all variables have a value. We can declare an "empty" variable by setting it to &lt;code&gt;None&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;empty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The value of &lt;code&gt;empty&lt;/code&gt; in this instance is &lt;code&gt;None&lt;/code&gt; until we use the assignment operator, &lt;code&gt;=&lt;/code&gt;, to give it a value.&lt;/p&gt;

&lt;h4&gt;
  
  
  None is NOT a specific string
&lt;/h4&gt;

&lt;p&gt;Note that the &lt;code&gt;None&lt;/code&gt; type is &lt;em&gt;not&lt;/em&gt; the same as a string with a value of "None":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;my_none&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt; &lt;span class="c1"&gt;# this is a None-type
&lt;/span&gt;&lt;span class="n"&gt;my_none&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"None"&lt;/span&gt; &lt;span class="c1"&gt;# this is a string
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Dynamic Typing
&lt;/h3&gt;

&lt;p&gt;Python is &lt;a href="https://en.wikipedia.org/wiki/Type_system#Static_and_dynamic_type_checking_in_practice"&gt;dynamically typed&lt;/a&gt;. All this means is that a variable can store any type, and that type can change.&lt;/p&gt;

&lt;p&gt;For example, if I make a number variable, I can later change that variable to a string:&lt;/p&gt;

&lt;p&gt;This is valid:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="n"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"five"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Just because you can doesn't mean you should!
&lt;/h4&gt;

&lt;p&gt;In almost all circumstances, it's a &lt;em&gt;bad idea&lt;/em&gt; to change the type of a variable. The "proper" thing to do is to just create a new one. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;speed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="n"&gt;speed_description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"five"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  What if it weren't dynamically typed?
&lt;/h4&gt;

&lt;p&gt;Statically typed languages like Go (which you'll learn in a later course) are statically typed instead of dynamically typed. In a statically typed language, if you try to assign a value to a variable of the wrong type, an error would crash the program.&lt;/p&gt;

&lt;p&gt;If Python were statically-typed, the first example from before would crash on the second line, &lt;code&gt;speed = "five"&lt;/code&gt;. The computer would give an error along the lines of &lt;code&gt;you can't assign a string value ("five") to a number variable (speed)&lt;/code&gt;&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Math With Strings
&lt;/h3&gt;

&lt;p&gt;Most of the math operators we went over earlier don't work with strings, aside from the &lt;code&gt;+&lt;/code&gt; addition operator. When working with strings the &lt;code&gt;+&lt;/code&gt; operator performs a "concatenation".&lt;/p&gt;

&lt;p&gt;"Concatenation" is a fancy word that means the joining of two strings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;first_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Lane "&lt;/span&gt;
&lt;span class="n"&gt;last_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Wagner"&lt;/span&gt;
&lt;span class="n"&gt;full_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;first_name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;last_name&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;full_name&lt;/code&gt; now holds the value "Lane Wagner".&lt;/p&gt;

&lt;p&gt;Notice the extra space at the end of &lt;code&gt;"Lane "&lt;/code&gt; in the &lt;code&gt;first_name&lt;/code&gt; variable. That extra space is there to separate the words in the final result: &lt;code&gt;"Lane Wagner"&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multi-Variable Declaration
&lt;/h3&gt;

&lt;p&gt;We can save space when creating many new variables by declaring them on the same line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;sword_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sword_damage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sword_length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Excalibur"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which is the same as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;sword_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Excalibur"&lt;/span&gt;
&lt;span class="n"&gt;sword_damage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;sword_length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Any number of variables can be declared on the same line, and variables declared on the same line &lt;em&gt;should&lt;/em&gt; be related to one another in some way so that the code remains easy to understand.&lt;/p&gt;

&lt;p&gt;We call code that's easy to understand "clean code".&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 2: Computing Basics
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Python Numbers
&lt;/h3&gt;

&lt;p&gt;In Python, numbers without a decimal part are called &lt;code&gt;Integers&lt;/code&gt; - just like they are in mathematics.&lt;/p&gt;

&lt;p&gt;Integers are simply whole numbers, positive or negative. For example, &lt;code&gt;3&lt;/code&gt; and &lt;code&gt;-3&lt;/code&gt; are both examples of integers.&lt;/p&gt;

&lt;p&gt;Arithmetic can be performed as you might expect:&lt;/p&gt;

&lt;h4&gt;
  
  
  Addition
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="c1"&gt;# 3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Subtraction
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="c1"&gt;# 1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Multiplication
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="c1"&gt;# 4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Division
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="c1"&gt;# 1.5 (a float)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This one is actually a bit different - division on two integers will actually produce a &lt;code&gt;float&lt;/code&gt;. A float is, as you may have guessed, the number type that allows for decimal values.&lt;/p&gt;

&lt;h3&gt;
  
  
  Integers
&lt;/h3&gt;

&lt;p&gt;In Python, numbers without a decimal part are called &lt;code&gt;Integers&lt;/code&gt;. Contrast this to JavaScript where all numbers are just a &lt;code&gt;Number&lt;/code&gt; type.&lt;/p&gt;

&lt;p&gt;Integers are simply whole numbers, positive or negative. For example, &lt;code&gt;3&lt;/code&gt; and &lt;code&gt;-3&lt;/code&gt; are both examples of integers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Floats
&lt;/h3&gt;

&lt;p&gt;A float is, as you may have guessed, the number type that allows for decimal values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;my_int&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="n"&gt;my_float&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;5.5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Floor division
&lt;/h3&gt;

&lt;p&gt;Python has great out-of-the-box support for mathematical operations. This, among other reasons, is why it has had such success in artificial intelligence, machine learning, and data science applications.&lt;/p&gt;

&lt;p&gt;Floor division is like normal division except the result is &lt;a href="https://en.wikipedia.org/wiki/Floor_and_ceiling_functions"&gt;floored&lt;/a&gt; afterward, which means the remainder is &lt;em&gt;removed&lt;/em&gt;. As you would expect, this means the result is an &lt;code&gt;integer&lt;/code&gt; instead of a &lt;code&gt;float&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="mi"&gt;7&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="c1"&gt;# 2 (an integer)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h3&gt;
  
  
  Exponents
&lt;/h3&gt;

&lt;p&gt;Python has built-in support for exponents - something most languages require a &lt;code&gt;math&lt;/code&gt; library for.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# reads as "three squared" or
# "three raised to the second power"
&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="c1"&gt;# 9
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h3&gt;
  
  
  Changing In Place
&lt;/h3&gt;

&lt;p&gt;It's fairly common to want to change the value of a variable based on its current value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;player_score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="n"&gt;player_score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;player_score&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="c1"&gt;# player_score now equals 5
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;player_score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="n"&gt;player_score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;player_score&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="c1"&gt;# player_score now equals 3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don't let the fact that the expression &lt;code&gt;player_score = player_score - 1&lt;/code&gt; is not a valid mathematical expression be confusing. &lt;em&gt;It doesn't matter&lt;/em&gt;, it &lt;em&gt;is valid code&lt;/em&gt;. It's valid because the way the expression should be read in English is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Assign to player_score the old value of player_score minus 1&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Plus Equals
&lt;/h3&gt;

&lt;p&gt;Python makes reassignment easy when doing math. In JavaScript or Go you might be familiar with the &lt;code&gt;++&lt;/code&gt; syntax for incrementing a number variable. In Python, we use the &lt;code&gt;+=&lt;/code&gt; operator instead.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;star_rating&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="n"&gt;star_rating&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="c1"&gt;# star_rating is now 5
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Scientific Notation
&lt;/h3&gt;

&lt;p&gt;As we covered earlier, a &lt;code&gt;float&lt;/code&gt; is a positive or negative number &lt;strong&gt;with a fractional part&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You can add the letter &lt;code&gt;e&lt;/code&gt; or &lt;code&gt;E&lt;/code&gt; followed by a positive or negative integer to specify that you're using &lt;a href="https://en.wikipedia.org/wiki/Scientific_notation"&gt;scientific notation&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;16e3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints 16000.0
&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;7.1e-2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints 0.071
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're not familiar with scientific notation, it's a way of expressing numbers that are too large or too small to conveniently write normally.&lt;/p&gt;

&lt;p&gt;In a nutshell, the number following the &lt;code&gt;e&lt;/code&gt; specifies how many places to move the decimal to the right for a positive number, or to the left for a negative number.&lt;/p&gt;

&lt;h3&gt;
  
  
  Underscores for readability
&lt;/h3&gt;

&lt;p&gt;Python also allows you to represent large numbers in the decimal format using underscores instead of commas to make it easier to read.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;16_000&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints 16000
&lt;/span&gt;
&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;16_000_000&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints 16000000
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Logical Operators
&lt;/h3&gt;

&lt;p&gt;You're probably familiar with the logical operators &lt;code&gt;AND&lt;/code&gt; and &lt;code&gt;OR&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Logical operators deal with &lt;a href="https://en.wikipedia.org/wiki/Boolean_data_type"&gt;boolean values&lt;/a&gt;, &lt;code&gt;True&lt;/code&gt; and &lt;code&gt;False&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The logical &lt;code&gt;AND&lt;/code&gt; operator requires that &lt;em&gt;both&lt;/em&gt; inputs are &lt;code&gt;True&lt;/code&gt; to return &lt;code&gt;True&lt;/code&gt;. The logical &lt;code&gt;OR&lt;/code&gt; operator only requires that &lt;em&gt;at least one&lt;/em&gt; input is &lt;code&gt;True&lt;/code&gt; to return &lt;code&gt;True&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;True AND True = True
True AND False = False
False AND False = False

True OR True = True
True OR False = True
False OR False = False
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Python Syntax
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# prints True
&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# prints True
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Nesting with parentheses
&lt;/h4&gt;

&lt;p&gt;We can nest logical expressions using parentheses.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First, we evaluate the expression in the parentheses, &lt;code&gt;(True or False)&lt;/code&gt;. It evaluates to &lt;code&gt;True&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;True and False&lt;/code&gt; evaluates to &lt;code&gt;False&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, &lt;code&gt;print((True or False) and False)&lt;/code&gt; prints "False" to the console.&lt;/p&gt;

&lt;h3&gt;
  
  
  Binary Numbers
&lt;/h3&gt;

&lt;p&gt;Binary numbers are just "base 2" numbers. They work the same way as "normal" base 10 numbers, but with 2 symbols instead of 10.&lt;/p&gt;

&lt;p&gt;Each &lt;code&gt;1&lt;/code&gt; in a binary number represents a greater multiple of 2. In a 4-digit number, that means you have the eight's place, the four's place, the two's place, and the one's place. Similar to how in decimal you would have the thousandth's place, the hundredth's place, the ten's place, and the one's place.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;0001&lt;/code&gt; = 1&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0010&lt;/code&gt; = 2&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0011&lt;/code&gt; = 3&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0100&lt;/code&gt; = 4&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0101&lt;/code&gt; = 5&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0110&lt;/code&gt; = 6&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0111&lt;/code&gt; = 7&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;1000&lt;/code&gt; = 8&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iHWX45lN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://www.wikihow.com/images/4/47/B2d.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iHWX45lN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://www.wikihow.com/images/4/47/B2d.gif" alt="binary" width="400" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Bitwise "&amp;amp;" Operator
&lt;/h3&gt;

&lt;p&gt;Bitwise operators are similar to logical operators, but instead of operating on boolean values, they apply the same logic to all the bits in a value. For example, say you had the numbers &lt;code&gt;5&lt;/code&gt; and &lt;code&gt;7&lt;/code&gt; represented in &lt;a href="https://en.wikipedia.org/wiki/Binary_code"&gt;binary&lt;/a&gt;. You could perform a bitwise &lt;code&gt;AND&lt;/code&gt; operation and the result would be &lt;code&gt;5&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0101 = 5
&amp;amp;
0111 = 7
=
0101 = 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;code&gt;1&lt;/code&gt; in binary is the same as &lt;code&gt;True&lt;/code&gt;, while &lt;code&gt;0&lt;/code&gt; is &lt;code&gt;False&lt;/code&gt;. So really a bitwise operation is just a bunch of logical operations that are completed in tandem.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;amp;&lt;/code&gt; is the bitwise &lt;code&gt;AND&lt;/code&gt; operator in Python. &lt;code&gt;5 &amp;amp; 7 = 5&lt;/code&gt;, while &lt;code&gt;5 &amp;amp; 2 = 0&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0101 = 5
&amp;amp;
0010 = 2
=
0000 = 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Binary notation
&lt;/h3&gt;

&lt;p&gt;When writing a number in binary, the prefix &lt;code&gt;0b&lt;/code&gt; is used to indicate that what follows is a binary number.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;0b0101&lt;/code&gt; is 5&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0b0111&lt;/code&gt; is 7&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example: Guild Permissions
&lt;/h3&gt;

&lt;p&gt;It's common practice in backend development to store user permissions as binary values. Think about it, if I have &lt;code&gt;4&lt;/code&gt; different permissions a user can have, then I can store that as a 4-digit binary number, and if a certain bit is present, I know the permission is enabled.&lt;/p&gt;

&lt;p&gt;Let's pretend we have 4 permissions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;can_create_guild&lt;/code&gt; - Leftmost bit&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;can_review_guild&lt;/code&gt; - Second to left bit&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;can_delete_guild&lt;/code&gt; - Second to right bit&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;can_edit_guild&lt;/code&gt; - Rightmost bit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which are represented by &lt;code&gt;0b0000&lt;/code&gt;. For example, if a user only has the &lt;code&gt;can_create_guild&lt;/code&gt; permission, their binary permissions would be &lt;code&gt;0b1000&lt;/code&gt;. A user with &lt;code&gt;can_review_guild&lt;/code&gt; and &lt;code&gt;can_edit_guild&lt;/code&gt; would be &lt;code&gt;0b0101&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To check for, say, the &lt;code&gt;can_review_guild&lt;/code&gt; permission, we can perform a bitwise &lt;code&gt;AND&lt;/code&gt; operation on the user's permissions and the enabled &lt;code&gt;can_review_guild&lt;/code&gt; bit (&lt;code&gt;0b0100&lt;/code&gt;). If the result is &lt;code&gt;0b0100&lt;/code&gt; again, we know they have that specific permission!&lt;/p&gt;

&lt;h3&gt;
  
  
  Bitwise "|" Operator
&lt;/h3&gt;

&lt;p&gt;As you may have guessed, the bitwise "or" operator is similar to the bitwise "and" operator in that it works on binary rather than boolean values. However, the bitwise "or" operator "ORs" the bits together. Here's an example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;0101&lt;/code&gt; is 5&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0111&lt;/code&gt; is 7
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0101
|     
0111
=
0111
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;code&gt;1&lt;/code&gt; in binary is the same as &lt;code&gt;True&lt;/code&gt;, while &lt;code&gt;0&lt;/code&gt; is &lt;code&gt;False&lt;/code&gt;. So a bitwise operation is just a bunch of logical operations that are completed in tandem. When two binary numbers are "OR'ed" together, the result has a &lt;code&gt;1&lt;/code&gt; in any place where &lt;em&gt;either&lt;/em&gt; of the input numbers has a &lt;code&gt;1&lt;/code&gt; in that place.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;|&lt;/code&gt; is the bitwise &lt;code&gt;OR&lt;/code&gt; operator in Python. &lt;code&gt;5 | 7 = 7&lt;/code&gt; and &lt;code&gt;5 | 2 = 7&lt;/code&gt; as well!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0101 = 5
|
0010 = 2
=
0111 = 7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Not
&lt;/h3&gt;

&lt;p&gt;We skipped a very important logical operator - &lt;code&gt;not&lt;/code&gt;. The &lt;code&gt;not&lt;/code&gt; operator reverses the result. It returns &lt;code&gt;False&lt;/code&gt; if the input was &lt;code&gt;True&lt;/code&gt; and vice-versa.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: False
&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: True
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Chapter 3: Comparisons
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Comparison Operators
&lt;/h3&gt;

&lt;p&gt;When coding it's necessary to be able to compare two values. &lt;code&gt;Boolean logic&lt;/code&gt; is the name for these kinds of comparison operations that always result in &lt;code&gt;True&lt;/code&gt; or &lt;code&gt;False&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The operators:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;&lt;/code&gt; "less than"&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;gt;&lt;/code&gt; "greater than"&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;=&lt;/code&gt; "less than or equal to"&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;gt;=&lt;/code&gt; "greater than or equal to"&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;==&lt;/code&gt; "equal to"&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;!=&lt;/code&gt; "not equal to"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="c1"&gt;# evaluates to True
&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="c1"&gt;# evaluates to False
&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="c1"&gt;# evaluates to False
&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="c1"&gt;# evaluates to True
&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="c1"&gt;# evaluates to False
&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="c1"&gt;# evaluates to True
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h3&gt;
  
  
  Evaluations
&lt;/h3&gt;

&lt;p&gt;When a comparison happens, the result of the comparison is just a boolean value, it's either &lt;code&gt;True&lt;/code&gt; or &lt;code&gt;False&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Take the following two examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;is_bigger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;is_bigger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In both of the above cases, we're creating a &lt;code&gt;Boolean&lt;/code&gt; variable called &lt;code&gt;is_bigger&lt;/code&gt; with a value of &lt;code&gt;True&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Since &lt;code&gt;5 &amp;gt; 4&lt;/code&gt;, &lt;code&gt;is_bigger&lt;/code&gt; is always assigned the value of &lt;code&gt;True&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why would I use the comparison if I can just set it to "True"?
&lt;/h3&gt;

&lt;p&gt;You wouldn't in &lt;em&gt;this&lt;/em&gt; case. However, let's imagine that instead of hard-coding the numbers &lt;code&gt;5&lt;/code&gt; and &lt;code&gt;4&lt;/code&gt;, we had some &lt;em&gt;dynamic&lt;/em&gt; variables that we don't know the values of. For example, perhaps you're making a video game and need to keep track of player scores.&lt;/p&gt;

&lt;p&gt;To calculate who wins, you would need to write something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# player_one_points and player_two_points are defined and change somewhere else in the game's code
&lt;/span&gt;&lt;span class="n"&gt;player_one_wins&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;player_one_points&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;player_two_points&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;player_one_wins&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# prints "True" when player one is winning, otherwise prints "False"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Increment / Decrement
&lt;/h3&gt;

&lt;p&gt;If we're changing a number and simply want to increment (add to) or decrement (subtract from) there are special operators for that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;shield_armor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="n"&gt;shield_armor&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="c1"&gt;# shield_armor now equals 5
&lt;/span&gt;&lt;span class="n"&gt;shield_armor&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="c1"&gt;# shield_armor now equals 7
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;shield_armor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="n"&gt;shield_armor&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="c1"&gt;# shield_armor now equals 3
&lt;/span&gt;&lt;span class="n"&gt;shield_armor&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="c1"&gt;# shield_armor now equals 1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice that &lt;code&gt;shield_armor+=1&lt;/code&gt; is just short-hand for &lt;code&gt;shield_armor = shield_armor + 1&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  If Statements
&lt;/h3&gt;

&lt;p&gt;It's often useful to only execute code if a certain condition is met:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;CONDITION&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# do some stuff here
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;bob_score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;bill_score&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Bob Wins!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  If-Else
&lt;/h3&gt;

&lt;p&gt;An &lt;code&gt;if&lt;/code&gt; statement can be followed by zero or more &lt;code&gt;elif&lt;/code&gt; (which stands for "else if") statements, which can be followed by zero or one &lt;code&gt;else&lt;/code&gt; statement. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;high_Score&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'High score beat!'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;second_highest_score&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'You got second place!'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;third_highest_score&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'You got third place!'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Better luck next time'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First the &lt;code&gt;if&lt;/code&gt; statement is evaluated. If it is &lt;code&gt;True&lt;/code&gt; then the if statement's body is executed and all the other &lt;code&gt;else&lt;/code&gt;s are ignored.&lt;/p&gt;

&lt;p&gt;If the first &lt;code&gt;if&lt;/code&gt; is false then the next &lt;code&gt;elif&lt;/code&gt; is evaluated. Likewise, if it is &lt;code&gt;True&lt;/code&gt; then its body is executed and the rest are ignored.&lt;/p&gt;

&lt;p&gt;If none of the &lt;code&gt;if&lt;/code&gt; statements evaluate to &lt;code&gt;True&lt;/code&gt; then the final &lt;code&gt;else&lt;/code&gt; statement will be the only body executed.&lt;/p&gt;

&lt;h3&gt;
  
  
  If-Else Rules
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You can't have an &lt;code&gt;elif&lt;/code&gt; or an &lt;code&gt;else&lt;/code&gt; without an &lt;code&gt;if&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;You &lt;em&gt;can&lt;/em&gt; have an &lt;code&gt;else&lt;/code&gt; without an &lt;code&gt;elif&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Chapter 5: Loops
&lt;/h2&gt;

&lt;p&gt;Loops are a programmer's best friend. Loops allow us to do the same operation multiple times without having to write it explicitly each time.&lt;/p&gt;

&lt;p&gt;For example, let's pretend I want to print the numbers 0-9.&lt;/p&gt;

&lt;p&gt;I could do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even so, it would save me a lot of time typing to use a &lt;em&gt;loop&lt;/em&gt;. Especially if I wanted to do the same thing &lt;em&gt;one thousand&lt;/em&gt; or &lt;em&gt;one million&lt;/em&gt; times.&lt;/p&gt;

&lt;p&gt;A &lt;em&gt;"for loop"&lt;/em&gt; in Python is written like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In English, the code says:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Start with &lt;code&gt;i&lt;/code&gt; equals &lt;code&gt;0&lt;/code&gt;. (&lt;code&gt;i in range(0&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;i&lt;/code&gt; is not less than 10 (&lt;code&gt;range(0, 10)&lt;/code&gt;), exit the loop.&lt;/li&gt;
&lt;li&gt;Print &lt;code&gt;i&lt;/code&gt; to the console. (&lt;code&gt;print(i)&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;1&lt;/code&gt; to &lt;code&gt;i&lt;/code&gt;. (&lt;code&gt;range&lt;/code&gt; defaults to incrementing by 1)&lt;/li&gt;
&lt;li&gt;Go back to step &lt;code&gt;2&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The result is that the numbers &lt;code&gt;0-9&lt;/code&gt; are logged to the console in order.&lt;/p&gt;

&lt;h3&gt;
  
  
  Whitespace matters in Python!
&lt;/h3&gt;

&lt;p&gt;The body of a for-loop &lt;em&gt;must&lt;/em&gt; be indented, otherwise you'll get a syntax error.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;

&lt;p&gt;This code print the numbers 0-9 to the console.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Range Continued
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;range()&lt;/code&gt; function we've been using in our &lt;code&gt;for&lt;/code&gt; loops actually has an optional 3rd parameter: the "step".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# prints:
# 0
# 2
# 4
# 6
# 8
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The "step" parameter determines how much to increment &lt;code&gt;i&lt;/code&gt; by in each iteration of the loop. You can even go backwards:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# prints:
# 3
# 2
# 1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  F-strings in Python
&lt;/h3&gt;

&lt;p&gt;You can create a string with dynamic values by using &lt;code&gt;f-strings&lt;/code&gt; in Python. It's a beautiful syntax that I wish more programming languages used.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;num_bananas&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"You have &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;num_bananas&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; bananas"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# You have 10 bananas
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The opening quotes need to be proceeded by an &lt;code&gt;f&lt;/code&gt;, then any variables within curly brackets have their values interpolated into the string.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 6: Lists
&lt;/h2&gt;

&lt;p&gt;A natural way to organize and store data is in the form of a &lt;code&gt;List&lt;/code&gt;. Some languages call them "arrays", but in Python we just call them lists. Think of all the apps you use and how many of the items in the app are organized into lists.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A twitter feed is a list of posts&lt;/li&gt;
&lt;li&gt;An online store is a list of products&lt;/li&gt;
&lt;li&gt;The state of a chess game is a list of moves&lt;/li&gt;
&lt;li&gt;This list is a list of things that are lists&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lists in Python are declared using square brackets, with commas separating each item:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;inventory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"Iron Breastplate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Healing Potion"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Leather Scraps"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Arrays can contain items of any data type, in our example above we have a &lt;code&gt;List&lt;/code&gt; of strings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Vertical syntax
&lt;/h3&gt;

&lt;p&gt;Sometimes when we're manually creating lists it can be hard to read if all the items are on the same line of code. We can declare the array using multiple lines if we want to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;flower_types&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s"&gt;"daffodil"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"rose"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"chrysanthemum"&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep in mind this is just a styling change. The code will run correctly either way.&lt;/p&gt;

&lt;h3&gt;
  
  
  Counting in Programming
&lt;/h3&gt;

&lt;p&gt;In the world of programming, counting is a bit strange!&lt;/p&gt;

&lt;p&gt;We don't start counting at &lt;code&gt;1&lt;/code&gt;, we start at &lt;code&gt;0&lt;/code&gt; instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Indexes
&lt;/h3&gt;

&lt;p&gt;Each item in an array has an index that refers to its spot in the array.&lt;/p&gt;

&lt;p&gt;Take the following array as an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"Bob"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Lane"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Alice"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Breanna"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Index 0: &lt;code&gt;Bob&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Index 1: &lt;code&gt;Lane&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Index 2: &lt;code&gt;Alice&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Index 3: &lt;code&gt;Breanna&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Indexing into Lists
&lt;/h3&gt;

&lt;p&gt;Now that we know how to create new lists, we need to know how to access specific items in the list.&lt;/p&gt;

&lt;p&gt;We access items in a list directly by using their &lt;em&gt;index&lt;/em&gt;. Indexes start at 0 (the first item) and increment by one with each successive item. The syntax is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;best_languages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"JavaScript"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Go"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Rust"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Python"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"C"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;best_languages&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="c1"&gt;# prints "Go", because index 1 was provided
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  List length
&lt;/h3&gt;

&lt;p&gt;The length of a List can be calculated using the &lt;code&gt;len()&lt;/code&gt; function. Again, we'll cover functions in detail later, but this is the syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"apple"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"banana"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"pear"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: 3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The length of the list is equal to the number of items present. Don't be fooled by the fact that the length is not equal to the index of the last element, in fact it will always be one greater.&lt;/p&gt;

&lt;h3&gt;
  
  
  List Updates
&lt;/h3&gt;

&lt;p&gt;We can also change the item that exists at a given index. For example, we can change &lt;code&gt;Leather&lt;/code&gt; to &lt;code&gt;Leather Armor&lt;/code&gt; in the &lt;code&gt;inventory&lt;/code&gt; array in the following way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;inventory&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"Leather"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Healing Potion"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Iron Ore"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;inventory&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Leather Armor"&lt;/span&gt;
&lt;span class="c1"&gt;# inventory: ['Leather Armor', 'Healing Potion', 'Iron Ore']
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Appending in Python
&lt;/h3&gt;

&lt;p&gt;It's common to create an empty list then fill it with values using a loop. We can add values to the end of a list using the &lt;code&gt;.append()&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;cards&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="n"&gt;cards&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"nvidia"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cards&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"amd"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# the cards list is now ['nvidia', 'amd']
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Pop Values
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;.pop()&lt;/code&gt; is the opposite of &lt;code&gt;.append()&lt;/code&gt;. Pop removes the last element from the array and returns it for use. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;vegetables&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"broccoli"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"cabbage"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"kale"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"tomato"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="n"&gt;last_vegetable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vegetables&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="c1"&gt;# vegetables = ['broccoli', 'cabbage', 'kale']
# last_vegetable = 'tomato'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Counting the items in a list
&lt;/h3&gt;

&lt;p&gt;Remember that we can iterate (count) over all the items in an array using a loop. For example, the following code will print each item in the &lt;code&gt;sports&lt;/code&gt; array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sports&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sports&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  No-index Syntax
&lt;/h3&gt;

&lt;p&gt;In my opinion, Python has &lt;em&gt;the most elegant&lt;/em&gt; syntax for iterating directly over the items in a list without worrying about index numbers. If you don't need the index number you can use the following syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;trees&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'oak'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'pine'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'maple'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;tree&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;trees&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tree&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints:
# oak
# pine
# maple
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;tree&lt;/code&gt;, the variable declared using the &lt;code&gt;in&lt;/code&gt; keyword, directly accesses the value in the array rather than the index of the value. If we don't need to update the item, and only need to access its value then this is a more clean way to write the code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Find an item in a list
&lt;/h3&gt;

&lt;p&gt;Example of "no-index" or "no-range" syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;fruit&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fruit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Modulo operator in Python
&lt;/h3&gt;

&lt;h4&gt;
  
  
  The modulo operator can be used to find a remainder:
&lt;/h4&gt;

&lt;p&gt;For example, &lt;code&gt;7&lt;/code&gt; &lt;a href="https://en.wikipedia.org/wiki/Modulo_operation"&gt;modulo&lt;/a&gt; &lt;code&gt;2&lt;/code&gt; would be &lt;code&gt;1&lt;/code&gt;, because 2 can be multiplied evenly into 7 at most 3 times:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;2 * 3 = 6&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then there is 1 &lt;em&gt;remaining&lt;/em&gt; to get from &lt;code&gt;6&lt;/code&gt; to &lt;code&gt;7&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;7 - 6 = 1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The d operator is the percent sign: &lt;code&gt;%&lt;/code&gt;. It's important to recognize modulo is &lt;em&gt;not&lt;/em&gt; a percentage though! That's just the symbol we're using.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;remainder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="c1"&gt;# remainder = 2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An odd number is a number that when divided by &lt;code&gt;2&lt;/code&gt;, the remainder is &lt;em&gt;not&lt;/em&gt; &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Slicing lists
&lt;/h3&gt;

&lt;p&gt;Python makes it easy to slice and dice lists to work only with the section you care about. One way to do this is to use the simple slicing operator, which is just a colon &lt;code&gt;:&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;With this operator, you can specify where to start and end the slice, and how to step through the original. List slicing returns a &lt;em&gt;new list&lt;/em&gt; from the existing list.&lt;/p&gt;

&lt;p&gt;The syntax is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Lst&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="n"&gt;Initial&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;End&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IndexJump&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;# Display list
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="c1"&gt;# Prints [70, 20]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above reads as "give me a slice of the &lt;code&gt;scores&lt;/code&gt; list from index 1, up to but not including 5, skipping every 2nd value. &lt;em&gt;All of the sections are optional&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;# Display list
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="c1"&gt;# Prints [70, 30, 20, 90]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;90&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;# Display list
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:])&lt;/span&gt;
&lt;span class="c1"&gt;# Prints [70, 30, 20, 90, 10, 50]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  List Operations - Concatenate
&lt;/h3&gt;

&lt;p&gt;Concatenating two lists (smushing them together) is really easy in Python, just use the &lt;code&gt;+&lt;/code&gt; operator.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nb"&gt;all&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;all&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: [1, 2, 3, 4, 5, 6]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  List Operations - Contains
&lt;/h3&gt;

&lt;p&gt;Checking whether a value exists in a list is also really easy in Python, just use the &lt;code&gt;in&lt;/code&gt; keyword.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"apple"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"orange"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"banana"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"banana"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: True
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Tip: Quotes within quotes
&lt;/h3&gt;

&lt;p&gt;To use quotes within quotes, they either need to be &lt;a href="https://stackoverflow.com/questions/10646142/what-does-it-mean-to-escape-a-string"&gt;escaped&lt;/a&gt; or you need to use the &lt;em&gt;other&lt;/em&gt; kind of quotes. Because we usually use double quotes, we can nest strings with single quotes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"banana is in fruits list: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="s"&gt;'banana'&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  List deletion
&lt;/h3&gt;

&lt;p&gt;Python has a built-in keyword &lt;code&gt;del&lt;/code&gt; that deletes items from objects. In the case of a list, you can delete specific indexes or entire slices.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;nums&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# delete the fourth item
&lt;/span&gt;&lt;span class="k"&gt;del&lt;/span&gt; &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Output: [1, 2, 3, 5, 6, 7, 8, 9]
&lt;/span&gt;
&lt;span class="c1"&gt;# delete items from 2nd to 3rd
&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;del&lt;/span&gt; &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Output: [1, 4, 5, 6, 7, 8, 9]
&lt;/span&gt;
&lt;span class="c1"&gt;# delete all elements
&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;del&lt;/span&gt; &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[:]&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Output: []
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Tuples
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://python-reference.readthedocs.io/en/latest/docs/tuple/"&gt;Tuples&lt;/a&gt; are collections of data that are ordered and unchangeable. You can think of a tuple as a &lt;code&gt;List&lt;/code&gt; with a fixed size. Tuples are created with round brackets:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;my_tuple&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"this is a tuple"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_tuple&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="c1"&gt;# this is a tuple
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_tuple&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="c1"&gt;# 45
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_tuple&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="c1"&gt;# True
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While it's typically considered bad practice to store items of different types in a List it's not a problem with Tuples. Because they have a fixed size, it's easy to keep track of which indexes store which types of data.&lt;/p&gt;

&lt;p&gt;Tuples are often used to store very small groups (like 2 or 3 items) of data. For example, you might use a tuple to store a dog's name and age.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;dog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Fido"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because Tuples hold their data, multiple tuples can be stored within a list. Similar to storing other data in lists, each tuple within the list is separated by a comma.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;my_tuples&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[(&lt;/span&gt;&lt;span class="s"&gt;"this is the first tuple in the list"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;),(&lt;/span&gt;&lt;span class="s"&gt;"this is the second tuple in the list"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_tuples&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="c1"&gt;# this is the first tuple in the list
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Chapter 7: Functions
&lt;/h2&gt;

&lt;p&gt;Functions allow us to &lt;em&gt;reuse&lt;/em&gt; and &lt;em&gt;organize&lt;/em&gt; code. For example, let's pretend we need to calculate the area of a circle. We can use the formula &lt;code&gt;area = pi * r^2&lt;/code&gt;, or in code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="n"&gt;area&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works great! The problem arises when multiple places in our code need to get the area of a circle&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="n"&gt;area1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;

&lt;span class="n"&gt;r2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;
&lt;span class="n"&gt;area2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r2&lt;/span&gt;

&lt;span class="n"&gt;r3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;
&lt;span class="n"&gt;area3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r3&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We want to use the same code, why repeat the work?&lt;/p&gt;

&lt;p&gt;Let's declare a new function &lt;code&gt;area_of_circle()&lt;/code&gt;. Notice that the &lt;code&gt;def&lt;/code&gt; keyword is written before the function name, and tells the computer that we're declaring, or defining, a new function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;area_of_circle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;area_of_circle&lt;/code&gt; function takes one input (which can also be called a parameter or argument), and returns a single output. We give our function the radius of a circle and we get back the area of that circle!&lt;/p&gt;

&lt;p&gt;To use or "&lt;a href="https://en.wikibooks.org/wiki/Python_Programming/Functions#Function_Calls"&gt;call&lt;/a&gt;" the function we can pass in any number as the input, and capture the output into a new variable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="n"&gt;area&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;area_of_circle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's talk through this code example step by step.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;radius&lt;/code&gt; variable is created with a value of &lt;code&gt;5&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;area_of_circle&lt;/code&gt; function is called with a single argument: &lt;code&gt;radius&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;area_of_circle&lt;/code&gt; function is executed, with &lt;code&gt;r&lt;/code&gt; being equal to &lt;code&gt;5&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The result of &lt;code&gt;3.14 * r * r&lt;/code&gt; is returned from &lt;code&gt;area_of_circle&lt;/code&gt;, which happens to be &lt;code&gt;78.75&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;area_of_circle(radius)&lt;/code&gt; resolves to the returned value of &lt;code&gt;78.75&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;area&lt;/code&gt; variable is created with a value of &lt;code&gt;78.75&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Multiple Parameters
&lt;/h3&gt;

&lt;p&gt;Functions can have multiple parameters, or inputs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;subtract&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Where to Declare Functions
&lt;/h3&gt;

&lt;p&gt;You've probably noticed that a variable needs to be declared &lt;em&gt;before&lt;/em&gt; it's used. For example, the following doesn't work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;my_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'Lane Wagner'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It needs to be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;my_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'Lane Wagner'&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;my_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lines of code execute in &lt;em&gt;order from top to bottom&lt;/em&gt;, so a variable needs to be created before it can be used. That means that if you define a function, you can't call that function until after the definition.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;main()&lt;/code&gt; function is a convention used in many programming languages to specify the entrypoint of an application. By defining a single &lt;code&gt;main&lt;/code&gt; function, and only calling &lt;code&gt;main()&lt;/code&gt; at the end of the entire program we ensure that all of our function are defined before they're called.&lt;/p&gt;

&lt;h3&gt;
  
  
  Order of functions
&lt;/h3&gt;

&lt;p&gt;All functions &lt;em&gt;must&lt;/em&gt; be defined before they're used.&lt;/p&gt;

&lt;p&gt;You might think this would make structuring Python code difficult because the order in which the functions are declared can quickly become so dependent on each other that writing anything becomes impossible.&lt;/p&gt;

&lt;p&gt;As it turns out, most Python developers solve this problem by simply defining all the functions first, then finally calling the entrypoint function &lt;em&gt;last&lt;/em&gt;. If you do that, then the order that the functions are declared in &lt;em&gt;doesn't matter&lt;/em&gt;. The entrypoint function is usually called "main".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;func2&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;func2&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;func3&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;func3&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"I'm function 3"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;# entrypoint
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Scope
&lt;/h3&gt;

&lt;p&gt;Scope refers to &lt;em&gt;where&lt;/em&gt; a variable or function name is available to be used. For example, when we create variables in a function (by giving names to our parameters for example), that data is &lt;em&gt;not&lt;/em&gt; available outside of that function.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;subtract&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subtract&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# ERROR! "name 'x' is not defined"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the &lt;code&gt;subtract&lt;/code&gt; function is called, we assign the variable &lt;code&gt;x&lt;/code&gt; to 5, but &lt;code&gt;x&lt;/code&gt; only exists in the code &lt;em&gt;within&lt;/em&gt; the &lt;code&gt;subtract&lt;/code&gt; function. If we try to print &lt;code&gt;x&lt;/code&gt; outside of that function then we won't get a result, in fact we'll get a big fat error.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Global Scope
&lt;/h3&gt;

&lt;p&gt;So far we've been working in the global scope. That means that when we define a variable or a function, that name is accessible in &lt;em&gt;every other place&lt;/em&gt; in our program, even within other functions.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;pi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_area_of_circle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;radius&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;pi&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;radius&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because &lt;code&gt;pi&lt;/code&gt; was declared in the parent "global" scope, it is usable within the &lt;code&gt;get_area_of_circle()&lt;/code&gt; function.&lt;/p&gt;

&lt;h3&gt;
  
  
  Infinity
&lt;/h3&gt;

&lt;p&gt;The built-in &lt;code&gt;float()&lt;/code&gt; function can be used to create a &lt;a href="https://www.geeksforgeeks.org/python-float-type-and-its-methods/"&gt;numeric floating point value&lt;/a&gt; that represents the negative infinity value. I've added it for you as a starting point.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;negative_infinity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'-inf'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;positive_infinity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'inf'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  None Return
&lt;/h3&gt;

&lt;p&gt;When no return value is specified in a function, (for example, maybe it's a function that prints some text to the console, but doesn't explicitly return a value) it will return &lt;code&gt;None&lt;/code&gt;. The following code snippets all return exactly the same thing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;my_func&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"I do nothing"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;my_func&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"I do nothing"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;my_func&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"I do nothing"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Parameters vs arguments
&lt;/h3&gt;

&lt;p&gt;Parameters are the names used for inputs when &lt;em&gt;defining&lt;/em&gt; a function. Arguments are the names of the inputs supplied when a function is &lt;em&gt;called&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;To reiterate, arguments are the actual values that go into the function, say &lt;code&gt;42.0&lt;/code&gt;, &lt;code&gt;"the dark knight"&lt;/code&gt;, or &lt;code&gt;True&lt;/code&gt;. Parameters are the names we use in the function definition to refer to those values, which at the time of writing the function, could be anything.&lt;/p&gt;

&lt;p&gt;That said, it is important to understand that this is all semantics, and frankly developers are really lazy with these definitions. You'll often hear the words arguments and parameters used interchangeably.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# a and b are parameters
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;

&lt;span class="c1"&gt;# 5 and 6 are arguments
&lt;/span&gt;&lt;span class="nb"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Multiple return values
&lt;/h3&gt;

&lt;p&gt;In Python, we can return more than one value from a function. All we need to do is separate each value by a comma.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# returns email, age, and status of the user
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_user&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"name@domain.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"active"&lt;/span&gt;

&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;get_user&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: "name@domain.com 21 active"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_user&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"name@domain.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"active"&lt;/span&gt;

&lt;span class="c1"&gt;# this works, and by convention you should NOT use the underscore variable later
&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;get_user&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: "name@domain.com"
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: "active"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Default values for function arguments
&lt;/h3&gt;

&lt;p&gt;Python has a way to specify a default value for function arguments. This can be convenient if a function has arguments that are essentially "optional", and you as the function creator want to use a specific default value in case the caller doesn't provide one&lt;/p&gt;

&lt;p&gt;A default value is created by using the assignment (&lt;code&gt;=&lt;/code&gt;) operator in the function signature.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"there"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"Hello &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;, welcome! You've registered your email: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;msg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;get_greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"lane@example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Lane"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Hello Lane, welcome! You've registered your email: lane@example.com
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;msg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;get_greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"lane@example.com"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Hello there, welcome! You've registered your email: lane@example.com
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the second parameter is omitted, the default &lt;code&gt;"there"&lt;/code&gt; value will be used in its place. As you may have guessed, for this structure to work, optional arguments that have defaults specified come &lt;em&gt;after&lt;/em&gt; all the required arguments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 8: Dictionaries
&lt;/h2&gt;

&lt;p&gt;Dictionaries in Python are used to store data values in &lt;code&gt;key&lt;/code&gt; -&amp;gt; &lt;code&gt;value&lt;/code&gt; pairs. Dictionaries are a great way to store groups of information.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;car&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="s"&gt;"brand"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"Tesla"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s"&gt;"model"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s"&gt;"year"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2019&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Duplicate keys
&lt;/h3&gt;

&lt;p&gt;Because dictionaries rely on unique keys, you can't have two of the same key in the same dictionary. If you try to use the same key twice, the associated value will simply be overwritten.&lt;/p&gt;

&lt;h3&gt;
  
  
  Accessing Dictionary Values
&lt;/h3&gt;

&lt;p&gt;Dictionary elements must be accessible somehow in code, otherwise they wouldn't be very useful.&lt;/p&gt;

&lt;p&gt;A value is retrieved from a dictionary by specifying its corresponding key in square brackets. The syntax looks similar to indexing into a list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;car&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;'make'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'tesla'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;'model'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'3'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;car&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'make'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: tesla
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Setting Dictionary Values
&lt;/h3&gt;

&lt;p&gt;You don't need to create a dictionary with values already inside. It is common to create a blank dictionary then populate it later using dynamic values. The syntax is the same as getting data out of a key, just use the assignment operator (&lt;code&gt;=&lt;/code&gt;) to give that key a value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"jack bronson"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"jill mcarty"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"john denver"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;names_dict&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# .split() returns a list of strings
&lt;/span&gt;    &lt;span class="c1"&gt;# where each string is a single word from the original
&lt;/span&gt;    &lt;span class="n"&gt;names_arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c1"&gt;# here we update the dictionary
&lt;/span&gt;    &lt;span class="n"&gt;names_dict&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;names_arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;names_arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names_dict&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: {'jack': 'bronson', 'jill': 'mcarty', 'john': 'denver'}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Updating Dictionary Values
&lt;/h3&gt;

&lt;p&gt;If you try to set the value of a key that already exists, you'll end up just updating the value of that key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"jack bronson"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"james mcarty"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"john denver"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;names_dict&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# .split() returns a list of strings
&lt;/span&gt;    &lt;span class="c1"&gt;# where each string is a single word from the original
&lt;/span&gt;    &lt;span class="n"&gt;names_arr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c1"&gt;# we're always setting the "jack" key
&lt;/span&gt;    &lt;span class="n"&gt;names_dict&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"jack"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;names_arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names_dict&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: {'jack': 'denver'}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Deleting Dictionary Values
&lt;/h3&gt;

&lt;p&gt;You can delete existing keys using the &lt;code&gt;del&lt;/code&gt; keyword.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;names_dict&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;'jack'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'bronson'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;'jill'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'mcarty'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;'joe'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'denver'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;del&lt;/span&gt; &lt;span class="n"&gt;names_dict&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'joe'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;names_dict&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: {'jack': 'bronson', 'jill': 'mcarty'}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Deleting keys that don't exist
&lt;/h3&gt;

&lt;p&gt;Notice that if you try to delete a key that doesn't exist, you'll get an &lt;em&gt;error&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;names_dict&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;'jack'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'bronson'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;'jill'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'mcarty'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;'joe'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'denver'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;del&lt;/span&gt; &lt;span class="n"&gt;names_dict&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'unknown'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;# ERROR HERE, key doesn't exist
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Checking for existence
&lt;/h3&gt;

&lt;p&gt;If you're unsure whether or not a key exists in a dictionary, use the &lt;code&gt;in&lt;/code&gt; keyword.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;cars&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;'ford'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'f150'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;'tesla'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'3'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'ford'&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;cars&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: True
&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'gmc'&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;cars&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: False
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Iterating over a dictionary in Python
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;fruit_sizes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"apple"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"small"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"banana"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"large"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"grape"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"tiny"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;fruit_sizes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fruit_sizes&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"name: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;, size: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# name: apple, size: small
# name: banana, size: large
# name: grape, size: tiny
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Ordered or Unordered?
&lt;/h3&gt;

&lt;p&gt;As of Python version &lt;code&gt;3.7&lt;/code&gt;, dictionaries are &lt;em&gt;ordered&lt;/em&gt;. In Python &lt;code&gt;3.6&lt;/code&gt; and earlier, dictionaries were &lt;em&gt;unordered&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Because dictionaries are ordered, the items have a defined order, and that order will &lt;em&gt;not&lt;/em&gt; change.&lt;/p&gt;

&lt;p&gt;Unordered means that the items used to &lt;em&gt;not&lt;/em&gt; have a defined order, so you couldn't refer to an item by using an index.&lt;/p&gt;

&lt;p&gt;**The takeaway is that if you're on Python &lt;code&gt;3.7&lt;/code&gt; or later, you'll be able to iterate over dictionaries in the same order every time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 9: Sets
&lt;/h2&gt;

&lt;p&gt;Sets are &lt;em&gt;like&lt;/em&gt; Lists, but they are &lt;em&gt;unordered&lt;/em&gt; and they guarantee uniqueness. There can be no two of the same value in a set.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;'apple'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'banana'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'grape'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: &amp;lt;class 'set'&amp;gt;
&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: {'banana', 'grape', 'apple'}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Adding values to a set
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;'apple'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'banana'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'grape'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'pear'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: {'banana', 'grape', 'pear', 'apple'}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Empty set
&lt;/h3&gt;

&lt;p&gt;Because the &lt;code&gt;{}&lt;/code&gt; syntax creates an empty dictionary, to create an empty set, just use the &lt;code&gt;set()&lt;/code&gt; function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;set&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'pear'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: {'pear'}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Iterate over values in a set (order is not guaranteed)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;'apple'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'banana'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'grape'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;fruit&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fruit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Prints:
&lt;/span&gt;    &lt;span class="c1"&gt;# banana
&lt;/span&gt;    &lt;span class="c1"&gt;# grape
&lt;/span&gt;    &lt;span class="c1"&gt;# apple
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Removing values from a set
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;'apple'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'banana'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'grape'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'apple'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# Prints: {'banana', 'grape'}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Chapter 10: Errors
&lt;/h2&gt;

&lt;p&gt;You've probably encountered some errors in your code from time to time if you've gotten this far in the course. In Python, there are two main kinds of distinguishable errors.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;syntax errors&lt;/li&gt;
&lt;li&gt;exceptions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Syntax errors
&lt;/h3&gt;

&lt;p&gt;You probably know what these are by now. A syntax error is just the Python interpreter telling you that your code isn't adhering to proper Python syntax.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;this&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;valid&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;so&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="n"&gt;will&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If I try to run that sentence as if it were valid code I'll get a syntax error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;this is not valid code, so it will error
      ^
SyntaxError: invalid syntax
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Exceptions
&lt;/h3&gt;

&lt;p&gt;Even if your code has the right syntax however, it may still cause an error when an attempt is made to execute it. Errors detected during execution are called "exceptions" and can be handled gracefully by your code. You can even raise your own exceptions when bad things happen in your code.&lt;/p&gt;

&lt;p&gt;Python uses a try-except pattern for handling errors.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# prints "division by zero"
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;try&lt;/code&gt; block is executed until an exception is raised or it completes, whichever happens first. In this case, a "divide by zero" error is raised because division by zero is impossible. The &lt;code&gt;except&lt;/code&gt; block is only executed if an exception is raised in the &lt;code&gt;try&lt;/code&gt; block. It then exposes the exception as data (&lt;code&gt;e&lt;/code&gt; in our case) so that the program can handle the exception gracefully without crashing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Raising your own exceptions
&lt;/h3&gt;

&lt;p&gt;Errors are &lt;em&gt;not&lt;/em&gt; something to be scared of. Every program that runs in production is expected to manage errors on a constant basis. Our job as developers is to handle the errors gracefully and in a way that aligns with our user's expectations.&lt;/p&gt;

&lt;h4&gt;
  
  
  Errors are NOT bugs
&lt;/h4&gt;

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

&lt;p&gt;When something in our own code happens that we don't expect, we should raise our own exceptions. For example, if someone passes some bad inputs to a function we write, we should not be afraid to raise an exception to let them know they did something wrong.&lt;/p&gt;

&lt;p&gt;An &lt;em&gt;error&lt;/em&gt; or &lt;em&gt;exception&lt;/em&gt; is raised when something bad happens, but as long as our code handles it as users expect it to, it's &lt;em&gt;not&lt;/em&gt; a bug. A bug is when code behaves in ways our users don't expect it to.&lt;/p&gt;

&lt;p&gt;For example, if a player tries to forge an iron sword out of bronze metal, we might raise an exception and display an error message to the player. However, that's the expected behavior of the game, so it's not a bug. If a player can forge the iron sword out of bronze, that may be considered a bug because that's against the rules of the game.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"something bad happened"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Software applications aren't perfect, and user input and network connectivity are far from predictable. Despite intensive debugging and unit testing, applications will still have failure cases.&lt;/p&gt;

&lt;p&gt;Loss of network connectivity, missing database rows, out of memory issues, and unexpected user inputs can all prevent an application from performing "normally". It is your job to catch and handle any and all exceptions gracefully so that your app keeps working. When you are able to detect that something is amiss, you should be raising the errors yourself, in addition to the "default" exceptions that the Python interpreter will raise.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"something bad happened"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Different types of exceptions
&lt;/h1&gt;

&lt;p&gt;We haven't covered classes and objects yet, which is what an &lt;code&gt;Exception&lt;/code&gt; really is at its core. We'll go more into that in the object-oriented programming course that we have lined up for you next.&lt;/p&gt;

&lt;p&gt;For now, what is important to understand is that there are different types of exceptions and that we can differentiate between them in our code.&lt;/p&gt;

&lt;h3&gt;
  
  
  More syntax for errors
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;ZeroDivisionError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"0 division"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"unknown exception"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;nums&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;ZeroDivisionError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"0 division"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"unknown exception"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which will print:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 division
unknown exception
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Chapter 11: Python Facts
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Zen of Python
&lt;/h3&gt;

&lt;p&gt;Tim Peters, a long time Pythonista describes the guiding principles of Python in his famous short piece, &lt;a href="https://www.python.org/dev/peps/pep-0020/"&gt;The Zen of Python&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Beautiful is better than ugly.&lt;/p&gt;

&lt;p&gt;Explicit is better than implicit.&lt;/p&gt;

&lt;p&gt;Simple is better than complex.&lt;/p&gt;

&lt;p&gt;Complex is better than complicated.&lt;/p&gt;

&lt;p&gt;Flat is better than nested.&lt;/p&gt;

&lt;p&gt;Sparse is better than dense.&lt;/p&gt;

&lt;p&gt;Readability counts.&lt;/p&gt;

&lt;p&gt;Special cases aren't special enough to break the rules.&lt;/p&gt;

&lt;p&gt;Although practicality beats purity.&lt;/p&gt;

&lt;p&gt;Errors should never pass silently.&lt;/p&gt;

&lt;p&gt;Unless explicitly silenced.&lt;/p&gt;

&lt;p&gt;In the face of ambiguity, refuse the temptation to guess.&lt;/p&gt;

&lt;p&gt;There should be one-- and preferably only one --obvious way to do it.&lt;/p&gt;

&lt;p&gt;Although that way may not be obvious at first unless you're Dutch.&lt;/p&gt;

&lt;p&gt;Now is better than never.&lt;/p&gt;

&lt;p&gt;Although never is often better than &lt;em&gt;right&lt;/em&gt; now.&lt;/p&gt;

&lt;p&gt;If the implementation is hard to explain, it's a bad idea.&lt;/p&gt;

&lt;p&gt;If the implementation is easy to explain, it may be a good idea.&lt;/p&gt;

&lt;p&gt;Namespaces are one honking great idea -- let's do more of those!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Why Python?
&lt;/h3&gt;

&lt;p&gt;Here are some reasons we think Python is a future-proof choice for developers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy to read and write - Python reads like plain English. Due to its simple syntax, it's a great choice for implementing advanced concepts like AI. This is arguably Python's &lt;em&gt;best feature&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Popular - According to the Stack Overflow Developer Survey, &lt;a href="https://insights.stackoverflow.com/survey/2020#most-popular-technologies"&gt;Python is the 4th most popular&lt;/a&gt; coding language in 2020.&lt;/li&gt;
&lt;li&gt;Free - Python, like many languages nowadays, is developed under an open-source license. It's free to install, use, and distribute.&lt;/li&gt;
&lt;li&gt;Portable - Python written for one platform will work on any other platform.&lt;/li&gt;
&lt;li&gt;Interpreted - Code can be executed as soon as it's written. Because it doesn't need to take a long time to compile like Java, C++, or Rust, releasing code to production is typically faster.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why not Python?
&lt;/h3&gt;

&lt;p&gt;Python might not be the best choice for a project if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The code needs to run fast. Python code executes very slowly, which is why performance critical applications like PC games aren't written in Python.&lt;/li&gt;
&lt;li&gt;The codebase will become large and complex. Due to its dynamic type system, Python code can be harder to keep clean of bugs.&lt;/li&gt;
&lt;li&gt;The application needs to be distributed directly to non-technical users. They would have to install Python in order to run your code, which would be a huge inconvenience.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Python 2 vs Python 3
&lt;/h3&gt;

&lt;p&gt;One thing that's important to keep in mind as you continue your Python journey is that the Python ecosystem suffers from split personality syndrome. Python 3 was released on December 3rd, 2008, but over a decade later the web is still full of Python 2 dependencies, scripts and tutorials.&lt;/p&gt;

&lt;p&gt;In this course, &lt;strong&gt;we used Python 3&lt;/strong&gt; - just like any good citizen should these days.&lt;/p&gt;

&lt;p&gt;One of the most obvious breaking changes between Python 2 and 3 is the syntax for printing text to the console.&lt;/p&gt;

&lt;h4&gt;
  
  
  Python 2
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="s"&gt;"hello world"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Python 3
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hello world"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Congratulations on making it to the end!
&lt;/h2&gt;

&lt;p&gt;If you're interested in doing the interactive coding assignments and quizzes for this course you can check out the &lt;a href="https://boot.dev/learn/learn-python"&gt;Learn Python course over on Boot.dev&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That course is a part of my full &lt;a href="https://boot.dev/tracks/backend"&gt;back-end developer career path&lt;/a&gt;, made up of other courses and projects if you're interested in checking those out.&lt;/p&gt;

</description>
      <category>python</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>course</category>
    </item>
    <item>
      <title>It's Not About the Job Openings</title>
      <dc:creator>Lane Wagner</dc:creator>
      <pubDate>Thu, 30 Mar 2023 14:43:33 +0000</pubDate>
      <link>https://dev.to/bootdotdev/its-not-about-the-job-openings-3bep</link>
      <guid>https://dev.to/bootdotdev/its-not-about-the-job-openings-3bep</guid>
      <description>&lt;p&gt;I talk to boatloads of students who are starting to &lt;a href="https://boot.dev"&gt;learn to code&lt;/a&gt;, and invariably they are hyper-concerned about which programming languages and technologies they should be learning.&lt;/p&gt;

&lt;p&gt;Now, first of all, I don't think it matters all that much. You don't fail to break into tech because you learned JavaScript instead of Python, or Go instead of Rust. You fail for a bunch of other reasons, chief among them being a lack of dedication, time, and focus.&lt;/p&gt;

&lt;p&gt;That said, choosing good technologies to learn can certainly help. Unfortunately, almost everyone I talk to is only concerned with one metric: &lt;em&gt;the total number of jobs for a given technology&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;This is a mistake.&lt;/p&gt;

&lt;h2&gt;
  
  
  The total number of jobs doesn't matter
&lt;/h2&gt;

&lt;p&gt;According to Stack Overflow's latest survey, JavaScript is &lt;a href="https://survey.stackoverflow.co/2022/#section-most-popular-technologies-programming-scripting-and-markup-languages"&gt;the most popular programming language in the world&lt;/a&gt;, both for people learning to code as well as professional developers.&lt;/p&gt;

&lt;p&gt;I also did a quick search on &lt;a href="https://www.linkedin.com/jobs"&gt;LinkedIn Jobs&lt;/a&gt; for "JavaScript" and "Golang" jobs. Here are the results:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript: 477,512 open positions in the US&lt;/li&gt;
&lt;li&gt;Golang: 61,673 open positions in the US&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you look at those numbers and think "I should learn JavaScript because there are more jobs", you're not alone, but you're wrong.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It doesn't matter how many total jobs there are, because you only need to land &lt;em&gt;one&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;-- me&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Looking at the ratios
&lt;/h2&gt;

&lt;p&gt;To dive deeper I went to &lt;a href="https://trends.google.com/trends/explore?geo=US&amp;amp;q=learn%20javascript,learn%20golang&amp;amp;hl=en"&gt;Google Trends&lt;/a&gt; and looked at the number of people searching for the terms "Learn JavaScript" and "Learn Golang" over the last 12 months. Here was the ratio:&lt;/p&gt;

&lt;p&gt;JavaScript: 73&lt;br&gt;
Golang: 6&lt;/p&gt;

&lt;p&gt;&lt;em&gt;73/6 is the ratio of people searching for "Learn JavaScript" to people searching for "Learn Golang". Google Trends, like the Sith, doesn't deal in absolutes.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So, let's do some more math:&lt;/p&gt;

&lt;p&gt;JavaScript jobs to Golang jobs: &lt;code&gt;477,512 / 61,673 = 7.7&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;7.7 JavaScript jobs for every 1 Golang job&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;JavaScript learners to Golang learners: &lt;code&gt;73 / 7 = 10.4&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;10.4 JavaScript learners for every 1 Golang learner&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Next, the "competition ratio": &lt;code&gt;10.4 / 7.7 = 1.4&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Based on these numbers, I'd estimate that your competition for JavaScript jobs is about 1.4x higher than your competition for Golang jobs. According to this completely scientific and in no-way fallible analysis, it looks like Go might be a better choice if you're trying to minimize your competition for jobs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can I trust these numbers?
&lt;/h2&gt;

&lt;p&gt;I don't know, probably not. My goal here isn't to convince you to learn Go, Python, Rust, JavaScript, or anything else for that matter. I just want you to think about the job market in a slightly different way.&lt;/p&gt;

&lt;p&gt;This has been top-of-mind for me lately due to an anecdote from a couple of years ago. I was working as a hiring manager where I was looking for mid-level Go developers. My coworker was hiring mid-level JavaScript developers at the same company. When I opened a new position I would get 10-20 candidates within 2 weeks. He would get 100+ candidates within the same time frame. I felt bad for the JavaScript candidates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does the total number of jobs matter at all?
&lt;/h2&gt;

&lt;p&gt;Yes, but I prefer to think of it as a threshold. Like, if there are only 100 total jobs for a given technology, even if you're one of ten people in the world who knows it, you're going to be entering a very niche market that could dry up at any moment.&lt;/p&gt;

&lt;p&gt;It's like, "is what I'm learning sufficiently popular that I can reasonably expect to find a job"? If it is, then I'd argue the next most important metric is the ratio of candidates to jobs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What else matters?
&lt;/h2&gt;

&lt;p&gt;The next thing to consider is your location. Remote work is great, but I'm a big fan of junior devs trying to &lt;a href="https://blog.boot.dev/about/#9-get-an-on-site-full-time-job-first"&gt;work on-site&lt;/a&gt; for at least a year or two. You'll learn faster, and you'll actually have an easier time landing a job in the first place (assuming you're in a place with some jobs). When you compete for a local job, you're only competing against people who live in your city, not the entire world.&lt;/p&gt;

&lt;p&gt;If Python has tons of jobs, and a fantastic ratio of candidates to jobs, but where you live the only developer openings are for Go and Java, then I'd recommend reconsidering your choice of technology.&lt;/p&gt;

&lt;h2&gt;
  
  
  Please don't worry about it too much
&lt;/h2&gt;

&lt;p&gt;Like I said at the outset, you won't fail to break into tech because you didn't choose the perfect stack to learn.&lt;/p&gt;

&lt;p&gt;If you go about learning to code by going &lt;em&gt;deep&lt;/em&gt; on the basics, you can always learn new technologies as you go. Fundamental concepts like problem-solving, imperative programming, data structures, algorithms, architecture, clean code, io, networking, HTTP, REST, databases, and caching are &lt;em&gt;universal and language-agnostic&lt;/em&gt;. If you know how to build a REST API in Go, spinning one up in Express or Django is going to be a quick learning curve.&lt;/p&gt;

&lt;p&gt;Syntax is the easy part. Best of luck out there.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>career</category>
      <category>job</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Your Architecture is Bad, So Make It Easy to Change</title>
      <dc:creator>Lane Wagner</dc:creator>
      <pubDate>Fri, 10 Feb 2023 15:54:12 +0000</pubDate>
      <link>https://dev.to/bootdotdev/your-architecture-is-bad-so-make-it-easy-to-change-9ni</link>
      <guid>https://dev.to/bootdotdev/your-architecture-is-bad-so-make-it-easy-to-change-9ni</guid>
      <description>&lt;p&gt;Have you ever started a new software development job and thought:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Wow, what a beautifully architected system! I wouldn't change anything here."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Unless it's a brand-new project, I'm guessing not. Most of us are dreadfully aware of the dashes of technical debt we sprinkle into our codebases every day, all in the name of getting the job done.&lt;/p&gt;

&lt;p&gt;Don't get me wrong, I'm a clean architecture &lt;em&gt;nerd&lt;/em&gt;. I love talking about monoliths, microservices, containers, clusters, PaaS, caching, message queues, and everything else under the sun. I do everything I can to make sure that my code is easy to debug, easy to scale, and easy to add features to.&lt;/p&gt;

&lt;p&gt;Here's the thing: &lt;em&gt;I also know that my architecture is terrible, and yours is too.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is your architecture so bad?
&lt;/h2&gt;

&lt;p&gt;Well, maybe it's not. Your architecture may be pretty good &lt;em&gt;at the moment&lt;/em&gt;. You might be using a popular design pattern, you may have services that can scale up to handle 10x the load that you're currently seeing, and all the engineers on your team might understand the codebase.&lt;/p&gt;

&lt;p&gt;Unfortunately, your architecture &lt;em&gt;is&lt;/em&gt; bad three years from now. It's bad when your team goes from 10 to 100 engineers. It's bad when your company pivots from a B2B SaaS product to a B2C mobile app. It's bad when you onboard a new enterprise client that requires you to store all their data in a different country.&lt;/p&gt;

&lt;p&gt;Assuming you have good engineers, your architecture is probably bad due to &lt;em&gt;business&lt;/em&gt; decisions, not technical ones. It is often a &lt;em&gt;good&lt;/em&gt; business decision to accrue technical debt if the payoff is worth it, and a savvy engineer will know when to make that tradeoff.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is there no hope?
&lt;/h2&gt;

&lt;p&gt;It's sometimes a good decision to take on technical debt, but we need to acknowledge that the debt must &lt;em&gt;eventually&lt;/em&gt; be paid back.&lt;/p&gt;

&lt;p&gt;You &lt;em&gt;can&lt;/em&gt; know what a good architecture for your &lt;em&gt;current&lt;/em&gt; business needs is, so build that! There's no sense in planning for 1,000,000 users when you only have 500. Avoid planning too far ahead, but also understand that your future needs could be &lt;em&gt;wildly&lt;/em&gt; different from your current ones.&lt;/p&gt;

&lt;p&gt;To put this idea simply:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Build your systems for the present, but anticipate a very different future&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Wait for more information before locking in your architecture
&lt;/h2&gt;

&lt;p&gt;The best architectural decision you can make is to often &lt;em&gt;not make one&lt;/em&gt;. Here's an example. Let's pretend you're building a web app that displays temperature data from various weather sources. You're already using a PostgreSQL database for authentication and user information and need to decide where to store the weather data, but you know that your temperature aggregations queries won't scale well in a monolithic database like Postgres. &lt;/p&gt;

&lt;p&gt;However, you only have a few data sources and a few users, so scalability isn't a problem. I'd argue that you should just shove that data in Postgres, with a loose plan to move to a more domain-specific solution later.&lt;/p&gt;

&lt;p&gt;But wait!!! Here's where most engineers go wrong.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You should be engineering around the fact that you don't like your current solution.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Instead of locking yourself into Postgres by using advanced Postgres features and implementing &lt;code&gt;JOIN&lt;/code&gt;s to your other tables, try to keep your data as flat and as simple as you can. When you do inevitably need to move your data somewhere else, you can do so with minimal effort.&lt;/p&gt;

&lt;p&gt;When you're building software for a fast-growing company, a "clean" architecture isn't an &lt;em&gt;optimized&lt;/em&gt; one, but a &lt;em&gt;modular&lt;/em&gt; one that can be changed easily.&lt;/p&gt;

&lt;h2&gt;
  
  
  So I should just procrastinate?
&lt;/h2&gt;

&lt;p&gt;It's not about procrastinating architectural decisions, it's about being able to make smarter decisions once the real data comes in. As an engineer, it's impossible to predict every pivot the business will make, every requirement a customer will have, and every technology that will be released in the future. Your goal is to engineer a system that does its job while delaying decisions you don't &lt;em&gt;need&lt;/em&gt; to make until you have more information.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Cryptography Course Released on Boot.dev</title>
      <dc:creator>Lane Wagner</dc:creator>
      <pubDate>Tue, 24 Jan 2023 15:54:07 +0000</pubDate>
      <link>https://dev.to/bootdotdev/cryptography-course-released-on-bootdev-2ih1</link>
      <guid>https://dev.to/bootdotdev/cryptography-course-released-on-bootdev-2ih1</guid>
      <description>&lt;p&gt;Greetings! We're excited to announce that we've unveiled a brand-new &lt;a href="https://boot.dev/learn/learn-cryptography" rel="noopener noreferrer"&gt;cryptography course&lt;/a&gt; on &lt;a href="https://boot.dev" rel="noopener noreferrer"&gt;Boot.dev&lt;/a&gt;. We're convinced that this new experience is truly one of a kind. If you want to learn cryptography while writing real code in the &lt;a href="https://boot.dev/learn/learn-golang" rel="noopener noreferrer"&gt;Go programming language&lt;/a&gt;, you should check it out.&lt;/p&gt;

&lt;p&gt;You can &lt;a href="https://boot.dev/learn/learn-cryptography" rel="noopener noreferrer"&gt;get started for free here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why learn cryptography?
&lt;/h2&gt;

&lt;p&gt;Ever wondered how your data is kept safe online? This course will teach you about encryption, password security, ciphers, and more. After you master the fundamentals, you'll learn how each cryptographic primitive is used in real-world applications.&lt;/p&gt;

&lt;p&gt;If you're interested in becoming a valuable back-end engineer, an understanding of cryptography will set you apart from other candidates that will fail to answer basic security questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapters
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Symmetric Encryption
&lt;/h3&gt;

&lt;p&gt;Learn the basics of cryptography: encrypting and decrypting a secret message with a key&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Encoding
&lt;/h3&gt;

&lt;p&gt;To be able to work with encrypted data, you need to understand how information is encoded in different formats&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Brute Force
&lt;/h3&gt;

&lt;p&gt;Learn about the most primitive, but most important kind of crypto attack&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Caesar Cipher
&lt;/h3&gt;

&lt;p&gt;Learn about the fundamentals of ciphers, starting with Julius Caesar's famous cipher&lt;/p&gt;

&lt;h3&gt;
  
  
  5. XOR
&lt;/h3&gt;

&lt;p&gt;Study the importance of the XOR operation in cryptography and how it can be used to create the perfect cipher&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Stream Ciphers
&lt;/h3&gt;

&lt;p&gt;Stream ciphers can be used to encrypt data as it flows through a system&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Block Ciphers
&lt;/h3&gt;

&lt;p&gt;Block ciphers are commonly used to encrypt large amounts of data at rest, like entire hard drives&lt;/p&gt;

&lt;h3&gt;
  
  
  8. DES
&lt;/h3&gt;

&lt;p&gt;DES is an older block cipher that's important to understand to appreciate modern block ciphers&lt;/p&gt;

&lt;h3&gt;
  
  
  9. AES
&lt;/h3&gt;

&lt;p&gt;AES is a secure, modern block cipher that's used in many production applications&lt;/p&gt;

&lt;h3&gt;
  
  
  10. Asymmetric Encryption
&lt;/h3&gt;

&lt;p&gt;Asymmetric encryption is used in HTTPS, digital signatures, and anywhere two parties need to securely communicate&lt;/p&gt;

&lt;h3&gt;
  
  
  11. RSA
&lt;/h3&gt;

&lt;p&gt;RSA is one of the most popular asymmetric encryption algorithms&lt;/p&gt;

&lt;h3&gt;
  
  
  12. Hash Functions
&lt;/h3&gt;

&lt;p&gt;Hashing has many applications in cryptography, including password security and message integrity&lt;/p&gt;

&lt;h3&gt;
  
  
  13. Digital Signatures
&lt;/h3&gt;

&lt;p&gt;Digital signatures are a way to prove that a message was sent by a particular party&lt;/p&gt;

&lt;h3&gt;
  
  
  14. KDFs
&lt;/h3&gt;

&lt;p&gt;Key derivation functions are how we derive keys from passwords or other keys securely&lt;/p&gt;

&lt;h2&gt;
  
  
  What's inside?
&lt;/h2&gt;

&lt;p&gt;You'll find text and image explanations of all the concepts, as well as video explanations of some of the more visually demanding lessons. You'll be writing real code in Go in most of the exercises, and our system will instantly check your code and provide instant feedback. You'll only enjoy the course if you enjoy an engaging hands-on experience.&lt;/p&gt;

</description>
      <category>welcome</category>
      <category>community</category>
      <category>discuss</category>
    </item>
    <item>
      <title>If You're Learning Back-end, Don't Start with Frameworks</title>
      <dc:creator>Lane Wagner</dc:creator>
      <pubDate>Mon, 16 Jan 2023 15:46:09 +0000</pubDate>
      <link>https://dev.to/bootdotdev/if-youre-learning-back-end-dont-start-with-frameworks-4348</link>
      <guid>https://dev.to/bootdotdev/if-youre-learning-back-end-dont-start-with-frameworks-4348</guid>
      <description>&lt;p&gt;Look, I don't hate frameworks. I'm not as starry-eyed as some other developers, especially when it comes to &lt;em&gt;back-end&lt;/em&gt; frameworks, but I don't think there's anything wrong with using tools that make you productive. On the contrary, I'm &lt;em&gt;always&lt;/em&gt; trying to find tools that make me as productive as possible.&lt;/p&gt;

&lt;p&gt;That said, I'm adamant that you should not &lt;em&gt;start&lt;/em&gt; with frameworks when you're &lt;a href="https://boot.dev"&gt;learning back-end development&lt;/a&gt;. I'm not saying you shouldn't use them at all, but I am saying that they are a poor tool for learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frameworks automate the boring stuff
&lt;/h2&gt;

&lt;p&gt;Frameworks are &lt;em&gt;great&lt;/em&gt; at automating all that boring stuff, like boilerplate code, authentication, and &lt;a href="https://blog.boot.dev/clean-code/death-taxes-and-database-migrations/"&gt;database migrations&lt;/a&gt;. Who wants to do the same thing over and over again?&lt;/p&gt;

&lt;p&gt;Trouble is, when you're just starting, those boring details are &lt;em&gt;exactly&lt;/em&gt; the things you should be practicing. They're the building blocks of back-end applications, the foundations of what you need to know. And when you use a framework, you're missing out on all that good stuff.&lt;/p&gt;

&lt;p&gt;Like any good developer, I use a library and call &lt;code&gt;sha256.Hash(text)&lt;/code&gt; when I need to hash some data. I don't try to write my cryptography from scratch! That said, I've taken the time to learn and understand &lt;em&gt;why&lt;/em&gt; &lt;a href="https://blog.boot.dev/cryptography/how-sha-2-works-step-by-step-sha-256/"&gt;sha256&lt;/a&gt; is a good choice in a given scenario, and what security it provides me. Similarly, when you're learning back-end development, frameworks are just too high-level to be a good starting point.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frameworks are easy to learn, that's the whole point
&lt;/h2&gt;

&lt;p&gt;The entire selling point of a framework like Django, Flask, or Rails is that they're easy to use. They take the repetitive, boring stuff and give you an opinionated way to do it. With just a few CLI commands, you can have a fully-functional web application up and running!&lt;/p&gt;

&lt;p&gt;The problem with starting this way is that you'll have an entire codebase, with mountains of dependencies, and you'll understand how almost none of it works under the hood. When you encounter issues (and you will) you'll be spending hours trying to work backwards. The problem is very similar to one of my favorite memes: &lt;em&gt;"Hours of debugging can save you minutes of reading the docs!"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RK82_UUs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://pbs.twimg.com/media/E2A3GwaXsAA_GwQ%3Fformat%3Djpg%26name%3Dsmall" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RK82_UUs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://pbs.twimg.com/media/E2A3GwaXsAA_GwQ%3Fformat%3Djpg%26name%3Dsmall" alt="hours of debugging" width="500" height="553"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the long run, it will be a lot faster to learn the basics of back-end servers. You can always learn a framework later, it's &lt;em&gt;really&lt;/em&gt; not that hard because you understand the pieces that are being abstracted away from you.&lt;/p&gt;

&lt;h2&gt;
  
  
  I made the mistake of starting with Django
&lt;/h2&gt;

&lt;p&gt;When I was getting my &lt;a href="https://blog.boot.dev/jobs/is-coding-bootcamp-worth-it/"&gt;CS degree&lt;/a&gt;, I decided I wanted to build a web app, and up until that point, I hadn't done much with the web yet. All I had done was write little Python scripts. RESTful servers, HTTP requests, SQL databases -- I had no idea what any of that was.&lt;/p&gt;

&lt;p&gt;Anyhow, I heard Django was popular, so I decided to use it to build a website. I followed "hello world" style tutorials and in a few days I had a working website! I understood how to change variables here and there to make the page display what I wanted, but boy howdy I had &lt;em&gt;no idea&lt;/em&gt; what was going on under the hood.&lt;/p&gt;

&lt;p&gt;I stressed for weeks trying to make sure my site was "secure". Every blog post online kept telling me I had to set this configuration, or that setting, if I wanted to be able to run my Django server in production. I avoided the database like the plague, instead using Django's ORM and admin panel to make changes to my data. I'm embarrassed to admit that at the time I didn't even understand that the database was a separate thing from the web server.&lt;/p&gt;

&lt;p&gt;Anyhow, a year later when I &lt;a href="https://boot.dev/learn/learn-golang"&gt;learned Go&lt;/a&gt; and built an API from scratch, &lt;em&gt;everything started to come together for me&lt;/em&gt;. I finally understood all the moving parts, and how they are actually separate ideas that can be combined in different ways.&lt;/p&gt;

&lt;p&gt;Since then, I've worked with minimalistic Go servers, Django, Flask, Rails and Express. I'm no longer stressed when I build a server in Django because I know what tradeoffs are being made. Django and Rails aren't bad tools for building web apps, they're just bad tools for learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  How far down the rabbit hole do I need to go?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XV-d1xbM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.boot.dev/img/800/applepie.png.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XV-d1xbM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://blog.boot.dev/img/800/applepie.png.webp" alt="apple pie carl sagan" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you wish to make an apple pie from scratch, you must first invent the universe.&lt;/p&gt;

&lt;p&gt;-- Carl Sagan&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You might be thinking, "Okay, I get it, I shouldn't start with a framework. But where should I start?"&lt;/p&gt;

&lt;p&gt;It's a fair question. Following fallacious "slippery slope" logic, we might think something like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Before a framework, build a web server from scratch&lt;/li&gt;
&lt;li&gt;Before a web server, build the HTTP protocol from scratch&lt;/li&gt;
&lt;li&gt;Before HTTP, build the operating system from scratch&lt;/li&gt;
&lt;li&gt;etc...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's not what I'm saying. If you want to be a professional in any industry, I think it's a good rule of thumb to go one layer down the stack from where you plan to do most of your work.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Want to build operating systems? It will help to understand the kernel.&lt;/li&gt;
&lt;li&gt;Want to write an ORM? It will help to understand databases.&lt;/li&gt;
&lt;li&gt;Want to write Rails apps? It will help to understand web servers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Lastly, full-stack and back-end development are different
&lt;/h2&gt;

&lt;p&gt;One last thing I want to point out is that full-stack and back-end are &lt;em&gt;not&lt;/em&gt; the same thing. I think many developers who start with &lt;a href="https://blog.boot.dev/backend/frontend-vs-backend-meaning/"&gt;front-end&lt;/a&gt; get a bit confused about this. They think that the back-end is just the thing that serves the front-end.&lt;/p&gt;

&lt;p&gt;That certainly &lt;em&gt;can&lt;/em&gt; be the case in smaller applications, but as a company grows, the back-end tends to become larger and more complex. Frankly, the servers that serve up to front-end might end up being some of the simplest parts of the stack.&lt;/p&gt;

&lt;p&gt;While I still think it's best to write a server from scratch at least once, it's even more important if you want to be a &lt;em&gt;back-end&lt;/em&gt; engineer rather than a &lt;em&gt;full-stack&lt;/em&gt; engineer. If you're a back-end engineer, you'll be spending most of your time working on the back-end, and you'll be digging into more niche problems where a deeper understanding of server architecture will be more helpful.&lt;/p&gt;

&lt;p&gt;I hope this helps you avoid some of the pain I experienced, and as always, best of luck! If you're interested in learning back-end development, &lt;a href="https://boot.dev"&gt;check out Boot.dev&lt;/a&gt;, I think it will help.&lt;/p&gt;

</description>
      <category>backend</category>
      <category>learning</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
