Boolean Variables & If Statement - Python for Absolute Beginners Course

Опубликовано: 15 Апрель 2022
на канале: Programming With Nick
691
18

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


Смотрите видео Boolean Variables & If Statement - Python for Absolute Beginners Course онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Programming With Nick 15 Апрель 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 691 раз и оно понравилось 18 людям.