1 00:00:00,330 --> 00:00:07,890 Not often we want to test a condition and execute one block of the condition is true and another block 2 00:00:07,890 --> 00:00:14,370 of gold, if it is false, we can use an EL statement after and if statement block and the instatement 3 00:00:14,370 --> 00:00:16,110 block of the code will be executed. 4 00:00:16,340 --> 00:00:22,800 If the if statements condition is false, not for an EL statement, you just write down the is evil 5 00:00:23,040 --> 00:00:29,150 and it doesn't need a condition because it will run if the condition in its statement isn't true. 6 00:00:29,640 --> 00:00:36,660 So you can write the code as to if this condition is true, execute this block or if if it is false, 7 00:00:36,660 --> 00:00:38,050 execute the other block. 8 00:00:38,310 --> 00:00:44,550 So now we will modify the same program which will look down something like, say, after the if part 9 00:00:44,550 --> 00:00:47,050 and I'll stop printing print access. 10 00:00:47,070 --> 00:00:53,740 Granted, we will go back once and he will really use ls Poland and here we will print SI. 11 00:00:54,860 --> 00:01:01,220 Access denied anything the locals rest, everything will remain still the same. 12 00:01:01,610 --> 00:01:05,060 So now let us save it and let us run this again. 13 00:01:05,450 --> 00:01:07,160 Now, again, when does something wrong? 14 00:01:07,170 --> 00:01:13,760 We enter escapism now with this printing access denied and then done so, this version of our program 15 00:01:13,790 --> 00:01:16,820 that we have written looks almost the same as the previous. 16 00:01:17,180 --> 00:01:22,490 Only thing is that fixed access granted will still display if condition is true. 17 00:01:22,730 --> 00:01:28,220 But now if the if condition is false, that is of the user type order, then something like admin one, 18 00:01:28,220 --> 00:01:28,700 two, three. 19 00:01:29,000 --> 00:01:35,240 Then if statement condition becomes false, causing the execution to enter the else block and display 20 00:01:35,240 --> 00:01:36,210 access denied. 21 00:01:36,710 --> 00:01:42,110 Either way, the execution will still continue to display the message that this that because it is going 22 00:01:42,110 --> 00:01:43,830 to execute after the if block. 23 00:01:44,540 --> 00:01:50,990 Similarly, we will come to the end if statement not another statement that is elusive can also be paired 24 00:01:50,990 --> 00:01:56,510 with if like and if it has a condition like an X it follows. 25 00:01:56,510 --> 00:01:59,330 That is, if it is false, then you go to the details. 26 00:01:59,330 --> 00:02:06,980 But you can also read if like else if and a statement as if the first condition is true. 27 00:02:07,080 --> 00:02:15,200 Randy Block of if or is Jacob the next condition is true or else just run this last block. 28 00:02:15,440 --> 00:02:22,340 So any number of errors if statement can follow and if statement now what we'll do is we'll modify the 29 00:02:22,340 --> 00:02:28,790 same program which will make it look something different, will force enter the password storage. 30 00:02:28,790 --> 00:02:31,520 The access granted is proper. 31 00:02:31,970 --> 00:02:42,110 Then after this we will check for is if and here we will give, say, password input if it is equal 32 00:02:42,110 --> 00:02:44,630 to either a capital admin. 33 00:02:44,630 --> 00:02:46,150 One, two, three, all. 34 00:02:46,730 --> 00:02:51,560 He'll also say we are giving print C. 35 00:02:53,940 --> 00:02:56,490 Hint the 36 00:02:59,640 --> 00:03:05,580 buzzword is in law, Keith. 37 00:03:06,880 --> 00:03:08,660 We are giving some hint to the user. 38 00:03:09,520 --> 00:03:17,340 Similarly, we use one more as if your password input is equal to write. 39 00:03:17,400 --> 00:03:19,030 Don't only say one, two, three. 40 00:03:19,750 --> 00:03:26,830 Here we give a hint again, seeing, say, the 41 00:03:29,650 --> 00:03:37,420 password also contains a string and lowercase. 42 00:03:38,140 --> 00:03:40,160 OK, just a hand to the user. 43 00:03:40,740 --> 00:03:44,050 Then this is the second part that we have given. 44 00:03:44,270 --> 00:03:48,340 And then we have the next LCAC password as access denied. 45 00:03:48,760 --> 00:03:55,960 So now over here, let us see if this and let us try and execute now be forced out of this admin. 46 00:03:55,960 --> 00:03:56,600 One, two, three. 47 00:03:57,010 --> 00:03:59,290 It says the password is in the lowercase. 48 00:03:59,320 --> 00:03:59,660 OK. 49 00:04:00,140 --> 00:04:01,360 Again, let's go back. 50 00:04:01,700 --> 00:04:02,490 Executed. 51 00:04:02,500 --> 00:04:03,910 We enter just one, two, three. 52 00:04:04,090 --> 00:04:07,960 It says the password also contains a string and the Lorqess fine. 53 00:04:08,320 --> 00:04:14,410 We enter over here all in small admin will totally find access granted again. 54 00:04:14,410 --> 00:04:15,130 We execute. 55 00:04:15,250 --> 00:04:17,580 We enter something different now, say admin. 56 00:04:17,590 --> 00:04:18,270 One, two, three. 57 00:04:18,670 --> 00:04:25,720 It says X access denied because now this is going in neither of the if else if all that is secondary. 58 00:04:26,620 --> 00:04:34,280 So now in this particular code, we have four blocks of if elif and the statement, if the user enters, 59 00:04:34,420 --> 00:04:40,240 say only one, two, three, then the password evaluates to false like over here. 60 00:04:40,690 --> 00:04:43,360 So this evaluates to false. 61 00:04:43,370 --> 00:04:48,460 Even this one evaluates to four as it goes to the next L7 brings the particular message. 62 00:04:49,120 --> 00:04:54,640 Similarly, the execution for this goes to the last part over here. 63 00:04:55,120 --> 00:05:01,240 Now you can have even zero or more aggressive statements following an if statement if you have a zero 64 00:05:01,240 --> 00:05:03,790 or one, but not multiple as a statement. 65 00:05:03,790 --> 00:05:11,260 And the statement always comes last because only execute if none of the conditions evaluate to through 66 00:05:11,650 --> 00:05:13,780 the full statement with the true condition. 67 00:05:13,780 --> 00:05:19,280 Has its block executed the rest condition, even if they are also true orange check. 68 00:05:19,570 --> 00:05:25,240 So in the first case, if this condition comes to that is if you enter in one, two, three, you will 69 00:05:25,240 --> 00:05:28,200 get access granted and then print it. 70 00:05:28,230 --> 00:05:30,850 So these all conditions will never be checked. 71 00:05:31,270 --> 00:05:35,530 But if this is not true, it will go on for checking for the second condition. 72 00:05:35,740 --> 00:05:39,670 Suppose you had entered a gap of one, two, three, then this becomes true. 73 00:05:39,940 --> 00:05:44,590 Then this block of code, that is the print executes and the president executes. 74 00:05:44,890 --> 00:05:48,830 Similarly, if this is also not true, it is also not true. 75 00:05:48,880 --> 00:05:55,300 The thought is, if it's true, this blob gets executed, if none of the if all else, if true, this 76 00:05:55,300 --> 00:05:59,350 is what gets executed and the president gets executed. 77 00:05:59,620 --> 00:06:07,930 So in this way, we have created or we have seen how the if else if and is blocked or how if an execute 78 00:06:08,140 --> 00:06:13,370 and what are the outputs that basically are coming when you execute a certain given conditions there. 79 00:06:13,780 --> 00:06:16,460 So now moving to the next one. 80 00:06:16,930 --> 00:06:25,090 Now the next or let's close down this particular program and go back to over Caesar Saiful program over 81 00:06:25,090 --> 00:06:25,390 here. 82 00:06:25,390 --> 00:06:30,880 The next statement we have is using if as VI in our symbol types. 83 00:06:31,120 --> 00:06:37,600 Now an an operator can basically connect the two strings and it will evaluate to true if the full string 84 00:06:37,840 --> 00:06:41,440 is inside the second string or evaluates to false. 85 00:06:41,440 --> 00:06:47,380 If not so, the operator over here can also be paired with not, which will do the opposite. 86 00:06:48,070 --> 00:06:53,980 Now just to have a look at what can we do, just will go to the interactive shell over here and we will 87 00:06:53,980 --> 00:06:56,440 type C, for example, here. 88 00:06:57,100 --> 00:07:05,920 Let's dipen single code, see fighting in C, python hacking. 89 00:07:06,640 --> 00:07:09,780 And over here you press and we get it to. 90 00:07:10,390 --> 00:07:16,030 Suppose we say Python not in again. 91 00:07:17,800 --> 00:07:19,690 Fighting, hacking. 92 00:07:20,110 --> 00:07:22,990 We get false or we say here. 93 00:07:24,930 --> 00:07:25,410 Cound. 94 00:07:26,360 --> 00:07:41,810 In Python, hacking is true, or we get just a blank in sorry, this is also python hacking is also 95 00:07:41,810 --> 00:07:43,310 true because we have their space. 96 00:07:43,640 --> 00:07:47,000 But if we just write down the spot, say, in. 97 00:07:49,820 --> 00:07:56,390 Python would also give us the value, so notice that over your views in and the Norten operators, which 98 00:07:56,390 --> 00:07:57,380 are case sensitive. 99 00:07:57,710 --> 00:08:02,930 So also blank string is always considered to be any other strength expression. 100 00:08:02,930 --> 00:08:10,100 Using an in and not in operators are handy to use as conditions of if statement to execute some if a 101 00:08:10,100 --> 00:08:13,020 particular string exists inside another string. 102 00:08:13,200 --> 00:08:13,460 OK.