1 00:00:00,420 --> 00:00:08,610 Coming back to our actual program, let us go to our Demo Morton now here we have defined the main function 2 00:00:08,940 --> 00:00:11,330 that we set, the values of the variables. 3 00:00:11,490 --> 00:00:15,500 My message, SDR and my guests, when they are called. 4 00:00:16,140 --> 00:00:22,000 Now, the rest of the program will also have a function mean that is called at the start of each program. 5 00:00:22,170 --> 00:00:28,080 The reason we are having a main function is explained at the end of when we conclude a particular session. 6 00:00:28,640 --> 00:00:35,100 And over here we have the variables, my messages, a certain mixture which stores the plain text message 7 00:00:35,430 --> 00:00:38,670 to encrypt and the key which is used to do the encryption. 8 00:00:39,330 --> 00:00:45,810 Now, over here, we also have a variable ciphertext, ETR, which is an encrypted message by calling 9 00:00:45,810 --> 00:00:48,270 the function that takes the argument. 10 00:00:48,480 --> 00:00:55,020 So over here, this will be stored as an encrypted message that will come from the message or from the 11 00:00:55,020 --> 00:01:01,590 function, encrypted messages to the code that does the actual encrypting is in the definition encrypted 12 00:01:01,590 --> 00:01:04,470 message, Asgeir function, which is defined the later. 13 00:01:04,770 --> 00:01:09,750 Now this function takes two arguments, an integer value for the key and a string value for the message 14 00:01:09,750 --> 00:01:10,470 to encrypt. 15 00:01:11,100 --> 00:01:18,330 So in this case, we have passed my messages and my estimate now when passing a multiple argument to 16 00:01:18,330 --> 00:01:23,510 the function called separate the argument with the bombing that we have passed over here. 17 00:01:23,970 --> 00:01:29,400 So the return value of the encrypt messages is a string value of an encrypted ciphertext, and this 18 00:01:29,400 --> 00:01:31,770 is stored in the variable ciphertext SDR. 19 00:01:32,490 --> 00:01:37,710 Now, the ciphertext e-mail still messages printed on the screen and copied to the clipboard. 20 00:01:37,710 --> 00:01:41,190 When we say here, print and not copy. 21 00:01:41,760 --> 00:01:47,010 Now the program prints up by character at the end of the message so that the user can see any empty 22 00:01:47,010 --> 00:01:49,410 space characters at the end of the ciphertext. 23 00:01:49,980 --> 00:01:55,750 After execution is done, the program execution's returns to the line after the line that is called 24 00:01:56,100 --> 00:01:58,080 or call the particular main function. 25 00:01:58,500 --> 00:02:02,490 So the key and the message variable between the parentheses or the parameters. 26 00:02:02,490 --> 00:02:08,520 When we define the encrypt messages, it takes basically two arguments in this case, like the value 27 00:02:08,520 --> 00:02:14,340 in Michael Asgeir and the messages to these values are assigned to the parameter key and the message 28 00:02:14,340 --> 00:02:16,920 when the execution moves to the top of the function. 29 00:02:17,310 --> 00:02:21,460 Now, you might wonder of how you need to have the key and the message parameter since you only have 30 00:02:21,460 --> 00:02:25,650 a variables as my keister and my messages during the main function. 31 00:02:25,800 --> 00:02:31,920 But we need different variables because the mike is different in my messages during the main function 32 00:02:31,920 --> 00:02:37,020 at of local scope and cannot be used outside the particular main function. 33 00:02:37,500 --> 00:02:40,890 Now when we come to the next, that is the list data type. 34 00:02:41,130 --> 00:02:47,160 So over here, if you see we have created ciphertext SDR in the particular function by giving square 35 00:02:47,160 --> 00:02:51,660 bracket single open, closed, multiplied by Kirsti. 36 00:02:52,200 --> 00:02:57,840 Now, before we can move on, you need to understand how the list works and what do you get out of the 37 00:02:57,840 --> 00:02:58,680 particular list. 38 00:02:59,010 --> 00:03:05,310 List value can contain other values also similar to how string begin and end with a quote. 39 00:03:05,550 --> 00:03:11,650 A list value begins with an open bracket and ends with a closed bracket and the value stored inside 40 00:03:11,670 --> 00:03:13,770 the list are between the brackets. 41 00:03:13,980 --> 00:03:19,050 So if more than one value is in the list, the values are separated by commas. 42 00:03:19,770 --> 00:03:25,060 For example, if we want to see a list in action, we will enter something into the interactive shell 43 00:03:25,080 --> 00:03:29,850 over here like we would give sea animals. 44 00:03:29,850 --> 00:03:41,460 SDR is equal to we give sea dog got a horse elephant. 45 00:03:42,810 --> 00:03:43,920 We have defined this. 46 00:03:44,100 --> 00:03:50,910 Then here you just say in the next line, animals SDR, we get all the values. 47 00:03:51,150 --> 00:03:57,150 Prenter So here the animals Asgeir that we have available store a list of values. 48 00:03:57,300 --> 00:04:01,720 And in this list, values are basically four strings that we have created. 49 00:04:02,190 --> 00:04:06,540 So over here, the four string values are stored individually there. 50 00:04:06,870 --> 00:04:11,370 So the individual value inside the list is also called as an item or an element. 51 00:04:11,760 --> 00:04:13,800 No list are ideal to use. 52 00:04:13,800 --> 00:04:20,190 Then you have to store multiple values in one variable for many of the operations you can do with strings. 53 00:04:20,400 --> 00:04:27,000 Also work with list, for example, indexing or slicing Volks on list values the same way that works 54 00:04:27,000 --> 00:04:32,400 on this string values instead of individual characters in a particular string, the index refers to 55 00:04:32,400 --> 00:04:34,070 an item in a particular list. 56 00:04:34,380 --> 00:04:45,510 For example, if we say here, see animals SDR Index zero, we get the default index or if we see animals 57 00:04:45,520 --> 00:04:48,150 SDR Index two, we get there. 58 00:04:48,150 --> 00:04:58,020 The third item apart in the particular list, or if we see animals SDR in brackets one column three, 59 00:04:58,440 --> 00:04:59,640 we get that value for. 60 00:04:59,810 --> 00:05:01,250 One, bill, three. 61 00:05:01,990 --> 00:05:08,060 So keep in mind that the forced index is zero and not one so similar to how you use liasing with a string 62 00:05:08,060 --> 00:05:11,150 gives you a new string, and that is a part of the original strength. 63 00:05:11,330 --> 00:05:16,060 Using Fleisig with list gives you a list that is a part of the original list. 64 00:05:16,310 --> 00:05:22,970 And also remember that if a slice has a second indexed, life only goes up to but doesn't include the 65 00:05:22,970 --> 00:05:24,320 item at the second index. 66 00:05:24,950 --> 00:05:29,720 Now you can also use a for loop for iterating over values in the list, just like we can. 67 00:05:29,720 --> 00:05:32,110 I trade over characters in a particular string. 68 00:05:32,420 --> 00:05:39,320 For example, if you say for S1 in again we use on our list. 69 00:05:39,320 --> 00:05:52,320 So we give some again the same values comma clause it open this column and here we give Ziprin for the 70 00:05:52,470 --> 00:05:58,370 know we are cooking, plus the value of S1. 71 00:06:00,050 --> 00:06:07,490 And so we get for dinner, we are cooking dog got hot, so everywhere this value of one is automatically 72 00:06:07,490 --> 00:06:09,460 replaced and that is what is printed. 73 00:06:09,480 --> 00:06:16,100 So each time your loop is iterating, the S1 variable is assigned a new value from the list, starting 74 00:06:16,100 --> 00:06:20,220 with the list zero index until the end of the particular list. 75 00:06:20,870 --> 00:06:23,860 You can also reassign the items in the list. 76 00:06:24,230 --> 00:06:30,110 Now, for example, say here, as we have defined animala steerable, let's define that again. 77 00:06:30,110 --> 00:06:33,650 Animals Asscher is equal to give. 78 00:06:33,650 --> 00:06:37,220 There again the same items. 79 00:06:39,380 --> 00:06:44,800 We have defined this now we say here animals SDR at the index. 80 00:06:44,810 --> 00:06:51,200 Do we want to make there something like nine nine nine nine and now we see animals osteotomy are to 81 00:06:51,200 --> 00:06:51,690 be printed. 82 00:06:52,040 --> 00:06:58,670 So now we have replaced that value to modify an element or third element of the particular list. 83 00:06:58,670 --> 00:07:05,630 We have used the index to get the total value with using animal instead of the index two and then use 84 00:07:05,630 --> 00:07:10,020 an assignment statement to change its value from the original one to a new value. 85 00:07:10,400 --> 00:07:17,330 So when we check the content of the list again now the earlier animal resource horse is no longer existing 86 00:07:17,330 --> 00:07:19,290 in a particular given list. 87 00:07:19,730 --> 00:07:26,980 Now, similar to this, how can you have list of let's list values can even contain other list values. 88 00:07:27,200 --> 00:07:37,800 For example, let's create list one here is equal to recreate, say, dog cat one and it give a comma. 89 00:07:38,240 --> 00:07:44,170 Next we have the number one three five, for example, and then close it. 90 00:07:44,690 --> 00:07:51,200 Now if we see list one, index zero, we get the first list. 91 00:07:51,680 --> 00:07:59,810 If we say list one zero zero, we get the full stroke, first column value. 92 00:07:59,960 --> 00:08:04,910 Similarly, if we say list one says zero one, we get the next value. 93 00:08:05,330 --> 00:08:12,620 If we say list one second row, first column, we get the value one. 94 00:08:13,100 --> 00:08:16,790 Similarly, list one, one one. 95 00:08:17,300 --> 00:08:25,120 Or if you want to it, say list one, one, two, because that is having one more value inside it. 96 00:08:25,610 --> 00:08:33,730 So here the value of the list, one evaluates to the list that is dog at first, which has its own indexes. 97 00:08:34,170 --> 00:08:40,100 The double index brackets over here, that is, we have use list one zero zero indicate that we are 98 00:08:40,100 --> 00:08:42,770 taking the first item from the first list. 99 00:08:43,520 --> 00:08:48,200 If we only say list zero, it evaluates to the whole of the first list. 100 00:08:48,590 --> 00:08:55,820 And if we see list one in the index zero zero, it goes to the first value in the first list. 101 00:08:55,820 --> 00:08:56,710 That is dog. 102 00:08:57,710 --> 00:09:03,080 Similarly, you can also use the length and the operator with the list. 103 00:09:03,290 --> 00:09:08,720 Now you have also used the length method, which is there to indicate a number of characters in a particular 104 00:09:08,720 --> 00:09:09,110 strip. 105 00:09:09,500 --> 00:09:15,110 The length function also walks on list values and returns an integer of the number of list or items 106 00:09:15,110 --> 00:09:16,130 in a particular list. 107 00:09:16,460 --> 00:09:23,750 For example, if we see we animal length of C animals. 108 00:09:27,770 --> 00:09:35,870 SDR, may the lenders for similarly, you have also used the in and not in operators to indicate whether 109 00:09:35,870 --> 00:09:38,480 a string exists inside another string values. 110 00:09:38,780 --> 00:09:45,500 The end operator also looks for checking whether a value exist in a list and they not in operator checks 111 00:09:45,500 --> 00:09:48,300 whether a value does not exist in the particular list. 112 00:09:48,890 --> 00:09:58,390 Now, for example, if we try to see value, say, log in any Nestea, we get the value to. 113 00:09:58,820 --> 00:10:08,000 If we say dog sorry, in string dog one in animal Asscher, that is coming to Foote's. 114 00:10:08,360 --> 00:10:16,970 Similarly, if we see a dog one say not in any Melissia comes through. 115 00:10:17,600 --> 00:10:17,820 Right. 116 00:10:17,890 --> 00:10:20,380 This is all we can use the particular values there. 117 00:10:20,630 --> 00:10:27,450 So now coming to the list, concatenation and replication with plus and the multiplication operators'. 118 00:10:27,620 --> 00:10:32,480 Now you know that the plus and the multiplication operators can concatenate and replicate the strings. 119 00:10:32,720 --> 00:10:39,020 Same operators can also concatenate and replicate your list now, for example, of something into the 120 00:10:39,020 --> 00:10:43,910 interactive schill c v right down here, C Python. 121 00:10:44,600 --> 00:10:51,740 And plus again here we enter C hacking together python hacking. 122 00:10:51,890 --> 00:11:00,980 OK, similarly, if we see Python multiplied by five, we get five times Python Prenter. 123 00:11:01,260 --> 00:11:07,220 Now that's enough about the similarities that we have seen between strings and this almost whatever 124 00:11:07,220 --> 00:11:09,530 we can work on string, we can also work it on the list. 125 00:11:09,860 --> 00:11:13,550 So just remember the most operations you can do with string values. 126 00:11:13,550 --> 00:11:15,470 Also work with your list of values.