Boolean Variables & If Statement - Python for Absolute Beginners Course

preview_player
Показать описание
In this Python tutorial we are going to learn about Boolean variables and IF statements. So far we have learned about three types of things, that we can store in a variable, a String, an Integer, or a Float.

In this video we are going to learn about a 4th type. This type is called Boolean or Bool for short.

A Boolean variable can only have two possible values, either True or False.
In this example, I have created 3 variables, a String name, An Int age, and a float weight. Let’s create another variable that is going to be a Boolean variable.

Boolean variables are useful to represent things that only have two states, either on or off, or True or False. Let’s create a variable that will represent if a person is an adult or not. A person can either be an adult or not so a Boolean variable is ideal to represent it. So I create a descriptive variable name:

is_adult = True
or is_adult = False
Рекомендации по теме
Комментарии
Автор

It will help you memorize all the stuff we discuss in this lesson.

programmingwithnick
visit shbcf.ru