 What's going on guys? Rootatnullshow.com here today and we're looking at even more Python today. Today we're continuing off of our little conditional statements adventure, journey, extravaganza and today we're going to check out some logical operators. Now logical operators are kind of exactly what they sound like. They help us decide and make decisions that make sense or are sort of logical. So we do this when we're testing in conditional statements with like things like and or or and not and that sort of things. So and can let us like test for multiple and and or let us understand and look at multiple expressions or multiple conditions and try and try and treat them as one. Almost like sometimes you might be able to consider it like if you're nesting conditional statements to that's kind of part of it. But with logical operators when you're using them in conjunction with one like one big condition with like small sub parts of it. It's a little bit linear and I feel like sometimes it's not as precise because you can't you can't really error check sometimes if you are if you're combining two things together. But hey, let's give it a look. I'm going to open up idle and I'm going to open up the previous email little thing that we've been working on lately that the one that we the little project little program whatever you want to call it that we made a just last tutorial because what we're going to do here is I want to try and almost I don't know the correct word for it. But I'm thinking you would just minimize it to optimize it. I don't think it'll be optimizing because we're not really making anything different. We're just sort of exploring this idea in a different way. If that makes sense. So I'm going to copy this function here that if the email is valid function and we're going to mix if the end symbol is in the email and the dot symbol in the email. So we're going to use that logical operator and and if you look over here in that effects table it's the condition the entire condition will evaluate the true if both expressions are true. So in this case we're trying to look for the the at symbol and the dot. So when we do and we will have a new one here and in email. So we can kill this line because it's going to be one here and we can have an else we can have if that doesn't work then else actually no you don't want to display out on the screen. This email does not look valid to me and then we will return false. So we're doing practically the same thing we did in those other else statements but it's been shortened by a great deal because we're sort of combining these things but the thing is you can't test whether you can't find the at symbol or you can't find the period since they're combined to one expression I suppose you could do it once more by checking individually whether the and symbol or the dot symbol but that's kind of doing the exact same thing as we just previously did in the nesting statements. So maybe it's a good idea to use this this this this broad condition whether the and symbol the at symbol and the period or in the email and then breaking it down once more into the answer if the at symbol is in there and then you have another statement for if the dot symbol is in there so you just have a whole nother if code block and that might be a little bit hectic I don't know it's it's whatever you as a programmer feel like you want feel like you want to put that much effort in but this is this is what it will do it's checking for both the at symbol and the period so let's try and run it let's see what it'll do if we please enter an email let's say let's say root that email doesn't look valid to me let's try it again let's do root at null shell I see it doesn't look value again but if we run it last time it'll give us a notification that hey we just can't find the period but in this case we don't know whether it's the period or the at symbol that we can't find if we type in root at no shell dot com the email looks valid because we found both the at symbol and the period okay okay so now we've been using the and keyword in conjunction so what if we change it to or if we change it to or so if we find one of these then it'll evaluate the true but in that case it's going to have only one of them but we don't want that what if we did not if not so if it didn't find either one of these if it didn't find this one or that one it'll we should reverse the if and the conditional statements we can change this down here in the else to the correct finding and this one up at the top to the bad finding so we'll try and run that root I'll try it again root at no shell okay see I hadn't thought this through and entirely the way I looked at it because it might be singling out one or more I have not sat down and actually tried to figure out how the logic would work in the scenario but if we try it root at no shell dot com because it's found one it looks like it will still be able to consider this correct because we have that or in there so what if we did if not and so if it finds these if if it does find these both in there the at symbol and the period that's correct so if not it'll display the bad thing and if it is it'll display the good thing so using or in this case wouldn't really make a lot of sense but I'm sure you guys can understand that idea if one of these is correct this or that so I don't I feel like I don't have to run through that idea for you and you can you can figure out the syntax of course by yourself but not is it is a little interesting in the way where in like where it should be you can't have it not you can't have not inside the parentheses at least I don't think you can it's worth a try let's give it a go okay it's still working so there you go you and I both learned something new today if we go into root at no shell dot com that looks good we tried again just your root email looks valid huh it's it's interesting what if we try it's not in a completely different case because it might be not this and that it might be considering this as one expression because we had the not in here like we did just a moment ago that might treat it as an or because it's only singling out one let's try email doesn't look valid if we do it again root at no shell dot com email looks valid root at no shell it does not look valid but yeah it does depend on where the not is inside the syntax that's a little tough that might be a little tough to understand and figure out huh I'm sorry whoops I don't have to run that again root at no shell because it's not finding that other one so yeah you can combine these logical operators to become to make a real huge fluster cock and not have any idea what you're doing like I'm sort of doing right now but when you try and think it through you should be able to determine the simplest way to test these variables I myself prefer nesting these because it's just so it's just so drawn out and you can test for both scenarios that I don't see the dot I don't see that symbol and this one you can't tell it's it's it's shorter it's faster I suppose but at the same time just understanding this might be a little tough so it's it's more of a personal choice I feel like you can use logical operators and then nest after that so you have like that general specific theme you're like zoom you're zooming in on the project on the problem whatever you want to call it so yeah but there's my little run through for today I hope you guys enjoyed this I know this one is a little tough to wrap your head around but if you keep watching the first portion of the video you might be able to understand it because and and or are simple to understand if they're in the right context but if you screw around with them too much you'll just all you'll do is lose yourself inside a labyrinth so thank you guys for watching though thank you for listening I really love having you guys in the audience please give me a like maybe leave a comment maybe subscribe I don't know it's it's really whatever you feel generous enough to do today so have a great day guys goodbye