Get The Learn to Code Course Bundle!
Enroll in The Complete Python Course on Udemy!
In this video we’re going to be talking about Boolean operators. So, what is a Boolean? This is a general programming concept, and a Boolean consists of two items – true and false. Basically, truth checking. So, let’s have a look at some of the ways we can generate a true or false. Let’s start with 5=5. In math terms this is true, but a single equal sign is used to assign a value to a variable in Python. When comparing two numbers or strings you will need to use double equal signs like so.
Python will return True. If we try 5==4, Python will return False. We can also write the following:
5 is 5
Python will return True. If we were to write 5 is 4, Python will return False. Similarly, 5 is not 4 will return True. We can also compare strings.
"I like pizza"=="I like pizza"
Python will return true. In the next video we will cover Python’s version of arrays which are called lists.