1 00:00:00,360 --> 00:00:07,560 Now, after this, we move to the out of the particular definition of mean, and here we define another 2 00:00:07,830 --> 00:00:15,780 matter that we have already called inside, that is encrypted message Hestia, which would be taking 3 00:00:16,230 --> 00:00:21,010 Sady here, Steyr and messages still. 4 00:00:21,780 --> 00:00:28,470 And in this message of particular function, we are calling the cipher text Asgeir. 5 00:00:28,800 --> 00:00:33,990 That's equal to the making it blank multiplied by the value of gearstick. 6 00:00:34,530 --> 00:00:39,140 After we have done this, we will loop through the each column in the ciphertext. 7 00:00:39,450 --> 00:00:48,030 So we would see here for columnist here in the range and range we would be giving you this key. 8 00:00:48,250 --> 00:00:50,490 Still, here we are seeing the. 9 00:00:52,190 --> 00:00:53,180 Got an idea. 10 00:00:53,960 --> 00:01:02,480 And here we are making that sequel to the column last year, and once we have done through that after 11 00:01:02,480 --> 00:01:07,580 this, we will keep looping until the current index goes past the message. 12 00:01:08,180 --> 00:01:13,830 So over here, we would run of a loop seeing the current index. 13 00:01:14,180 --> 00:01:23,840 If it is less than the length of your message, dear, if at this, then we will place here the ciphertext 14 00:01:23,840 --> 00:01:34,730 star and the index of columnist here, and then we would see Plus's equal to the messages dear and in 15 00:01:34,730 --> 00:01:43,310 brackets the current IDEX, after which we would move to the current index or the current index. 16 00:01:43,610 --> 00:01:49,930 Seeing the current index plus is equal to the GST. 17 00:01:51,170 --> 00:01:56,700 Now after this, let's convert the ciphertext list into a single string and return it. 18 00:01:56,960 --> 00:01:59,480 So let's come back in the for loop. 19 00:01:59,480 --> 00:02:11,780 And here we would write down the return statement dot join the value of ciphertext hestia and come out 20 00:02:11,780 --> 00:02:12,670 of the definition. 21 00:02:12,890 --> 00:02:26,040 And over here we say if name is equal to mean single quotes, then you're going to call the main method. 22 00:02:26,450 --> 00:02:28,220 So let us save this. 23 00:02:28,880 --> 00:02:37,640 Let's save it in Python hacking beginner and let's give it a name as demo be right and let us try to 24 00:02:37,820 --> 00:02:38,810 run this module. 25 00:02:39,830 --> 00:02:42,380 So this is how we are getting this particular value. 26 00:02:42,650 --> 00:02:51,380 If we just copy down this and the manual thing that we have done, let's go here and let's pasticcio. 27 00:03:06,860 --> 00:03:13,880 Let's see, it is coming in the similar manner that we have done the only thing we are not replacing 28 00:03:13,880 --> 00:03:19,250 that any particular thing, we are getting their spaces instead of the symbols that we have created 29 00:03:19,250 --> 00:03:19,410 here. 30 00:03:19,430 --> 00:03:26,720 Otherwise, the text that we have created manual and the way we have got your manual through the index 31 00:03:26,720 --> 00:03:33,860 in the same way we are getting it through the output when we do it into the python hacking by the transposition 32 00:03:33,860 --> 00:03:34,340 cipher. 33 00:03:34,940 --> 00:03:38,700 Now, let us understand the particular code that we have used to there. 34 00:03:39,380 --> 00:03:45,890 So here the vertical pipelined symbols here basically marks the end of the ciphertext in case there 35 00:03:45,890 --> 00:03:47,440 are spaces at the end of it. 36 00:03:47,560 --> 00:03:53,120 OK, so this ciphertext without the pipe character at the end is also copied to the clipboard. 37 00:03:53,420 --> 00:03:55,910 You can pasted into any of your e-mail if you want. 38 00:03:56,390 --> 00:04:01,430 And if you want to encrypt a different message or use a different key, you will change the value assigned 39 00:04:01,430 --> 00:04:01,610 to. 40 00:04:02,000 --> 00:04:04,850 My messages to G.R. or guests variables. 41 00:04:05,030 --> 00:04:07,340 And you can then again run that particular program. 42 00:04:07,730 --> 00:04:10,760 Now, let's understand the way we have created this. 43 00:04:11,030 --> 00:04:17,660 After importing a paperclip module, we have used up defined statement or death statement to create 44 00:04:17,660 --> 00:04:19,530 a custom function that is mean. 45 00:04:19,940 --> 00:04:25,760 Now, the death statement means you creating or defining a new function that you can call later in the 46 00:04:25,760 --> 00:04:32,780 particular program in a block of code after the def statement is the code that will basically run when 47 00:04:32,780 --> 00:04:33,920 the function is called. 48 00:04:33,950 --> 00:04:40,370 So when you call this function, the execution moves inside the lock of the code following the functions. 49 00:04:40,370 --> 00:04:41,310 Def statement. 50 00:04:41,960 --> 00:04:49,400 So after this we can, for example, suppose we take up the example of a print method or we can take 51 00:04:49,400 --> 00:04:51,740 a string value as an argument between its parameters. 52 00:04:51,800 --> 00:04:56,810 So when you define a function that takes argument, you put a variable name between its parentheses 53 00:04:56,810 --> 00:04:58,210 in its def statement. 54 00:04:58,400 --> 00:05:00,830 So these variables are called the parameters. 55 00:05:00,990 --> 00:05:05,480 So here the main function defines that there are no parameters for main function. 56 00:05:05,510 --> 00:05:08,340 So it takes no argument when it is called. 57 00:05:08,360 --> 00:05:14,330 If you try to call a function with too many or too few arguments for a number of parameters, the function 58 00:05:14,330 --> 00:05:21,110 has Python will give you an error message and that gives succumbing to defining a function that can 59 00:05:21,110 --> 00:05:23,000 take argument with the parameters. 60 00:05:23,220 --> 00:05:29,180 Now we will do some sort of execution of a particular code, will create a function with a parameter 61 00:05:29,180 --> 00:05:30,990 and then call it with an argument. 62 00:05:31,280 --> 00:05:39,890 So let us open here again, a new file and we will define see, for example, hello once we are defining 63 00:05:39,890 --> 00:05:51,080 your name is Estela and we are giving their print simple saying hello, string comma and concatenate 64 00:05:51,080 --> 00:05:52,490 with that name Mystere. 65 00:05:52,910 --> 00:06:00,470 And then we are saying come out of this definition, we call print and here we see start. 66 00:06:02,420 --> 00:06:10,950 After which we go for gallingly one function, your repass, one particular parameter. 67 00:06:11,300 --> 00:06:20,240 Again, we say put in psychology function again and again we call Halo one. 68 00:06:20,750 --> 00:06:27,800 This time we call it with some different parameter and then we say perent printing that. 69 00:06:29,990 --> 00:06:37,280 Now, let us save this as Demo 11. be right and let us execute it. 70 00:06:37,670 --> 00:06:39,560 This is how we get it start. 71 00:06:39,590 --> 00:06:39,970 Hello. 72 00:06:39,980 --> 00:06:41,780 Alice called the function again. 73 00:06:41,790 --> 00:06:42,530 Hello ABC. 74 00:06:42,530 --> 00:06:46,510 And then we get to the values that it's all over here. 75 00:06:46,760 --> 00:06:52,790 Let's go to this particular program now where the halo function over here, the Demo 11 that we have 76 00:06:52,790 --> 00:06:55,630 executed, executes or starts at the top. 77 00:06:55,640 --> 00:07:01,610 The DEF statement defines one function named Halo, one with one parameter, which is the variable name 78 00:07:01,610 --> 00:07:02,180 Mystere. 79 00:07:02,510 --> 00:07:06,620 The execution skips the block after the def because the block is only real. 80 00:07:06,620 --> 00:07:13,480 When the function is called next, it'll execute first print start, which is why START will be printed 81 00:07:13,500 --> 00:07:14,540 when you run the program. 82 00:07:14,870 --> 00:07:19,850 Next line after print is the first function call to help run the program. 83 00:07:19,850 --> 00:07:27,260 Execution jumps to the first line in the Hellerman function block and the string that is we have allies 84 00:07:27,590 --> 00:07:30,530 will be passed as an argument and is assigned to the parameter. 85 00:07:30,530 --> 00:07:36,670 Name is Escherichia and this function call brings the string as hello comma Alice to the screen. 86 00:07:36,980 --> 00:07:42,980 Now when the program execution reaches the bottom of the def statement execution jambox to the line 87 00:07:42,980 --> 00:07:46,620 with the call function and continue executing the call from there. 88 00:07:47,060 --> 00:07:51,500 So now we will get the next print that is called the function again will be printed. 89 00:07:52,210 --> 00:07:57,950 Now the second call to the function Hellerman would be done after that and the program execution again 90 00:07:57,950 --> 00:08:00,170 comes back to hell over this time. 91 00:08:00,320 --> 00:08:06,980 The parameter that we have passed is ABC would be replaced here in the name you your value and it printed 92 00:08:06,990 --> 00:08:09,170 Hello comma ABC again. 93 00:08:09,170 --> 00:08:13,880 When the function returns, the execution goes to the next line, which is the print done. 94 00:08:14,360 --> 00:08:16,460 Now, this is the last line of the program. 95 00:08:16,470 --> 00:08:18,760 So the program exists now. 96 00:08:18,770 --> 00:08:23,800 You can change the parameter, exist only inside the particular function. 97 00:08:24,050 --> 00:08:26,340 Now you'll see another particular example. 98 00:08:26,340 --> 00:08:32,720 You enter it directly into the interactive Chynn now will create a code that will define or define and 99 00:08:32,720 --> 00:08:35,720 then call a particular function named see if you see one. 100 00:08:36,200 --> 00:08:43,370 And in the interactive shell, you will have required to enter that a blank line to close the definition 101 00:08:43,370 --> 00:08:44,350 of the function block. 102 00:08:44,600 --> 00:08:51,650 For example, if you go here and here, you see the fine function, if you can see one. 103 00:08:52,370 --> 00:08:59,900 And here we are defining it with one item we are giving their C bottom is equal to the value of forty 104 00:08:59,900 --> 00:09:06,910 two, ended by placing one more and then we create your span is equal to say hello. 105 00:09:07,550 --> 00:09:13,000 Then we call here if you see one and pass the value span. 106 00:09:13,940 --> 00:09:24,790 And then we say, bring in bucket spane, we get the blueprint, hello, because now that is being replaced, 107 00:09:24,790 --> 00:09:30,850 the spam value is hello, we have that value over there and protect the value back again. 108 00:09:31,520 --> 00:09:37,220 Now, this particular function that we have created takes a parameter that is better and sets its value 109 00:09:37,220 --> 00:09:37,920 to 42. 110 00:09:38,360 --> 00:09:44,990 Now the code outside the function creates a variable span and sets it to a string value and then the 111 00:09:44,990 --> 00:09:45,920 function is called. 112 00:09:46,340 --> 00:09:47,790 And then Spanish sprinter. 113 00:09:47,990 --> 00:09:54,470 Now, when you run the program, print call on the last line will print hello and not 42 because main 114 00:09:54,470 --> 00:09:56,750 function is called Spalatin argument. 115 00:09:56,990 --> 00:10:01,160 Only the value inside the spane is being copied and assigned to the parameter. 116 00:10:01,850 --> 00:10:07,720 Any changes made to the parameter inside the function will not change the value in the actual variable. 117 00:10:08,450 --> 00:10:11,780 So every time a function is called a local school is created. 118 00:10:12,260 --> 00:10:18,710 Variables created during the function call exist in this local school and are called local variables. 119 00:10:18,890 --> 00:10:23,840 But amateur's always exist in a local school, not think of a school as a container. 120 00:10:23,850 --> 00:10:25,340 The variable exists inside. 121 00:10:25,340 --> 00:10:31,010 When the function returns, the local school is destroyed and the local variables that were contained 122 00:10:31,010 --> 00:10:33,380 in the particular school are also forgotten. 123 00:10:33,770 --> 00:10:40,400 Variables created outside every function exist in the global school and our goal as global variables. 124 00:10:40,790 --> 00:10:46,490 So when the program exist, the global scope is destroyed and all the variables in the program are forgotten. 125 00:10:47,210 --> 00:10:49,340 How variable must be local or global? 126 00:10:49,340 --> 00:10:54,380 It cannot be bought for different variables, can have the same name as long as they are in a different 127 00:10:54,380 --> 00:10:54,790 school. 128 00:10:55,190 --> 00:11:00,680 So they would be still considered as two different variables, even if their name is C. 129 00:11:01,310 --> 00:11:07,340 So an important idea to understand is that the argument value that is passed into a function call is 130 00:11:07,340 --> 00:11:08,660 copy to a parameter. 131 00:11:08,900 --> 00:11:15,080 So even if the parameters change, the variable that provided the argument value will never change.