 Hey, what's going on guys root from no shell comms today, and we are back with some more python tutorials. Yeah Now today, we're looking at else and elif we're trying to continue off that little Uh, the little if mini series that we've been doing it I wouldn't call the mini series But it's just it's just such an important concept that I want it I want to give you guys all the information all the knowledge that you can get with that sort of keyword So let's look at some more. Uh, that's more look some more conditional testing and that sort of thing Let's get idle started up I'll drag it on over here so you can you can see what I'm up to Let's create a new New program get everything going up and I'll save this actually I will save this not open a new file I hit the wrong key there file.python overwrite that and We'll start building Okay, I'm ready whenever you guys are and let's get cracking. I'm gonna keep using my virgins and What bin Laden set example Virgins what bin Laden said all right So now let's get some testing inside our conditional statement We're gonna want the condition of if virgins is equal to what bin Laden said We can display Bin Laden Was right Now when we run that that should execute because 72 is equal to 72 Now we can add what they call an else statement or at least else is another cold block So if something is not something if else then Let's see we can print Bin Laden was wrong and this makes sense right if it's not 72 Then bin Laden wasn't right because he had said 72 And then when you don't get all those virgins, he's wrong. There you go So that's exactly what this else statement is doing. It's it's the not scenario if something is not something else So we can run this and bin Laden was wrong. There you go So now there's also what we have an elif statement and elif statement allows you to test Once more even after you've created this not scenario So if it's not equal to you could test if If virgins is greater than What bin Laden said and in that case we would print looks like bin Laden Under exaggerated underestimated I think in I'm thinking that's what I want. Yeah. All right Looks like bin Laden underestimated. There you go. Virgins is greater than what bin Laden said and This will not run but we're gonna try it anyway. Yep, exactly. It won't run because virgins is still 71 That's less than 72. So it's not gonna work. It's not equal to so it won't run this first conditional statement and It won't even run this one. It won't even look at it because it's not it's not evaluating this one correctly Actually, yeah, we'll move to this next one, but it won't run this one at all because it's not it's not it's not greater Than it's less than so we can change this file to let's say like 34 and then we run it again This looks like looks like bin Laden underestimated So now let's add another elif statement because we can add as many of these as we want let's say Virgins is Less than what bin Laden said finish up this little block here Get to print and we'll change this to over exaggerated Now when we run this it looks like Because we're still at 74 we can change it back to 71 Looks like bin Laden over exaggerated. So now let's add ourselves a let's give ourselves a little bit more functionality Just like we were doing before we can set virgins equal to inputs. How many virgins did you find? So now they can input that and we can give it a go Run this here. How many virgins did you find? Yeah one Looks like bin Laden over exaggerated. We can do it again. Let's say 72 Looks like bin Laden was right and we can do it again. Let's say That's not even a number. What am I doing? Let's try one more time 0 0 0 0 0 0 91 92 All right, I'm just playing around at this point guys. I'm sorry. We'll run it again. Let's say we got 528 29 actually looks like bin Laden underestimated So there you go This is elif and else and you can see exactly what's going on here I'm interested if we if we tried this with a string variable if we were like Bin Laden is damn crazy if it's not even anywhere near a number if we had changed it to raw input I Wonder if it'll even bother testing this Hello No, it's less than that. That's interesting though because I wonder if it's looking at that logic the ASCII table or something if we've piped in a This is a pretty long sentence hmm Yeah, I don't know. I wonder what the value is of Virgins we could Print the integer value of virgins And then we will actually we'll turn that into a string once more So we can can catnate on there a new line just to keep things easy Now you've got yourself a little bit of more of a bigger program. So King Henry I don't know Okay, that's not gonna go Hmm it doesn't look like you can convert the That string into an integer because there's no integers in there That's that's interesting. What if we what if we try typing in about 20 or so? No Still nothing Well, there you go guys be able to experiment I want you guys to be able to play around and learn things see what you can do and cannot do just like I do every now And again because that's that's all you can do by learning But yeah, here are some examples here what here is what Elif and else is the else we didn't get a chance to look at in this example But the previous example when the first looking at it it does work Okay, it's it is that not scenario when Elif allows you to check for more scenarios and that sort of thing So I I hope you use this in your program. I know I do quite a lot at least the L statement I don't use the L if too often because I'll usually just nest that and that's actually what our next subject is about Nesting statements nesting conditional statements nesting that sort of thing. So here we go Thank you guys for watching. Thank you for listening and I will see you guys in the next tutorial