If Else Statement and Comparisons - Python for Absolute Beginners Course

Опубликовано: 19 Апрель 2022
на канале: Programming With Nick
396
20

In this video, we are going to learn more about the if statement, and we are going to use it with comparisons as well.

I have created a program that uses two variables, a String name, and a Boolean variable is_adult. I have also included an if statement to check if the is_adult variable is True. If the variable is True the program will print “Nick is an adult.” He can vote. Note that I have separated the if statement, this block of code, with two white lines. We can add as many white lines as we want, the program will just ignore them. I use them to separate blocks of code to make the program more readable.

Ok, the program works, it prints a message when the variable is True. But what if we wanted to print another message when the variable value was False.


Смотрите видео If Else Statement and Comparisons - Python for Absolute Beginners Course онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Programming With Nick 19 Апрель 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 396 раз и оно понравилось 20 людям.