 Now that we're talking about conditional statements, we also run into a not a problem, but a particular Circumstance what happens if I happen to want to ask something like else if or there are tons of forks in the road So if we think about our road analogy for a second There's one branching point. Here's another weird branching point. Here's another weird branching point This is the worst road ever designed but again, I Am a computer scientist not a civil engineer But let's imagine someone decided that this was the road that we wanted to build Terrifying, but you know, we have roundabouts. So technically true Anyways, the entire idea is we can use something known as a chained Conditional statement to basically say we want to have multiple types of evaluations Again, if we think about our fork in the road if one of them is true, we just go do that Move on with our code. That's it. But maybe when we say that this statement was false. Oh Well, maybe we happen to have other Options that we want to work off of maybe we have another criteria and we have you know to work off of it So, oh, well, that's true. So we'll do that one instead. Well, if that one's false, maybe we happen to have another one Maybe if that one's false we could do some else statement entirely a great example of this would be something like a grade calculator the entire idea to a great Calculator is if you think about it is just checking if your grade is above the prior your your Last grades lower bound. So what does that mean? Oh? Well, we're basically saying is if we're above 92 great. We're an a else if We're above 84. We've got a B else If we're above 76, we've got a C else If we're above 68, we've got a D or Finally a final else technically we don't even need that last if statement because everything else Well, you either got your a your B your C your D or your F So in this sort of light we can do that type of evaluation So let's say for example, we were going to build that grade calculator now How again? I like to operate is I like to build the code out and then place it into a function So we're going to first say that we have a grade and let's go Easy enough a 95. Okay Now we need to make our evaluation if my grade is greater than or equal to 92 Your letter grade will be an a that's it. Okay fair enough But for our sake I'm going to expand this out. Alright, we're only gonna work off of one You know pass or fail style class here. You either have an a or you Fail miserably. I'm a terrible instructor. Ha ha ha ha and then finally print letter grade letter You got an a can because a 95 is greater than or equal to an a or a 92 But you could imagine that if I came in and did something like an 85 check that same Evaluation You have enough now again. We know that that's not enough. We need to continue and expand on this This is again where we can use a command Known as elif elif is just the shorthand version of else if and we can give elif more conditional statements to work off of Grade is less than or equal to and I'm going to cheat and look at them 84 Now the entire idea here is again the first condition is check Was it better than a 92 if it was it was an a that's it else? Oh, what we've said is grade is not less or sorry not Larger or grade is Less than 92 that's Effectively what we've just established when we find out that this is a false statement. Oh, well now we check We know grade is less than 92 is grade greater than or equal to 84 if it is Letter is now equal to be ah and This is where we can do a little bit of cheating a little bit of cheating But as you can imagine we've got to do C and D. I'm gonna highlight copy Bam Bam, I'm just gonna paste those in copy and paste don't copy and paste from the internet I know I'm on the internet Copy and paste code you write don't copy and paste code. I write I guess either way Let me just finish this up. So we're at a 76 and a 68 and then see and then a D Okay, well again, we've made some changes Let's load those in the memory and then let's see what my final grade is now that I have an 85. I Gotta be awesome Now let's convert this into a function and luckily it's after you've built sort of the code in this light It's very easy to Switch it over Realistically you can come in at the very top Define your function name. I'm gonna call it letter grade and Since I've been doing my evaluations off of the variable grade. I'm gonna just continue and cheat and use that name again and so now I'd come in highlight all of that text hit the tab key that's gonna move everything into my function And there's only one final step that I need to do. I've been working off of this letter variable, right? But I need to actually Return my letter Now again if I compile this up and run it, it's not quite right because again if I were to change raid It stays the same and the issue is is because Specifically I've never called letter grade. So now that we've at least established our our world I can do a little bit of moving around. I'm gonna take my grade doesn't need to be before this code anymore because I'm no longer evaluating it linearly. I can remove that. I'm gonna put it just below that again I've made my grade I'm going to get my letter By calling my function letter grade Off of my grade. So yes, I know this can be super But we're going to make a variable called letter that is going to call the letter grade function letter grade function and we're going to use the parameter or the variable grade as Our criteria if that still seems super funky for you Of just where those words and coming in together comes into play. I'm actually just going to I'll call it final score. I don't like short-handing it so final score and Final we'll call this Final letter there we are so again, I've got a final score 95 I've got a final letter that's going to be my letter grade and then I have a function letter grade That I use final score off of so again, I've made this and so now that all of that is bundled into one single cell I can see oh, it's an a or 75 oh, it's a D or 79. Oh, that's a C or 59 oh, that's an F because again we bounce through we see that 59 is not greater. So that's a false statement 59 is not greater than 84. That's a false statement 59 is not greater than 76 false statement 59 is not greater than 68 false statement else So all else fails We basically have said you didn't get an a you didn't get a B you didn't get a C You didn't get a D. Well, unfortunately, you got to get an F but to at least end on a good score We'll end on you got a final grade of 105 There's your a