 Now that we've introduced this idea of variables and functions, we're starting to get into some of our control structures. The entire idea is if you think about it, what we've seen so far is realistically, we were only talking about code that sort of operated in a sequential manner. We would do one sort of command, you know, in this little circle, and then all our program would do after that is move to sort of the next line of code. But last week, we introduced this idea that we could also have functions. And the entire idea to a function was, well, I have some small tiny program that maybe does a few operations. And then I want to have my sequential program jump and I'm going to use sort of that term jump to some other place in memory. And again, we're still talking on this idea of things going in a sequential order, but that's where we could then have some type of return statement, then give the value back. Well, if you think about it, that sort of jumping around in memory, what we're doing is we're sort of controlling the structure of our code. But more to the point, everything still was acting sequentially going down, and then down, and just continuing on. But what happens if I really want sort of my code to jump around all the time? And that's again, where we get this idea of control structures, more specifically, the one we are talking about in this module is the idea of conditional statements. Realistically, if we follow this linear fashion, what can happen is maybe our code runs into a situation where we want to ask a question. And depending on the result of that question, we want to branch out and maybe do one thing, if it is true, and another thing, if it is false. And that is the idea of the conditional statement. A way to think about it is conditional statements operate with just a true or false evaluation. Again, something is true, I do one thing. If something is false, I do another thing. And that's it. Everything in the computer operates this way. Everything is again, just a zero or a one to the computer. Do I have electricity, or do I not turn on the light if I do turn it off if I do not. And so we're just effectively making these considerations. A great way to think about this is this is actually how we start to get into the big fancy magical world of artificial intelligence. The entire idea there is, well, what we think about as artificial intelligence is realistically, you know, if I look at this left circle, you know, something in our brain is telling us, oh, well, you know, that's a circle. But in reality, it's not a perfect circle, right? You know, there's this sort of little indentation going on here that this is dipped in a little bit more. But through some sort of, you know, internal fuzzy logic, we're able to say, yes, in fact, it's close enough. And that's perfectly fine for us. That's realistically what artificial intelligence is doing as well. Look at something and go, is it close enough? Okay, it's close enough. So when we start to look at this, what we have to do is make evaluations. And we use comparison operators to make those evaluations. Now, very similar to what we saw when we were dealing with something like division, arithmetic symbols that are not on our keyboard, some of the mathematical symbols that we use in comparisons don't exist on the keyboard. Something like the less than or equal to symbol, right? There is no, you know, carrot with a line underneath it in our code. And yeah, oh, you know, we could do the underlining, like format thing and word, but that's not realistically the equivalent of saying something like less than or equal to. So in sort of Python's perspective, we go with the symbol, and then simply put adding in the equal sign, so less than or equal to. Now, we do once again have a little bit of a struggle, because something like checking if something is equal. Well, if we think about it, this is known as our assignment operator. And that's the only purpose that it can serve inside of Python, it can't do, you know, assignment and comparison, Python won't allow that. So in that case, it works off of just saying double equals, that will be how we check to see if something is equal to something else. And conversely, since there is no equal sign with a slash on it, we'll just use the exclamation point, because you know, that is close to the equal sign that is effectively where we can go with that. So if we think about it, we can then start to look at some different types of comparisons. Let's say, for example, I have three variables, A, B, and C, each one of them has their own values to them. So when I want to do comparisons with them, I get a value out of that. So something like A 54 is 54 greater than C three. Well, obviously, we all can see that in, you know, in our world, we would say yes. But from a Python perspective, what we're doing is we're evaluating this expression. Is this a true or false statement? And as you can guess, when we say yes, what we're saying is that it is a true statement. That's why when we do the converse of this, if I said is a less than C, again, we're not saying yes or no, we're evaluating if this is a true statement or not is a less than C. Well, again, 54, we're saying 54 less than three, we all know that that is in fact a false statement. And just to continue on with that idea, you know, C is C less than or equal to C is three less than or equal to three. That is a true statement is a equal to be is 54 equal to 33.14 false. And finally is B greater than C is 3.14 greater than C or three. Again, that's a true statement. And just to use a an expanded idea. Now let's say I want to manipulate and interact with these a little bit. What if I said int B equal equal C? Is that a true or false statement? Think about it and then come back. Now, the idea is that we want to do this in code. And to do this, very similar to how we operated when we were working with functions, you know, if we think about a function, we would say def and then its name. So function name with some parameters. Instead, what Python does is it says, well, the first command you want to do is if if is going to be again a special character that is in Python, and it tells Python, hey, I'm about to do a comparison. And after that is some conditional statement. Now the entire idea to sort of this structure is if that statement is in fact true, go in to that indented block of code. So go in here and do whatever is inside of that code. Once you're done, just continue moving on with the rest of the program. If however, that code was false, skip over it. And just continue moving on without any regard. A way I like to think about this is let's imagine for a second you are on the highways. This is, I am not an artist. I am a computer science instructor. So let's say we're on I nine, right? Okay, we're on the road I nine, it's a two lane because roads. But, you know, oh, I'm traveling, I'm traveling, I'm traveling. There is going to come a time where either my car is out of gas, or I've sipped on a little too much soda, water, energy drinks, because, you know, long roads, and I have to make a decision. If, in this case, instead of my conditional statement, we'll go with, you know, a very clean one. If gas is less than, and we'll say I have, you know, less than 10% of my gas tank left. Oh, well, you know, there's a problem. I'm about to run out of gas. I'm on the highway. And I happen to see a little exit. And just to continue dry, drawing this out a little bit. There's some, you know, exit one going on here. Oh, well, I make a decision. Oh, well, I need to branch off real quick, fill up my tank. And just as we can think about this, again, I gas was low. I refill my gas back on the road. So I'm still continuing down the same path that I was going. I just needed to make sort of this offshoot for just a quick second. And so to kind of break this out, again, just fleshing this out in sort of code, you can see if I created a variable like x, let's say I say that x is 25. Okay, again, 25, that's loaded into memory. And then I can do some form of a comparison. Again, is 25 less than 50. Well, if that is a true statement, do this print command. Now, everything that we've done so far has only been talking about if statements. What happens if I want to control code when there's a false statement? And the way to think about this is using that same road analogy, I have sort of, I've come to the end of a road, you know, here's my want to be attempt at an octagon stop, there's my octagon road. And oh, I've hit the end of that road. Well, in that case, there we are. I might have some left road that I can go to or some right road that I can turn on to. And it really just depends on whether or not it is a true statement, or a false statement. Again, I'm still on my pathway, but I need to make a decision of yes or no. And in this case, how we expand on this is we continue with the idea of our if block. But again, if we want to sort of control what happens when we go with a false statement, we'll also include an else block. And the entire idea here is that, again, this died, this true statement doesn't happen. So none of this would happen in a false block. And again, I only go through do whatever the statement was when it was false, and then move on just as is. And again, just to see this in action, we can do sort of the same thing. We could take, for example, that if x is less than 50, and do things like get user inputs. So the entire idea here is the user is prompted, hey, type in a number, because again, we may not know what that number is, store it in x, then convert x into an integer. Again, remember, it is currently stored as a string. And so again, we're doing a comparison. So we need to compare a number to a number. And so we would say, oh, well, is x less than 50? If it is, again, we just follow the same path that we did beforehand. But else else x is not less than 50. Oh, well, in that case, it's greater than 50. Technically, it could also be 50, you know, greater than or equal to 50. But for the sake of like space on my screen, I just did not do that in place. So let's see this in action. So again, what we're looking at is I want to establish some type of variable. So let's say, for example, I'm working off of, you know, I'm, I'm trying to think about my head, I am going to talk about a particular day. So day equals Sunday, and just to zoom that in. So again, all right, well, I happen to have a variable it is currently stored as day. Now I can't do any less than or equal to to a string, but I can still do a comparison with that string. If day is equal to Saturday, we'll say, all right, well, we know it isn't but again, work with the flow. We will print print party because it's summer and we'll just, there we go, we got some at signs as well, because it's the weekend, it's the summertime, you know, Saturday is the day to get crazy. Else, else, it's any day besides Saturday, including our day print. Well, you know, Sunday is a school night. So I should be studying dot, dot, dot. Okay, well, again, what we're doing here is we're going to do an evaluation. We're going to check is my day equal to Saturday. If it is print party. Otherwise, it is not Saturday day is not Saturday print. I should be studying. I should be studying. And if you're watching this video, you are studying. So good on you. But again, we could change that. So change this to Saturday. And again, we're now just going to see what we think will happen. And again, we'll do the comparison is day equal to Saturday. We shift enter. We've loaded our new changes.