If Else Statement and Comparisons - Python for Absolute Beginners Course

Published: 19 April 2022
on channel: 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.


Watch video If Else Statement and Comparisons - Python for Absolute Beginners Course online without registration, duration hours minute second in high quality. This video was added by user Programming With Nick 19 April 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 396 once and liked it 20 people.