1 00:00:00,240 --> 00:00:07,650 Now, after this import the next few lines in our program, we are basically having the MWD string variable, 2 00:00:08,070 --> 00:00:12,580 we are having the key variable, which is having the value given us 30. 3 00:00:13,080 --> 00:00:16,550 And we also have the more type which is encrypted. 4 00:00:16,590 --> 00:00:18,570 And I decided to encrypt decrypt. 5 00:00:18,840 --> 00:00:24,830 Now here, the MSD string, it basically stores the string that is to be encrypted or decrypted. 6 00:00:24,840 --> 00:00:30,360 And the key variable that is our key stores, the end of the encryption key. 7 00:00:30,810 --> 00:00:31,190 Right. 8 00:00:31,230 --> 00:00:37,380 So the more type variable over here stored the string encrypt decrypt, which makes either the code 9 00:00:37,680 --> 00:00:41,790 later in the program that is encrypting a string or decrypting a string. 10 00:00:42,180 --> 00:00:46,920 Now coming to the constants and the variables that are used in this program. 11 00:00:47,220 --> 00:00:53,710 Now, constants basically are variables whose values shouldn't be changed when the program runs. 12 00:00:53,940 --> 00:00:59,970 Now, for example, in the CS ASIFA program, we need a string that contains every possible character 13 00:00:59,970 --> 00:01:05,290 that can be encrypted with this program now because that string shouldn't be changed. 14 00:01:05,310 --> 00:01:09,030 We store it in a constant named symbol's type. 15 00:01:09,270 --> 00:01:11,850 Right now, one more thing over here. 16 00:01:11,910 --> 00:01:22,050 We will make similar type like this and let's copy it everywhere that we have used the particular variable. 17 00:01:24,290 --> 00:01:31,600 Now we will show you what is the use of this, but let's see if this and run I get. 18 00:01:31,650 --> 00:01:32,240 OK, fine. 19 00:01:32,630 --> 00:01:38,540 So now over here you can see the variable that we have taken is basically just a common item, which 20 00:01:38,540 --> 00:01:43,790 is used in a cryptography for a single character that is a cipher to encrypt decrypt. 21 00:01:44,300 --> 00:01:52,280 Now, a symbol basically is a set which is every possible symbol for the set up to encrypt, because 22 00:01:52,280 --> 00:01:58,070 we will be using the symbol said many times in this particular program and because we don't want to 23 00:01:58,070 --> 00:02:03,770 tie the full string value each time it appears in the program, we are using your constant to store 24 00:02:03,770 --> 00:02:04,370 the values. 25 00:02:04,910 --> 00:02:06,920 Why have we changed to all uppercase? 26 00:02:06,920 --> 00:02:14,010 Because whenever we use any variable name all in uppercase, it means that we are using it as a constant. 27 00:02:14,360 --> 00:02:17,510 So the value once assigned will not be changed. 28 00:02:17,910 --> 00:02:23,240 It is just like any other variable that all uppercase name reminds the program. 29 00:02:23,240 --> 00:02:29,390 What I do not write the code that does so, as with all the conventions, if you don't have to follow 30 00:02:29,390 --> 00:02:29,840 this one. 31 00:02:29,840 --> 00:02:36,200 But doing so makes it easier for other programs to understand how these variables are basically used. 32 00:02:36,570 --> 00:02:36,880 Right. 33 00:02:37,070 --> 00:02:43,730 Then we take a blank string variable that is translated as Steyr, which is just having a blank volume 34 00:02:43,730 --> 00:02:48,660 and do it, which will be storing the translated value in the given variable. 35 00:02:49,010 --> 00:02:53,300 Now for it currently we are giving it the blank value itself. 36 00:02:53,570 --> 00:02:57,610 Now we come to our formal statement over here. 37 00:02:57,950 --> 00:03:03,280 Now we are using this for SVM in our message Oremus G String. 38 00:03:03,650 --> 00:03:10,490 We recall that Ovie loop the loop as long as a certain condition is true and also the for loop has a 39 00:03:10,490 --> 00:03:14,640 slightly different purpose and doesn't have a condition like the loop. 40 00:03:14,660 --> 00:03:18,350 Instead it loops over a string or a group of values. 41 00:03:18,650 --> 00:03:25,790 So for every value in M is destroying, the volume will go on executing itself. 42 00:03:25,970 --> 00:03:32,180 And each time the program execution goes through the loop that is on each iteration to the loop. 43 00:03:32,180 --> 00:03:37,910 The variable in the fourth statement takes on the value of the next character in the variable containing 44 00:03:37,910 --> 00:03:39,050 a particular string. 45 00:03:39,320 --> 00:03:45,580 In this case at this is just not for the fourth statement is similar to an assignment statement because 46 00:03:45,590 --> 00:03:46,940 variable is creative. 47 00:03:46,940 --> 00:03:53,900 Assign the value except the false statement cycles to different values to assign the variable. 48 00:03:54,230 --> 00:03:57,890 Now let us see a simple example of for loop. 49 00:03:58,190 --> 00:04:05,690 We'll just go to the interactive shell over here and we will type the particular form of things before. 50 00:04:06,700 --> 00:04:08,650 Letter, see? 51 00:04:10,350 --> 00:04:20,550 Happy here we are seeing Brent, in fact, the letter is plus the value of letter. 52 00:04:21,300 --> 00:04:27,780 OK, so here we get each an individual value of the particular character getting printed at the end 53 00:04:27,780 --> 00:04:28,740 of the line. 54 00:04:28,920 --> 00:04:34,940 So this particular group gets all the gold loops over each character in the string happy. 55 00:04:35,220 --> 00:04:40,890 And when it does, the variable little takes on each of the characters in the string. 56 00:04:40,890 --> 00:04:47,910 Happy one at a time in order so we can just rewrite the code in the loop that brings the value of liquor 57 00:04:47,910 --> 00:04:49,140 for each iteration. 58 00:04:49,470 --> 00:04:56,370 Now, again, similarly, we understand of how I look at providing fuel or fodder for the formula is 59 00:04:56,370 --> 00:04:57,810 very similar to Vilo. 60 00:04:57,810 --> 00:05:05,340 But when you only need to iterate over characters in a string, using a for loop is more efficient and 61 00:05:05,340 --> 00:05:12,780 you could make a loop at like a four Liuba writing a bit more code like this, for example, I go to 62 00:05:12,810 --> 00:05:20,790 zero, we save while I is less than the length of C happy column. 63 00:05:21,270 --> 00:05:22,560 You open the envelope here. 64 00:05:22,900 --> 00:05:26,700 Here we use letter that's equal to say happy. 65 00:05:28,320 --> 00:05:39,880 At the index, I will use your brain in single quotes, the letter is plus the value of letter and we 66 00:05:39,880 --> 00:05:42,360 say, I will stop I plus one. 67 00:05:42,820 --> 00:05:47,970 So here again, we get the same values printed over here using the value. 68 00:05:48,280 --> 00:05:55,880 So notice that this file looks the same as we had before, but is not as short and simple as the photo 69 00:05:55,900 --> 00:05:57,470 of the month, which we have written about. 70 00:05:57,760 --> 00:06:01,990 First, we need to set a variable that is to zero before the final statement. 71 00:06:02,290 --> 00:06:05,800 Then the statement will have a condition that will evaluate to true. 72 00:06:05,800 --> 00:06:12,820 As long as the variable is then the length of the string happy because it is an integer and only keeps 73 00:06:12,820 --> 00:06:14,670 track of the current position in the string. 74 00:06:14,680 --> 00:06:20,320 We will need to declare a separate letter variable to hold the character in the string at the position, 75 00:06:20,620 --> 00:06:25,310 and then we can print the current value of the letter to get the same output as the formula. 76 00:06:25,630 --> 00:06:31,480 So when the code is finished executing, we need to increment also the eye by adding one to to move 77 00:06:31,480 --> 00:06:32,680 it to the next position. 78 00:06:33,490 --> 00:06:39,980 So it is better for us to use the for loop in case of, hey, look over here, because we will make 79 00:06:39,980 --> 00:06:46,090 it a more shorter and smarter look on loop, which we can write down in no particular program. 80 00:06:46,480 --> 00:06:51,790 Now we move on to our next part in the program that is coming to the F condition. 81 00:06:52,030 --> 00:06:59,230 Here we are using if Asli in our simbel right now, you can read an if statement as so if this condition 82 00:06:59,230 --> 00:07:01,900 is true, execute the code in the following block. 83 00:07:02,180 --> 00:07:05,140 Otherwise, if it is false, skip the block. 84 00:07:05,260 --> 00:07:11,770 And if statement is formatted using the key, if followed by the condition followed by a colon, the 85 00:07:11,770 --> 00:07:16,560 code to execute is in the neck in the block, just as with the loops. 86 00:07:17,140 --> 00:07:22,920 So for example, we will try an if statement and see how does it basically look. 87 00:07:23,500 --> 00:07:29,590 C will go back here and we will see print C and. 88 00:07:32,600 --> 00:07:33,170 Your. 89 00:07:35,960 --> 00:07:46,000 But whether you made a mistake, your friend and 90 00:07:48,740 --> 00:07:52,240 your password. 91 00:07:52,730 --> 00:07:58,440 OK, but now we basically need to write down in a separate file as we need to execute this together. 92 00:07:58,850 --> 00:08:07,720 So what we will do is let's go for a new file and we would write down, say, print and of your password. 93 00:08:08,630 --> 00:08:17,210 Then we will create here, say password input is equal to use the input method, store whatever password 94 00:08:17,210 --> 00:08:19,400 the user have type over here. 95 00:08:19,760 --> 00:08:20,990 Check if the. 96 00:08:22,210 --> 00:08:23,700 Password input. 97 00:08:25,060 --> 00:08:33,460 Is equal to a particular possible settlement, one to three, for example, if it is, then you say 98 00:08:33,970 --> 00:08:39,180 access granted and use your friend. 99 00:08:40,390 --> 00:08:41,200 See that? 100 00:08:41,440 --> 00:08:43,440 OK, so now we save this. 101 00:08:43,450 --> 00:08:53,920 Let us save it again in e drive hacking big enough and we save it over here by the name Cicek Password, 102 00:08:53,920 --> 00:08:54,970 not Fibi. 103 00:08:55,510 --> 00:08:58,000 And we try to execute this. 104 00:08:58,240 --> 00:08:59,320 So enter password. 105 00:08:59,320 --> 00:09:05,020 Now we enter a capital we had given that a small so it does not giving us the access. 106 00:09:05,020 --> 00:09:08,160 Granted it is just Google giving us the value done. 107 00:09:08,500 --> 00:09:14,560 But suppose we go back here we again run the module, the internal admin. 108 00:09:14,560 --> 00:09:15,190 One, two, three. 109 00:09:15,190 --> 00:09:19,720 It says access granted and then the statement is done. 110 00:09:19,930 --> 00:09:25,540 So then you run the particular program with displays your full that that is enter your password and 111 00:09:25,540 --> 00:09:27,840 lets the user type the password over there. 112 00:09:27,850 --> 00:09:33,850 Whatever password is then typed by the user is stored in the variable that we have created. 113 00:09:34,120 --> 00:09:36,480 That is our password input. 114 00:09:36,640 --> 00:09:37,880 Right next. 115 00:09:37,900 --> 00:09:44,350 The if statement checks the password is equal to the string that is admin, all in small case, one, 116 00:09:44,350 --> 00:09:44,720 two, three. 117 00:09:45,130 --> 00:09:51,720 If it is the execution rules inside the block following the if statement of the text as X is granted. 118 00:09:52,060 --> 00:09:59,620 Otherwise, if the password input isn't equal to admin one, two, three, even if the case is all that 119 00:09:59,620 --> 00:10:06,000 is a capital admin or something like that, the execution skips the if statement block either way and 120 00:10:06,100 --> 00:10:12,310 the execution continues on to the court after the if block or display, just the statement that's done 121 00:10:12,640 --> 00:10:13,840 right now. 122 00:10:13,990 --> 00:10:18,830 Similarly, we will see what happens if we use the statement over here, OK?