 Hello, everybody. Today, we're going to be taking a look at comparison, logical and membership operators in Python. Operators are used to perform operations on variables and values. For example, you're often going to want to compare two separate values to see if they are the same or if they're different within Python. And that's where the comparison operator comes in. Right here, you can see our operators, you can also see what they do. So this equal sign equal sign stands for equal, we have the does not equal, the greater than less than greater than or equal to and less than or equal to. And honestly, I use these almost every single time I use Python. So these are very important to know and know how to use. So let's get rid of that really quickly and actually start writing it out and see how these comparison operators work in Python. The very first one that we're going to look at is equal to now you can't just say 10 is equal to 10. Let's try running that really quickly by clicking shift enter. It's going to say cannot assign to literal. That's because this is like assigning a variable, we're trying to say 10 is equal to 10. And then we can call that 10 later. But that's not how this actually works. What we're trying to do is to determine whether 10 is equal to 10. So we're going to say equal sign equal sign. And then if we run that by clicking shift enter again, it's going to say true. Now if we put something else like 50 in there, and we try to run this, it's going to say false. So really what you're going to get when you use these comparison operators is either a true or a false. If we take this right down here, we can also say does not equal. And we're going to use an exclamation point equal sign. And that says 10 is not equal to 50. And that should be true. You can also compare strings and variables. So let's go right down here. And we're going to say vanilla is not equal to chocolate. And when we run this, it'll say false. Now if it was the same, just like when we did our numbers, it should say true. And we can also compare variables. So we'll say x is equal to vanilla. And y is equal to chocolate. And then when we come down here, we can say x is equal to y. And it'll give us a false. And we say x is not equal to y. And it'll give us a true. The next one that we're going to take a look at is the less than. So let's copy this one right up here. Let's scroll down. And let's say 10 is less than 50. Now this will come out as true. Now let's say we put a 10 in here. Before 10 was of course less than 50, but is 10 less than 10? No, that's false because they are the same. So if we want to now put that as true, all we would have to add is an equal sign right here. And this would say 10 is less than or it is equal to 10. And now it's true. Of course, we can say the exact same thing by saying greater than so 10 is equal or greater than 10. That'll be true because 10 is equal to 10. We can also say 50 is greater or equal to 10 because 50 is obviously greater than 10. Now let's look at logical operators that are often combined with comparison operators. So our operators are and or and not. So if you have an and that returns true, if both statements are true, if it's or only one of the statements has to be true, and the not basically reverses the results. So if it was going to return true, it would return false. I don't use this not one a lot, but I will show you how it works. So let's actually test that out. So before we were saying 10 is greater than 50. And of course, this returned false. So now let's add a parentheses around this 10 is greater than 50. And we're going to say and we'll do an open parentheses 50 is greater than 10. Now this statement right here is true 50 is greater than 10. So we have a true statement and a false statement. But this and is going to look at both of them. It's going to say they both need to be true in order to return a true. So let's try running this. And we still have a false if we want it to return true, we're going to have to change this to make it a true statement. So 70 is greater than 50, and 50 is greater than 10. When we run this, it should return true. Now let's look at the or. So let's copy this. And we'll say 10 is greater than 50 or 50 is greater than 10. Now this is a false statement. And this is a true statement. So if even one of them is a true statement, the output should be true. And again, we can do this even with strings. So we can do vanilla and chocolate. There we go. And vanilla is actually greater than chocolate because V is a higher number in the alphabetical order. So V is like 20 something whereas chocolate is three, right. So it actually looks at the spelling for this. So if we say or here, it will come out true. And if we say and here, it should also be true because V is greater than C and 50 is greater than 10. So this should also be true. Now let's copy this right here. And we're going to say not. So what we had before is 50 is greater than 10 that returned true. But now all we're doing is putting not in front of it. So instead of returning true, it's going to return false. So now let's take a look at membership operators. And we use this to check if something whether it's a value or a string or something like that is within another value or string or sequence, our operators are in and not in. So it's pretty simple. If it's in, it's going to return true if the sequence with a specified value is present in the object, just like we were talking about. And for not in, it's basically the exact same thing if it's not in that object. So let's start out by taking a look at a string. We're going to say ice underscore cream is equal to I love chocolate ice cream. And then we're going to say love in ice underscore cream. And that will turn true. So all we're doing is searching if the word love or that string is in this larger string, we could also just do that by literally copying this and putting this where this is we can check is this string part of this string and it'll say true. We can also make a list. So we'll say scoops is equal to and then we'll do a bracket and we'll say 12345. And then we'll say to in scoops. So all we're doing is searching to see if two is within this list and that should return true. Now if we put a six here, and we said not in, it will also return true because six is not in scoops. And that is true. And just like we did, we could also say wanted underscore scoops and we'll say eight. So I wanted eight scoops. So we can say wanted scoops in scoops. And this should return true because there's not an eight within the scoops that we wanted. And if we said in and we said we wanted eight, is that within our list that we created? And that's going to return a false. So that is a quick breakdown of comparison logical and membership operators. I hope that this was helpful. Thank you guys so much for watching. If you like this video, should like and subscribe and I will see you in the next video.