Let's come back a moment to the Boolean data type.
In this lesson, I'm going to show you how you can
make some tests and get a Boolean as a result. And
this Boolean will be the foundation for using
conditions and loops. And for this lesson, I'm
going to just use the Python Shell here to keep
things very simple. So first, we have the Boolean
data type, with True and False as a value. Okay,
only two values, then what I can do, let's say I
want to test the equality between two values, I
want to test so let's make a very simple test. I
want to test if one is equal to one. And this is
True. And as you can see to test the equality I use
two equal signs, okay, just one equal sign is to
assign a value on the right to a variable on the
left. With two equal signs, this is important to
make the difference, this is going to compare the
value on the left and the value on the right and
return a Boolean. Is this True, or is this False?
Now if I want to test, let's say one is equal to
two, well, this is False. Okay, so that kind of
conditional statements, we are going to use that
in the conditions and in the loops. Now let's see
what we can do here. So we can use integers. Okay,
we can compare two integers, we can also compare,
let's see two is equal to two. So 2.0 is equal to
2.0. We can also compare float numbers. We can
compare strings. Okay, hello is equal to hello.
Now if I do the same, but let's say I put an
uppercase here, this is False, and then well, we
have just seen the equal equal operator. Okay,
this is just one comparison operator, and you have
different operators for different stuff you want
to test. Now let's say want to test not to be
equality, the inequality. I want to test if one
is different than two. In this case, I'm going to
use exclamation mark equal. And this is True
because one is different than two. If I test if
one is different than one, this is False. Okay, so
that's it for the equality. And now what you can
test is you can test if a value is for example,
lower than another value. Let's test if one is
lower than two with this angle bracket here. And
this is True. Now let's test if one is lower than
one, this is False, because just one angle bracket
means that it is strictly lower than this, okay.
So one is not strictly lower than one. So this is
False. Now I can also test with the angle bracket
and equal and this means lower or equal than one.
So if I press Enter, we have True because one is
lower or equal than one. And I can make the
opposite also, I can test if it is greater. So if
one is greater than two, this is False. One is
greater or equal than two, so this is still False.
Let's put one and this is True because one is
greater or equal than one. Okay, now, two is
greater than one. In this case, that works. Okay,
so basically, you have six comparison operator,
the equal equal, the difference, then, and
then the strictly lower, lower or equal, strictly
greater, and greater or equal. Okay. And just one
last thing I'm going to show you, which is very
specific to Python, is let's say you have a list,
number_list. I'm going to create a list with just
some numbers, okay, one, two, and four. What I can
do is I can check if a value is inside that list,
very simply. I can do for example, to in number_list,
and this is True. So you put first the
value, and then the keyword in and then the name
of the list. So here we test if two is inside that
list, yes, because it's here. If I try with three
in number list, this is False because there is no
element that correspond to three in the list. So
that is very specific to Python. And that's
something that you are going to use also a lot in the future.