Lesson 4️⃣: If Statements

Bitesize Key points from this lesson

  1. We looked at the program construct known as selection, which allows us to make decisions in our code.
  2. We learned about the if statement, which allows us to execute code only if a certain condition is true.
  3. We also learned about the elif and else statements, which allow us to execute different code depending on whether the condition is true or false.
  4. We discussed match case statements, which are a more advanced way to handle multiple conditions in Python. They allow us to match a value against several patterns and execute code based on the first match found.
  5. Lastly, we learned about both comparative and boolean operators which are used to set the conditions in our if statements. Comparative operators include ==, !=, >, <, >=, and <=. Boolean operators include and, or, and not.

Activities

The best way to improve your programming skills is to practice.
I created a course for learning Python that you can follow alongside these lessons.
You can check these out at BitFez’s Learning to code in Python Roadmap 🛣
You should specifically follow the Step 2: If Statement activities: