Not often we want to test a condition and execute one block of the condition is true and another block
of gold, if it is false, we can use an EL statement after and if statement block and the instatement
block of the code will be executed.
If the if statements condition is false, not for an EL statement, you just write down the is evil
and it doesn't need a condition because it will run if the condition in its statement isn't true.
So you can write the code as to if this condition is true, execute this block or if if it is false,
execute the other block.
So now we will modify the same program which will look down something like, say, after the if part
and I'll stop printing print access.
Granted, we will go back once and he will really use ls Poland and here we will print SI.
Access denied anything the locals rest, everything will remain still the same.
So now let us save it and let us run this again.
Now, again, when does something wrong?
We enter escapism now with this printing access denied and then done so, this version of our program
that we have written looks almost the same as the previous.
Only thing is that fixed access granted will still display if condition is true.
But now if the if condition is false, that is of the user type order, then something like admin one,
two, three.
Then if statement condition becomes false, causing the execution to enter the else block and display
access denied.
Either way, the execution will still continue to display the message that this that because it is going
to execute after the if block.
Similarly, we will come to the end if statement not another statement that is elusive can also be paired
with if like and if it has a condition like an X it follows.
That is, if it is false, then you go to the details.
But you can also read if like else if and a statement as if the first condition is true.
Randy Block of if or is Jacob the next condition is true or else just run this last block.
So any number of errors if statement can follow and if statement now what we'll do is we'll modify the
same program which will make it look something different, will force enter the password storage.
The access granted is proper.
Then after this we will check for is if and here we will give, say, password input if it is equal
to either a capital admin.
One, two, three, all.
He'll also say we are giving print C.
Hint the
buzzword is in law, Keith.
We are giving some hint to the user.
Similarly, we use one more as if your password input is equal to write.
Don't only say one, two, three.
Here we give a hint again, seeing, say, the
password also contains a string and lowercase.
OK, just a hand to the user.
Then this is the second part that we have given.
And then we have the next LCAC password as access denied.
So now over here, let us see if this and let us try and execute now be forced out of this admin.
One, two, three.
It says the password is in the lowercase.
OK.
Again, let's go back.
Executed.
We enter just one, two, three.
It says the password also contains a string and the Lorqess fine.
We enter over here all in small admin will totally find access granted again.
We execute.
We enter something different now, say admin.
One, two, three.
It says X access denied because now this is going in neither of the if else if all that is secondary.
So now in this particular code, we have four blocks of if elif and the statement, if the user enters,
say only one, two, three, then the password evaluates to false like over here.
So this evaluates to false.
Even this one evaluates to four as it goes to the next L7 brings the particular message.
Similarly, the execution for this goes to the last part over here.
Now you can have even zero or more aggressive statements following an if statement if you have a zero
or one, but not multiple as a statement.
And the statement always comes last because only execute if none of the conditions evaluate to through
the full statement with the true condition.
Has its block executed the rest condition, even if they are also true orange check.
So in the first case, if this condition comes to that is if you enter in one, two, three, you will
get access granted and then print it.
So these all conditions will never be checked.
But if this is not true, it will go on for checking for the second condition.
Suppose you had entered a gap of one, two, three, then this becomes true.
Then this block of code, that is the print executes and the president executes.
Similarly, if this is also not true, it is also not true.
The thought is, if it's true, this blob gets executed, if none of the if all else, if true, this
is what gets executed and the president gets executed.
So in this way, we have created or we have seen how the if else if and is blocked or how if an execute
and what are the outputs that basically are coming when you execute a certain given conditions there.
So now moving to the next one.
Now the next or let's close down this particular program and go back to over Caesar Saiful program over
here.
The next statement we have is using if as VI in our symbol types.
Now an an operator can basically connect the two strings and it will evaluate to true if the full string
is inside the second string or evaluates to false.
If not so, the operator over here can also be paired with not, which will do the opposite.
Now just to have a look at what can we do, just will go to the interactive shell over here and we will
type C, for example, here.
Let's dipen single code, see fighting in C, python hacking.
And over here you press and we get it to.
Suppose we say Python not in again.
Fighting, hacking.
We get false or we say here.
Cound.
In Python, hacking is true, or we get just a blank in sorry, this is also python hacking is also
true because we have their space.
But if we just write down the spot, say, in.
Python would also give us the value, so notice that over your views in and the Norten operators, which
are case sensitive.
So also blank string is always considered to be any other strength expression.
Using an in and not in operators are handy to use as conditions of if statement to execute some if a
particular string exists inside another string.
OK.