The use of if Elif and Elst block, so let us go for the Datalink, if Optative will be lighting one
condition and then we're supposed to put one on hand, whenever we are putting a colon, then the next
line will be coming with the indentation.
That means in this particular indentation we are having one, two, three, four blank spaces and that
will indicate that this particular statement, this particular block will be under that conditional.
If so, when the condition will be true, that will be coming to this block or else if we are talking
it else, if we are calling it as L.C.
But it is e-life so different languages that have different syntax to write this one.
So it is if there is an elusive RLC, we are putting another condition and then having one on here.
The next block will get executed.
When this particular condition will be true, uncontrol will be coming to the else block if the condition
ignores the if statement is false.
So when this particular condition is false as well as when the condition was false, then the content
will be coming to this elif block.
So here we are having one two conditions that they are connected with the end and then if the both conditions
are true, then that will be coming to this block for execution.
Otherwise the content will come to this block in this.
If Elif and El's elephant else these blocks are optional, we may or may not give Elsley the last block
after or else we cannot have the ELIF.
But this if it's mandatory, if we write any conditional statement, if it's mandatory, but Elif and
else they are not mandatory.
We're here to abuse to elif blocks, but we can have multiple such but else we have a single block here.
That means we cannot have anything else.
So let us go for the execution.
You can find that we are asking the age of a person and then using the input function.
We are reading the age from the keyboard and then we are converting it to the integer and then it is
getting assigned onto the edge.
And then if it is less than five, then this condition, this particular statement is going to get printed
as the condition is becoming true.
So let us go for the execution you can find better.
So I'm putting the age like four here.
You see it is printing to Yoong because Ford is less than five excarnation is true.
So control is coming down here and this part will remain on executed, unreachable.
Next, if we go for the execution, if we put the values of five.
Exactly.
Then kindergarden is getting printed.
So kindergarten is getting printed because this line is getting the control.
Now, we shall put one H in between five to seventeen.
So let us go for the ten here.
Say, is he go to Fikret because then minus five is five, so that fight is getting printed.
So control came in this block here, not we are going for the next one.
So if we put the into here, if there is a 20, then it is going for go to college.
It is going for go to college.
So in this way, you are getting this idea that how this conditional statements are getting executed.
So let us go for another example where you will be using that Nienstedt if that means one, if block
within another outlet.
If in this program we will input a number and check if the number is positive or negative or Gedo and
display an appropriate message, this time you lose the nested.
If so, at first we are asking the user to input a number and the number will be converted to the float
type and then that will be assigned to the number.
If not means then equal digital.
That means the name is greater than equal digital.
Then we are going for this operation.
So when the number is greater than equal digital.
So we are coming down to this block and here we are checking whether the number is zero or not.
If the number is zero, we are printing this message gittel others.
We are printing the message negative number.
So if the condition is false, then contact will be coming directly to the sales block.
And here the negative number printed here.
You can find that this, if else block is within this indentation of the outer one.
So that means when this condition is true, then control will be coming to this if else nested one.
So it is our nested.
If so, you are getting this idea that indentation is playing a very vital role in our python coding.
So let me go for the execution here, putting the values at zero.
So as a result of that num greater than equal to zero is getting through.
So now it will come to this line number is going digital is through here because I put the value zero
and then print zero zero has got printed rescored has been unreachable on executed.
Let us go for another time execution.
With the values of five, we can find that five is greater than to the conditions through five exclusively
due to the condition is false.
It is coming to this positive number here.
So that's quite a positive number.
String has got printed.
So now if I go for this minus ten, you can find that negative number is getting printed because minus
10 Gherardini collegial.
The condition is false.
So can you come to the L spot and the negative number will get printed.
So in this way, we have demonstrated that how to use that if Elif and Ls block and what is negative
and how to write that one with the proper indentation.
Thanks for watching this video.