Lesson 5
Variables and Booleans in Python: Tracking Travel Visits
Introduction to Python Variables and Booleans

Another unit awaits us, and this one promises to be quite adventurous! We're going to dive into the world of Python variables and Booleans. You may recall our earlier lessons in which we discussed the basics. Now, we're going to delve deeper, combining our knowledge of strings— which represent data— with the usage of Boolean variables, a simple yet powerful concept that can reflect a condition or status as either true or false.

What You'll Learn

In this unit, we'll define two string variables: each will hold the name of a destination. We'll also explore the use of Boolean variables— a type of variable that can only take one of two possible values: True or False. Imagine it as a light switch that can only be either on (True) or off (False). Here's a sneak peek:

Python
1destination_A = 'Paris' 2destination_B = 'Tokyo' 3 4has_visited_A = True 5has_visited_B = False

In essence, destination_A and destination_B store strings that represent travel destinations. In contrast, has_visited_A and has_visited_B are Boolean variables that inform us, like an on-off switch, whether we have visited these destinations or not.

Why It's Important

Understanding variables is one of the most fundamental skills in programming. Variables enable us to store, retrieve, and manipulate values in our code. On the other hand, Booleans allow us to make decisions and control the flow of our program based on certain conditions. Together, they are potent tools that can assist us in writing dynamic and flexible programs.

Wow, did we just finish the last lesson of this course? Everyone at CodeSignal (including Cosmo) is very proud of your progress and can't wait to see what you learn next.

We have a few more practice sessions though before we can call this course complete.

Onward to our practice exercises!

Enjoy this lesson? Now it's time to practice with Cosmo!
Practice is how you turn knowledge into actual skills.