 In Python, you can put if statements inside of if statements, and that's called a nested if. Here's a program that asks for a price and quantity, and calculates the subtotal, the tax, and the total, and prints them out. Let's run it. If I have a unit price of $4.50, and I order seven of them, there's my subtotal, tax, and total. I'd like to be sure that both the price and quantity are greater than zero. Let's add an if-else for the price. I'll ask for the price, and then if the price is greater than zero, I want to do everything else. I could indent them all by hand, one by one, but Thani gives me a helping hand. If I highlight all the lines and press Tab, it indents them all. Let me hide the shell here so that you can see the whole program. If the price is greater than zero, continue with everything else. Otherwise, print price must be greater than zero. Let's go back to the shell and run the program. This time, if I enter a unit price of negative $4.95, it'll immediately tell me that the price must be greater than zero. Cool, that handles negative prices. But what about negative quantities? If I give a valid unit price and a negative quantity, it still goes through with a bad calculation, so I need another if-else to handle that. After I get the quantity, I have to ask if the quantity is greater than zero. If that's the case, I'm able to do all this stuff. Otherwise, the quantity is zero or negative, and I print the quantity must be greater than zero. I have an if from lines 9 through 18 inside an if from lines 7 through 19. Let's run the program with a valid unit price and quantity. Everything works nicely. With an invalid price, it gives me an error right away, and with a valid price and a negative quantity, it gives me an error message as well. The program is now working the way I want to, because I have a nested condition, an if within an if. Can you have an if statement inside the else portion? Yes, indeed. Here's another way I could have written the price program. In this program, I'm asking for both the price and quantity before I do any testing. Then I ask, is the price greater than zero and the quantity is greater than zero? If both of them are okay, it's okay to do the calculations. Otherwise, one or both of the price or quantity must be wrong. In the else portion, I'm going to have a nested if statement, a unary if. If the price is less than or equal to zero, then it's bad. I need to make a print statement for that. Separately, I have to ask if the quantity is less than zero. If it is, I give an error message. There's no else needed for either this if in line 18 or this if in line 21, because the only way I can get here is if the price is less than or equal to zero or the quantity is less than or equal to zero. If they were both greater than zero, I would have handled it here. Let's view the shell, clear it, and run the program. If the unit price is 450 and I order 10 of them, everything works great. If the unit price is negative and I order 10 of them, it tells me the price must be greater than zero. If the unit price is okay but the quantity is bad, it tells me the quantity must be greater than zero. And if both the unit price and the quantity are bad, it gives me both error messages. There's an important point here. In order to do a good test of my program, I have to test all the combinations of good and bad input to make sure I've covered all the cases. Another thing to notice is the difference between this program and the other one. In the first version of the program, as soon as I got an error, I gave the error message. In this program, I wait until I have all the input before I give any of the error messages. Which approach is better? That's a design decision. The takeaway from this video is that it's possible to have if inside of if and if inside of else and if the condition warrants it, you could even have an if inside of the if as well as an if inside of the else. Whatever the design of the program requires, you may nest ifs and elses inside of one another to get the effect you need.