 The last type of conditional that we're going to be talking about actually it's so important that I've broken it out into its own set of Slides, but it's this idea of a nested condition the entire idea is if we think about how we've operated conditional statements so far We've more or less just worked off of one branch of oh well, you know, it's true I go do a few things I go do a few things and And then I maybe move on with the rest of my code and maybe if it was false I do some thing or things as well Well, okay, that's great. That is the foundation of a condition But what happens if I use that? true or false breakdown and Yeah, you know, maybe I still do something here, but what if I? Added in another Condition as well and in this case just to kind of flesh this out even further so that happens Something happens here Something happens here. There we are the entire idea is that well, you know, if we think about it I can just replace these squares with More conditional statements and I can continue to combine them All over the place and that's exactly what we're thinking about and just to see this more in a real life or real Visual we could think about that very similar to temperature. You know, let's say for example 59 degrees It's 59 degrees out. Well is that cold? We're going to work with the fact that I'm a good old southern boy And so 59 is cold for me. So that is a true statement. Oh Well, I'll go put on and just you know, nice little hoodie or some light then need to be any it's not freezing I I said I'm southern, but I didn't say I'm like Miami But oh well, what happens if? It's 29 degrees because again if we're thinking it's cold. I'm cold Oh, well, maybe I need to make more assessments. Is it super cold? Well 59 I can move on But 29. Oh, that's super cold. I'm gonna put on hat. I'm gonna put on gloves because you know again I don't like the cold, but it's me sort of doing one condition statement Then making more evaluations and doing a second conditional statement or more realistic at least for our sake here in North Carolina It is a nice little piping hot 85 degrees and so oh well, is it cold? No, that's a false statement. So I can move on and wear my flip-flops and shorts and Polos either way When we are building out these nested conditionals the big thing that we first need to do because this can really branch out if you ever saw a band or snatch on a Netflix, you know all years ago that You know, we need to first establish What are the variables that we want to work off of for our criterias because that's gonna be Effectively how we first divide out our our categories Once they are divided out then we need to do make another sort of Evaluation what do I need to evaluate now in the case of my temp, you know short-formed temperature once I established it was cold I needed to Reassess how cold is it super cold or is it just marginally cold very similar to grades for example? Well, then all I need to do is continue to repeat that process over and over and over again and a really good way of seeing this in action is Through taxes I Know But if we think about taxes and how that entire process operates Well, it's actually pretty good for conditional statements when you file taxes you file as One of four categories you are either file as Single married filing jointly with your partner married filing separate from your partner or head of the household Where multiple people are bringing in money? So Effectively you could call that a status or a filer status or filer or anything But that is the first criteria that we need to sort of break out of we need to make that as our first condition Because it then will tell us effectively Which one of these columns? We need to work off of so just to kind of draw down them Then the next part that we need to think about once we've broken down our Status is obviously the important thing income how much money did I make? Because as you can already see we have different tax brackets for different Incomes there so super simple just as a very you know Not crazy one if you were filing as a single and you had $5,000 income all right well 5000 is We would again be working off of a single column 5000 was less than 85 or 8300 so you're gonna have to pay 10% on it. Okay. Well, we take the income and we times that by 0.1 no no problem. You have to pay taxes you pay $500 in taxes Yeah, we're not gonna you know you may like them you may not but you have to do them So, okay. Well, let's bump those numbers up Let's say for example. Oh, well, you know you're filing again. We'll work off of single, but you made 10,000 Well, 10,000 is larger. So 10k is Larger than 8.3 k. Oh, so oh, what do you know? We're up a tax bracket So we have to then come in and do a point zero Zero point point. Yeah, zero point one five. And so now I'm paying, you know 1500 Wrong that is not how taxes work. That is incorrect. That is the Where we think but that's actually overestimating how much we pay and to actually see this in action Let's jump up. Let's say for example, I have I made 68,000 just to really jump up to this All right. Well, if we look at this dollar bill this giant dollar bill, let's say that that is Cumulatively your 68,000 well in that case depending on the actual dollar Certain amounts are getting taxed differently. So for the first $10,000 that you Made that is getting paid or that is getting taxed at 10% so in our case that was the first 800 350 at 10% Then We have another branch basically the next round of value up to 30 what was it? up to 33 50 is getting Taxed out at 15% and just to Expand this out a little bit again. Here's that 8,350 it get taxed it gets taxed at 10% Then the next 25 600 is taxed at 15% and so just to kind of keep track of that we've got the 8 350 and then the 256 hundo And just so you can add those together 0 0 509 3 carry a 1 3 that's Too many zeros there we go Okay, so either way basically, you know this first 8,000 again, that's getting taxed at 10% then the next 25,000 is getting taxed at 15% and then finally if you were to take the 33 950 and plus it by 34,000 in 50 you'd get the 68,000 But that is what gets what gets taxed at 25 so it would be 30 50 times 0.25 plus 256 hundo times or times asterisk times point 15 plus Won't let me draw that low unfortunately plus 830 times 0.10, okay, so we've we now all understand taxes and we can do our own taxes Anyways, what we can think about here if we evaluate that out is again the first branch is getting calculated out as 10% and then whatever is Remaining out of your income in this case 10,000 minus 830 or 8300 is getting taxed out at 15% so in this case Your taxes are not 100 it is just under or just over a thousand so a little little bit nicer and We would expand that out so in this case if we made 50,000 just like we saw in the graphic 8,000 is getting 10 that 25 600 is getting 15 and then whatever is remaining is Being taxed at 25% so again, we're just working off of our valuations so now the idea really is Taking this and converting it into code So the first thing again is that we are going to need to break things down by their status and This is how we could start this and I'm just going since it's a lot. I'm not going to type it out I'm just sort of explain as we go through. I have first obviously my def to identify. Oh, I'm making a function I've determined I'm going to name it calc filing and it takes into parameters status and income Now for my sake, I am going to work on the assumption that status is a number. It just makes it easier for me, but a status of zero is what we will classify as a single filer Status of one is married filing jointly to married filing separate and three head of household We could also have an else statement in the case where They put a status that we are not going to be working off of and For whatever reason But now we have sort of in our effect built the structure and that's the most important part I built the structure to operate from my code Very specifically though We can also just break down all these individual pieces as we can see I have some sort of sample code to operate from a status of a zero and a Income of ten thousand since that is a value. I've calculated out I can check to see if my code is correct and then just some simple printing of my taxes to output that And so we're converting it now specifically as you can see We are operating with once again the L if commands here because we are seeing you know multiple statuses So we're just trying to pick which fork in the road. We are operating from Again, we're working off of the status But the part I really want to focus in on is obviously this pass command that you may be seeing The entire idea to the pass command just as the you know blob says Don't do anything just for right now. It is you know, I don't need Python crashing on my code And so I can just say you know, hey, we will get to that later So I just I need there to be something in the if statement block for Python to not freak out. So Here's the thing I'm putting in there. Just a blank do nothing statement And so again, just like I say here It's good because that will allow us to focus in on just getting this first block done Before we even try and worry about you know head of household, you know, let's not Try and eat the entire I Use a story of like, how do I eat an entire elephant, right? It's a very big creature. It's a very big problem I need to focus on one bite at a time Focus on one bite at a time. So these I can ignore for now ignore for Now great So now that we've isolated out that we're only focusing on single filers now we can work off of Looking at their income and specifically where they fall in Line here very similar to how we were calculating out letter grades Oh, well, if you're at this threshold, you're here if you're at this threshold, you're here And so again, I'm just showing that code because it is a lot of writing So in this case once again We see that we have our if statement where the status is zero single then we start evaluating out our incomes So if the income is less than 83 50 Again, you made $5,000. All right. Well, you only have a very simple tax to work off of great But let's just jump down to that 68,000. So again, let's imagine that income Equaled 68,000 Excuse me Then in that case we're in sort of this third bracket And once again, we don't just take all 38 and times it by 25. We use a tier to system. So in this case The first 8300 is still calculated out or multiplied by 10% For that tax then we break that down and I'm just sort of Demonstrating you could have used the 22 or the 25 Example there. I'm just sort of showing it explicitly here That is getting calculated out at the 15 and then whatever was remaining is Going to be calculated out once again at 25 And as you can see I do that once again for someone who made 150,000 or someone who made 200,000 or someone who Shouldn't be writing their own Python code to calculate out their taxes, but you know Please donate But as you can then see I also happened to have the L if for Breaking it down now that you've done it for the single status You would just repeat this entire process copy and paste this all and then just adjust the numbers for married file jointly married file separately head of household and Whatever other brackets or statuses that may come into being at some point in the future