MISSION 313

Conditional Statements

Building upon what was taught in the Lists and For Loops mission, you will continue to build and refine your Python programming skills by learning to answer more granular questions using conditional statements such as if, else, and elif statements.

In this mission, you'll learn concepts such as conditional statements to control the flow of your code, the logical operators such as AND and OR, and how to use comparison operators such as >, <, <=, etc. Combining all of these concepts is crucial for both a Python developer and a data scientist — the combination of Python conditionals allows you to have more control of your code. For example, if you had a list of mobile applications and you wanted to compute the average, you could use conditional statements and comparison operators to see the average rating of apps that are not free versus those that are free.

Upon completion of this mission, you'll feel more confident in using Python for data science. If you feel like you need practice, feel free to think of something you can create using what you've learned so far; it doesn't have to be big, it can be something, small like a calculator.

Objectives

  • Learn to use python conditionals such as if, else, and elif statements.
  • Lean to use logical operators.
  • Learn to use comparison operators.

Mission Outline

1. If Statements
2. Booleans
3. The Average Rating of Non-free Apps
4. The Average Rating of Gaming Apps
5. Multiple Conditions
6. The or Operator
7. Combining Logical Operators
8. Comparison Operators
9. The else Clause
10. The elif Clause
11. Next steps
12. Takeaways

python-for-data-science-fundamentals

Course Info:

Beginner

The median completion time for this course is 5.8 hours. View Details

This course is free and includes 7 missions, 1 guided project, and 1 tutorial.  It is the first course in the Data Analyst in Python path and Data Scientist in Python path.

START LEARNING FREE

Take a Look Inside