1 00:00:14,560 --> 00:00:19,900 Hi, everyone, and welcome to the lecture and this lecture and the following lectures, we're going 2 00:00:19,900 --> 00:00:27,220 to discuss variables and data types and we're going to go deep into each variable type and we each lecture, 3 00:00:27,220 --> 00:00:28,300 we're going to have three parts. 4 00:00:28,600 --> 00:00:32,140 First, what will be the theoretical part that will begin in a moment. 5 00:00:32,380 --> 00:00:34,530 Second part will be lots of examples. 6 00:00:34,540 --> 00:00:36,120 And the third part will be practice. 7 00:00:36,550 --> 00:00:42,670 Those of you that get the hang of each topic quickly, I beg you and I really ask you from the bottom 8 00:00:42,670 --> 00:00:50,770 of my heart, please do not stop practicing and do not place practice as like trivial part, because 9 00:00:50,770 --> 00:00:55,470 practice is very important, even if you understand the topics, because once you go further with the 10 00:00:55,480 --> 00:01:00,080 lectures, topics start piling up and you will have to use all the topics altogether. 11 00:01:00,080 --> 00:01:00,490 Of course. 12 00:01:00,810 --> 00:01:01,180 All right. 13 00:01:01,360 --> 00:01:02,390 So let's begin. 14 00:01:03,010 --> 00:01:04,990 So let's begin with variables. 15 00:01:04,990 --> 00:01:08,650 Let's declare let's explain the definition of variables. 16 00:01:08,650 --> 00:01:14,200 So variables are used to store information to be referenced and manipulated in a computer program. 17 00:01:14,380 --> 00:01:20,530 They are also provide a way of labeling data with a descriptive name by using numbers, letters or signs. 18 00:01:20,860 --> 00:01:21,190 All right. 19 00:01:21,200 --> 00:01:24,820 So once looking on the program, it goes like a pyramid. 20 00:01:25,030 --> 00:01:31,990 And the bottom layer of the pyramid are variables because variables with variables, we can assign values 21 00:01:31,990 --> 00:01:37,220 to these variables and later on manipulate them, use them, compare them and so on. 22 00:01:37,420 --> 00:01:42,890 So this part is very crucial for any programmer to understand. 23 00:01:43,600 --> 00:01:51,220 So we have a declaration of variables in Python, slightly different from other object oriented programming 24 00:01:51,220 --> 00:01:51,840 languages. 25 00:01:52,120 --> 00:01:58,470 Once looking on variables, for example, in Java, we'll have like a simple example here. 26 00:01:58,690 --> 00:02:00,790 Don't worry about string variable. 27 00:02:00,970 --> 00:02:02,800 And I'm not just jumping. 28 00:02:02,800 --> 00:02:04,780 Jumping ahead is just an example. 29 00:02:04,780 --> 00:02:08,530 We'll talk about string variables deeply in a moment. 30 00:02:08,560 --> 00:02:08,860 All right. 31 00:02:09,520 --> 00:02:17,590 What I want to focus here that in Java before declaring the variable, we declare the type of the variable 32 00:02:18,430 --> 00:02:25,770 and then, you know, that name is a string type variable and it will have a string value right here. 33 00:02:26,170 --> 00:02:31,660 But once looking on Python, you see the variable declarations straight ahead without mentioning what 34 00:02:31,660 --> 00:02:32,290 type it is. 35 00:02:33,430 --> 00:02:38,260 So just remember, this rule applies for all variables in Python. 36 00:02:38,410 --> 00:02:43,260 You would not see the declaration of type of the variable before it. 37 00:02:43,570 --> 00:02:50,260 And don't worry about it because there are about a million ways of understanding what variable variable 38 00:02:50,260 --> 00:02:57,070 type we're using and the declaration of the type of it is not really crucial. 39 00:02:58,380 --> 00:03:06,240 So let's begin first in line is a string variable as string variable will hold zero or more letters, 40 00:03:06,540 --> 00:03:11,600 numbers, special characters, all or all combination of three. 41 00:03:12,390 --> 00:03:17,150 Also, a string variable could not be manipulated by mathematical actions. 42 00:03:17,520 --> 00:03:27,150 So even if you have a string variable like this, which has a numeric value inside, you cannot do mathematical 43 00:03:27,150 --> 00:03:28,210 action upon it. 44 00:03:28,920 --> 00:03:32,880 So even if you have, for example, name John. 45 00:03:35,430 --> 00:03:43,590 This is the same thing this and this example are both the same, because both of these are strong values 46 00:03:43,830 --> 00:03:46,370 and you cannot manipulate the street value. 47 00:03:46,830 --> 00:03:52,580 So looking on this example seems a bit confusing because I have a number here. 48 00:03:52,860 --> 00:03:59,600 So the number five is the value and the variable name is number. 49 00:03:59,760 --> 00:04:02,320 So why can't I add one number to another? 50 00:04:03,180 --> 00:04:07,500 So you can't do it because it's a string type of a variable. 51 00:04:08,460 --> 00:04:12,500 So now comes and naturally the question up ahead. 52 00:04:12,690 --> 00:04:19,890 So how can I understand and how can I don't identify once I see a string variable ahead of me? 53 00:04:19,890 --> 00:04:21,510 How can I know that this is a string? 54 00:04:21,810 --> 00:04:25,000 How can I know that I can not manipulate on the following variable? 55 00:04:25,470 --> 00:04:26,790 So it's very simple. 56 00:04:27,450 --> 00:04:31,680 String variable can be recognized by having apostrophes. 57 00:04:32,490 --> 00:04:33,060 All right. 58 00:04:33,930 --> 00:04:34,860 At the beginning. 59 00:04:34,860 --> 00:04:36,100 At the end of it. 60 00:04:36,720 --> 00:04:42,960 So once you see this quote marks guys, you know that the value inside is a string value and the string 61 00:04:42,960 --> 00:04:44,630 value cannot be manipulated. 62 00:04:45,180 --> 00:04:50,070 We'll see a few examples straight ahead and will then go straight ahead to practice. 63 00:04:50,370 --> 00:04:53,040 Sorry to see other examples in bicarb. 64 00:04:53,220 --> 00:04:56,650 And then you have your homework that you will practice it a lot. 65 00:04:57,240 --> 00:04:57,620 All right. 66 00:04:57,630 --> 00:04:59,520 So let's talk about conventions. 67 00:04:59,790 --> 00:05:04,980 I mentioned in the previous lecture that we're going to focus on conventions a lot in these lectures. 68 00:05:05,130 --> 00:05:08,730 So I would like to talk about it for a few minutes. 69 00:05:09,510 --> 00:05:15,450 So once we want to declare any variable, even if it's a string or any other type of variable, we have 70 00:05:15,450 --> 00:05:16,740 two simple rules. 71 00:05:17,010 --> 00:05:24,720 So I don't know if you seen the last lecture about conventions are accepted rules by all programmers 72 00:05:24,720 --> 00:05:30,980 globally for naming classes, naming variables and naming methods. 73 00:05:31,380 --> 00:05:37,620 So in PI charm, specifically, by the way, you have these rules set up differently for every programming 74 00:05:37,620 --> 00:05:38,100 language. 75 00:05:38,310 --> 00:05:43,640 So, of course, we're going to talk about Python and in specific of variables in Python. 76 00:05:43,770 --> 00:05:49,010 So how should I know in what way should I give the variable its name? 77 00:05:50,160 --> 00:05:54,810 So we have two basic rules that you need to remember once declaring a variable. 78 00:05:55,200 --> 00:05:58,170 The first one is to give small letters only. 79 00:05:58,710 --> 00:06:04,470 And if having more than two words in the variable name, we put the underscore between the words as 80 00:06:04,470 --> 00:06:05,070 so. 81 00:06:05,340 --> 00:06:05,740 All right. 82 00:06:05,760 --> 00:06:08,930 So for example, you have three variables here. 83 00:06:09,480 --> 00:06:13,620 This is the variable of last name with a value Johnson. 84 00:06:13,950 --> 00:06:19,890 And you can identified that this is a string variable by having this quote marks right here. 85 00:06:20,490 --> 00:06:26,610 And as you can see, it has small letters in each word divided with an underscore. 86 00:06:27,990 --> 00:06:34,590 Right here you have the address variable, which has the value and no value inside and letter value 87 00:06:34,590 --> 00:06:37,250 inside and also a special character inside. 88 00:06:38,010 --> 00:06:42,330 So you have you can have the combination of all three and the right. 89 00:06:42,330 --> 00:06:43,950 You have date of birth. 90 00:06:44,030 --> 00:06:44,390 All right. 91 00:06:44,640 --> 00:06:50,720 This is an example of three words divided with an underscore and having small letters in each word. 92 00:06:50,910 --> 00:06:54,190 And right here you have an example of date of birth. 93 00:06:55,860 --> 00:06:58,230 So these are the best examples. 94 00:06:58,500 --> 00:07:01,490 We can go straight ahead and go to pie charm. 95 00:07:01,500 --> 00:07:01,830 All right. 96 00:07:01,840 --> 00:07:09,150 So open your pie chart and let's try to practice and see some examples. 97 00:07:09,150 --> 00:07:14,190 And once by Chamas opened, just go to file. 98 00:07:15,340 --> 00:07:23,950 And open and if you recall in the previous lectures, we have created a project in C Learning and then 99 00:07:23,990 --> 00:07:29,710 initial project, you can see small black square right here, just click on this folder and then click 100 00:07:29,710 --> 00:07:30,190 open. 101 00:07:30,910 --> 00:07:31,590 OK, sorry. 102 00:07:32,170 --> 00:07:34,210 Then new window. 103 00:07:35,490 --> 00:07:40,580 It doesn't matter if you don't if you don't have the new window pop up, it's OK. 104 00:07:41,730 --> 00:07:50,350 And once we have it open, let me just move it aside for a second, once we have it open, we can begin. 105 00:07:51,600 --> 00:07:56,670 So right here on the left, you have your main folder of the project just right. 106 00:07:56,670 --> 00:07:59,430 Click on it and then choosing you and then file. 107 00:07:59,910 --> 00:08:02,820 Now we're going to create a new python file. 108 00:08:03,060 --> 00:08:05,510 You can see the cursor blinking right here. 109 00:08:05,760 --> 00:08:11,820 You can verify that Python finally selected and just give it a name, starting with a capital letter, 110 00:08:11,850 --> 00:08:13,020 which is also. 111 00:08:13,960 --> 00:08:21,640 A convention of creating new modules or in other words, new files in Python, which we'll discuss in 112 00:08:21,640 --> 00:08:27,100 a detailed way for the wrong, but for now, just create the file with a capital letter that is called 113 00:08:27,100 --> 00:08:28,840 Variables and then hit enter. 114 00:08:29,290 --> 00:08:29,700 All right. 115 00:08:29,710 --> 00:08:33,370 So you can see the file is created and we are located on it. 116 00:08:33,730 --> 00:08:40,300 And that's just start seeing more examples of string variables and manipulations on these variables. 117 00:08:40,510 --> 00:08:40,930 All right. 118 00:08:41,560 --> 00:08:48,850 So first thing, guys, I just want to mention that if you put this sign and everything you write afterwards 119 00:08:48,850 --> 00:08:55,520 will be a comment and pie chart would ignore everything that that is written after this sign. 120 00:08:56,350 --> 00:09:03,490 So it's a really useful tool to leave comments for other developers or even for yourself once you want 121 00:09:03,490 --> 00:09:07,490 to get back to a certain file later on and understand what's written right here. 122 00:09:08,620 --> 00:09:12,730 So let's start with a simple. 123 00:09:13,970 --> 00:09:15,350 Stirring example. 124 00:09:15,620 --> 00:09:22,370 All right, let's start with short string variable. 125 00:09:23,440 --> 00:09:30,010 All right, you see small letters divided with an underscore, then space, then equal Mark and then 126 00:09:30,010 --> 00:09:32,020 quote marks and then right here. 127 00:09:32,350 --> 00:09:36,870 Have a great week, ninja's. 128 00:09:38,530 --> 00:09:43,270 So we have our quote Mark at the beginning and we have a quote Mark at the end. 129 00:09:43,300 --> 00:09:52,210 By the way, have a look that if I delete this quote Mark immediately, I have a line, a red line below 130 00:09:52,210 --> 00:09:53,290 my value. 131 00:09:53,560 --> 00:09:59,070 And if I hover above it, it says to me exactly what's wrong, missing closing quote. 132 00:09:59,230 --> 00:10:01,480 So I don't want to make I'm angry. 133 00:10:01,750 --> 00:10:03,340 So I'm just going to close this quote. 134 00:10:03,640 --> 00:10:04,030 Great. 135 00:10:05,080 --> 00:10:10,480 And now I want to complete my first chunk of code and I want to run it. 136 00:10:11,320 --> 00:10:12,670 Why do I mean by running it? 137 00:10:12,670 --> 00:10:14,100 I want to print this value. 138 00:10:14,140 --> 00:10:14,560 All right. 139 00:10:14,770 --> 00:10:15,880 I have a value here. 140 00:10:16,750 --> 00:10:22,020 And if I click right, click on variables and click run. 141 00:10:23,170 --> 00:10:24,280 Nothing happens here. 142 00:10:24,330 --> 00:10:25,660 You see, nothing happens. 143 00:10:25,660 --> 00:10:28,720 It just states the file that I have just wrong. 144 00:10:28,900 --> 00:10:31,660 And it says process finish with exit code zero. 145 00:10:32,200 --> 00:10:33,180 No errors. 146 00:10:33,190 --> 00:10:35,710 This means no errors, but nothing happened. 147 00:10:35,710 --> 00:10:36,970 But I want something to happen. 148 00:10:36,970 --> 00:10:37,750 I want some action. 149 00:10:38,950 --> 00:10:45,960 So let's just go line below and type in print and let's just insert a the name of the value right here, 150 00:10:46,330 --> 00:10:47,800 the name of the variable. 151 00:10:47,800 --> 00:10:48,190 Sorry. 152 00:10:48,640 --> 00:10:56,650 And once I start typing, you see it's bolded in a pop up so it can out to complete it. 153 00:10:56,650 --> 00:10:58,650 For me this is the magic of by chance. 154 00:10:58,660 --> 00:11:01,300 So you don't need to type everything by yourself. 155 00:11:01,300 --> 00:11:04,360 You can just hit enter boom and then you see it. 156 00:11:04,960 --> 00:11:06,640 Let's try to run it right. 157 00:11:06,640 --> 00:11:08,200 Click again and then run. 158 00:11:09,280 --> 00:11:09,880 Great. 159 00:11:10,360 --> 00:11:11,440 Look at this guys. 160 00:11:11,440 --> 00:11:12,130 It's magic. 161 00:11:12,700 --> 00:11:21,130 You see there is have a great week ninja's right here so you can say congratulations, congratulations 162 00:11:21,130 --> 00:11:27,100 to self because if you completed this part of this path, you have just created your first program in 163 00:11:27,100 --> 00:11:27,640 pie chart. 164 00:11:28,000 --> 00:11:29,080 So that's amazing. 165 00:11:29,110 --> 00:11:29,830 I really mean it. 166 00:11:29,830 --> 00:11:33,850 It's amazing because until ten minutes ago, you didn't know. 167 00:11:34,570 --> 00:11:37,540 Oh, maybe most of you didn't know how to write code in Python. 168 00:11:37,540 --> 00:11:41,500 But right now we have a working program and we have printed our first variable. 169 00:11:42,070 --> 00:11:47,650 So let's go further and study some new things and minimal manipulations or variables. 170 00:11:48,730 --> 00:11:55,840 So let's try to print the first letter of a string variable. 171 00:11:57,140 --> 00:11:58,010 And. 172 00:12:01,290 --> 00:12:10,800 Let's have it like first letter variable and then let's give the value New York City, all right. 173 00:12:11,100 --> 00:12:17,610 And we would like to print the first value of New York City, and we do it by placing square brackets 174 00:12:18,750 --> 00:12:23,290 and placing the number of zero zero states for this place. 175 00:12:23,310 --> 00:12:26,160 This is the zero character index. 176 00:12:26,880 --> 00:12:27,390 All right. 177 00:12:27,640 --> 00:12:30,350 You will hear the term index a lot. 178 00:12:30,480 --> 00:12:36,740 So this character's index is zero, this index character is one and so on and so on. 179 00:12:36,750 --> 00:12:45,420 So we would like to have only the character index zero right here, and that's just to try to print 180 00:12:45,420 --> 00:12:45,650 it. 181 00:12:47,370 --> 00:12:53,460 So you see first letter and I as I just said, you can just hit enter. 182 00:12:54,000 --> 00:12:56,280 All right, let's run it right. 183 00:12:56,280 --> 00:12:57,660 Click, run. 184 00:12:59,240 --> 00:13:06,620 Great, so we can see right here the letter, and so we have just executed the print of the first letter 185 00:13:06,620 --> 00:13:07,200 right here. 186 00:13:07,430 --> 00:13:11,750 So just remember, you remember, guys, that the count starts from zero. 187 00:13:11,780 --> 00:13:14,840 So this one is zero and this one is one and so on. 188 00:13:15,630 --> 00:13:19,120 And let's see some more cool stuff that we can study. 189 00:13:19,940 --> 00:13:28,070 By the way, all of these tricks are seem like maybe a without any goal or why should we learn it? 190 00:13:28,070 --> 00:13:32,300 But believe me, once we go further with it, that shows you're going to use each and every one of these 191 00:13:32,300 --> 00:13:35,570 tricks to create your test cases using selenium. 192 00:13:36,410 --> 00:13:49,280 Um, so let's try to create the mixed, sorry, mixed upper and lower case letter variable, and we'll 193 00:13:49,280 --> 00:14:01,370 do it like this mixed Lantau variable and then just create a shortened sentence with one letter capital 194 00:14:01,370 --> 00:14:04,580 and the next one is small and so on and so on. 195 00:14:04,610 --> 00:14:05,720 Just do as I do. 196 00:14:14,700 --> 00:14:21,330 I'm feeling I'm just finished first grade guys, I would think that if I would be in first grade, my 197 00:14:21,330 --> 00:14:24,630 teacher would be very happy with me, that I have completed the sentence. 198 00:14:25,650 --> 00:14:26,040 All right. 199 00:14:26,050 --> 00:14:29,160 So I just try to print it. 200 00:14:29,430 --> 00:14:38,490 But now we're going to insert here mixed letter enter and then now is the important part, just place 201 00:14:38,490 --> 00:14:42,030 in DOT and you could see it pop up, opens up. 202 00:14:43,050 --> 00:14:51,720 So this pop up is shows you what manipulations he can do on your string variable and you can choose 203 00:14:51,720 --> 00:14:53,070 whatever you want from it. 204 00:14:53,250 --> 00:14:59,010 But for now, we're going to choose the the manipulation, which is lower. 205 00:14:59,850 --> 00:15:00,270 All right. 206 00:15:00,280 --> 00:15:01,140 Let's do it again. 207 00:15:01,830 --> 00:15:03,840 That start typing lower. 208 00:15:04,470 --> 00:15:04,950 All right. 209 00:15:05,610 --> 00:15:08,760 And then we need to do brackets. 210 00:15:09,830 --> 00:15:14,570 Around brackets and right, click on the file, Ron. 211 00:15:17,000 --> 00:15:25,880 All right, so you can see it's printed in a way which is lowercase only for all of these letters right 212 00:15:25,880 --> 00:15:26,160 here. 213 00:15:26,330 --> 00:15:33,050 It took the variable value and converted all the letters here into lowercase values. 214 00:15:35,000 --> 00:15:44,400 So let's try to do another thing, let's try to bring out the length of the that table. 215 00:15:44,750 --> 00:15:45,140 All right. 216 00:15:45,650 --> 00:15:49,210 Let's try to print out the length of this variable. 217 00:15:49,340 --> 00:15:53,570 So just type in print and then Len. 218 00:15:54,820 --> 00:16:03,760 Enter and inside these brackets, just take this variable double click it control, see to copy place 219 00:16:03,880 --> 00:16:09,340 right here, control veto based and let's see what happens. 220 00:16:10,070 --> 00:16:10,810 Run. 221 00:16:11,570 --> 00:16:13,880 Whoa, you see it? 222 00:16:14,120 --> 00:16:21,040 It counted all a number of letters right here and it gives us the number twenty four because we have 223 00:16:21,040 --> 00:16:24,040 twenty four characters inside this string variable. 224 00:16:24,880 --> 00:16:26,740 This is a very useful trick. 225 00:16:26,950 --> 00:16:30,100 We'll use it a lot in test cases later on. 226 00:16:30,580 --> 00:16:37,840 And you need to understand guys that you might see it is playing like words and why do we need to manipulate 227 00:16:37,840 --> 00:16:38,140 them? 228 00:16:38,350 --> 00:16:45,490 But once you go into a website and you would like to verify that a certain text appears there, you 229 00:16:45,490 --> 00:16:52,540 you would really want to use string variables and to verify certain things and to verify, for example, 230 00:16:52,870 --> 00:17:01,990 if a signing pattern appears and if sign out exists or a certain booklist or a certain header appears. 231 00:17:02,230 --> 00:17:06,610 So you would use a string variables and string variable manipulations a lot. 232 00:17:08,360 --> 00:17:17,690 So let's do another thing, let's try to use a variable with a combination of simple text inside a print 233 00:17:17,690 --> 00:17:25,940 commands, so let's create a very first of all, let's give a comment for the upcoming action use plus. 234 00:17:27,040 --> 00:17:29,200 Sign inside a print. 235 00:17:30,460 --> 00:17:38,470 Commands, let's create a new variable, which is first name, and let's put the value inside, David, 236 00:17:39,730 --> 00:17:42,370 and let's try to present the following thing. 237 00:17:43,270 --> 00:17:43,780 All right. 238 00:17:44,740 --> 00:17:47,340 Before before heading, heading, going ahead. 239 00:17:47,800 --> 00:17:49,530 Just I want to say just one thing. 240 00:17:49,690 --> 00:17:52,630 You see the sprint action, you see the sprint action. 241 00:17:53,170 --> 00:17:54,610 You can do two things. 242 00:17:54,610 --> 00:17:56,350 You can put a variable inside. 243 00:17:56,350 --> 00:17:58,750 For example, take this first name and put it inside. 244 00:17:58,750 --> 00:18:08,330 But you can also just put brackets sorry, quoting marks here and write anything you want in here. 245 00:18:08,710 --> 00:18:14,290 So before applying this manipulation, let's just sprint this thing right. 246 00:18:14,290 --> 00:18:15,850 Click run. 247 00:18:16,750 --> 00:18:23,350 You see it straight ahead, what you put inside so you can either put this variable inside the print 248 00:18:23,350 --> 00:18:27,410 or you can just or you can just put the value straight ahead. 249 00:18:27,520 --> 00:18:31,540 So what we're going to do is to do the combination of both. 250 00:18:32,290 --> 00:18:42,370 So put your quote marks and type in first name is then space and then two, that's in space. 251 00:18:42,850 --> 00:18:52,510 And then after the quoting marks, just put another space and here add the plus mark, because we want 252 00:18:52,510 --> 00:18:55,890 to add a variable to the sprint action. 253 00:18:55,900 --> 00:19:04,480 So you have to put it after the quoting marks and then just copy this control C and control V, place 254 00:19:04,480 --> 00:19:05,500 it right here. 255 00:19:06,250 --> 00:19:14,890 And now we try we'll try to print this sentence with the combination of this variable all together. 256 00:19:14,900 --> 00:19:15,970 So let's run it. 257 00:19:18,160 --> 00:19:23,860 Wow, you see, now you can see the combination of these both things you can't you have here a plain 258 00:19:23,860 --> 00:19:29,920 text between these quoting marks and then you have added a variable afterwards. 259 00:19:31,980 --> 00:19:37,600 And what if we would like to take it very well and replace certain letters with other letters? 260 00:19:38,010 --> 00:19:39,310 Let's try to do that right. 261 00:19:39,330 --> 00:19:43,600 So replace a part of a string. 262 00:19:45,090 --> 00:19:53,910 So let's go call this variable first serial number, which will be ABC and capital letters. 263 00:19:53,910 --> 00:19:54,660 One, two, three. 264 00:19:56,790 --> 00:20:06,660 And then add the prince commands and add the text changed serial number. 265 00:20:07,710 --> 00:20:14,730 Just plain text, then space then plus then add here first serial number. 266 00:20:16,100 --> 00:20:24,260 Same as we did before, and then that again, you see the lower the lower manipulation here. 267 00:20:24,290 --> 00:20:26,330 So now we're going to use the replacement ablation. 268 00:20:26,370 --> 00:20:29,300 You can even choose it with your mouse and double click it. 269 00:20:30,080 --> 00:20:34,880 And then, of course, we replace inside these brackets. 270 00:20:35,720 --> 00:20:44,510 And right here, just put this single quote, Mark and inside just place what you would like to replace. 271 00:20:44,660 --> 00:20:50,150 I would like to replace the one, two, three values and then put a. 272 00:20:52,620 --> 00:21:01,510 A coma and right after the coma, we would set what value we would like to replace it with. 273 00:21:01,530 --> 00:21:07,950 So I would like to replace the one, two, three with four or five, six so anyone can guess what should 274 00:21:07,950 --> 00:21:09,450 we get once we print it? 275 00:21:11,370 --> 00:21:18,810 All right, once we printed, I'm I'm expecting to get A, B, C, four or five, six, because I want 276 00:21:18,810 --> 00:21:20,510 to replace these three values. 277 00:21:21,060 --> 00:21:21,530 All right. 278 00:21:21,540 --> 00:21:22,130 Right here. 279 00:21:22,620 --> 00:21:24,240 Replace these three values. 280 00:21:25,220 --> 00:21:32,030 Who is with these three values, by the way, it's important for me to mention that all the manipulations 281 00:21:32,030 --> 00:21:36,830 that we doing inside the Brint have no effect on this variable. 282 00:21:36,830 --> 00:21:39,580 This variable stands still and is not changing. 283 00:21:39,830 --> 00:21:42,680 We are just changing what we see inside the print. 284 00:21:42,710 --> 00:21:45,680 So this stands still and not changing at all. 285 00:21:46,280 --> 00:21:46,700 All right. 286 00:21:46,700 --> 00:21:47,720 Same as here. 287 00:21:48,020 --> 00:21:48,340 All right. 288 00:21:48,350 --> 00:21:51,770 This variable stand stays with these mixed letters. 289 00:21:51,980 --> 00:21:55,280 Were just printing them in an ordered way. 290 00:21:55,490 --> 00:21:57,920 But it's it still stays in. 291 00:21:57,920 --> 00:22:02,230 It makes way if we take the the variable and print it without the lower. 292 00:22:02,570 --> 00:22:05,780 So this variable stays the same. 293 00:22:07,070 --> 00:22:11,090 So let's try to print it and replace one, two, three, four or five, six. 294 00:22:11,090 --> 00:22:11,660 Just right. 295 00:22:11,660 --> 00:22:12,410 Click and one. 296 00:22:14,660 --> 00:22:22,340 And as you can see here, sorry, guys, let's try to make it a bit more orderly space here and two 297 00:22:22,340 --> 00:22:23,600 dots in space again. 298 00:22:23,670 --> 00:22:28,460 Let's try it again because it doesn't look very good for the for the icier. 299 00:22:30,720 --> 00:22:36,390 And there you have it, we have changed your number with ABC four, five, six, exactly what we wanted 300 00:22:36,390 --> 00:22:37,800 to replace these three numbers. 301 00:22:38,390 --> 00:22:38,910 All right. 302 00:22:39,120 --> 00:22:48,660 Because this replay section takes the value from this variable and replaces it with a new one. 303 00:22:49,110 --> 00:22:55,030 So it takes it takes the value from the variable and changes it to a new one and prints it. 304 00:22:56,340 --> 00:23:01,740 So let's try to do a different thing, replace a part of a string. 305 00:23:04,340 --> 00:23:05,000 Twice. 306 00:23:08,040 --> 00:23:17,280 All right, so let's do second, that's a new it's a new variable, the second serial number and let's 307 00:23:17,280 --> 00:23:22,740 call it a, B, C, one, two, three, and ABC again and now. 308 00:23:23,430 --> 00:23:24,020 All right. 309 00:23:24,030 --> 00:23:25,680 I would like to do the following thing. 310 00:23:25,680 --> 00:23:27,750 I would like to change. 311 00:23:28,120 --> 00:23:31,040 Let's give it a number because it's a bit confusing. 312 00:23:31,800 --> 00:23:34,200 Let's give it the first. 313 00:23:35,700 --> 00:23:39,510 And he has changed serial number. 314 00:23:40,770 --> 00:23:48,090 Second to that space, then space and plus and then we're going to take second serial number. 315 00:23:49,440 --> 00:23:56,300 I'm always going to remind you that once you see this pop up, you can just hit enter boom and there 316 00:23:56,310 --> 00:23:59,670 are to replace an. 317 00:24:00,930 --> 00:24:05,220 Rackets, and now I'm going to replace the ABC. 318 00:24:06,720 --> 00:24:12,310 All right, the ABC here appears twice, once here and once you I would like to replace ABC twice. 319 00:24:12,600 --> 00:24:18,830 So what the code does is takes the variable and start scanning it from the beginning to the end. 320 00:24:19,080 --> 00:24:25,290 And once he finds the ABC, once he replaces it and then he goes further, he sees it twice and he presses 321 00:24:25,290 --> 00:24:27,120 he presses this one as well. 322 00:24:27,540 --> 00:24:29,890 So this is what we're going to show right here. 323 00:24:29,910 --> 00:24:30,240 All right. 324 00:24:30,250 --> 00:24:32,340 So let's do this. 325 00:24:32,670 --> 00:24:35,160 ABC, comma. 326 00:24:36,580 --> 00:24:43,300 And let's replace it with Z, Z in both places that we want and then do another Colma and then place 327 00:24:43,300 --> 00:24:44,270 the number two here. 328 00:24:44,710 --> 00:24:49,590 This is the number of times we would like to change ABC in the spring. 329 00:24:49,870 --> 00:24:53,520 So we would like to replace it once and twice here. 330 00:24:54,550 --> 00:25:02,230 With Z Z value, so right, click on this one and run, whoa, you see it, you see you guys. 331 00:25:02,770 --> 00:25:10,780 It took the variable of ABC one, two, three, ABC and replaced two times the ABC with Z values. 332 00:25:12,310 --> 00:25:22,380 And let's try to do one last thing, which is really cool, let's try to do the following thing. 333 00:25:22,390 --> 00:25:26,690 Let's say let's create a new variable, which will be that before it. 334 00:25:27,050 --> 00:25:31,090 It's important that we give a note, take apart. 335 00:25:33,310 --> 00:25:41,980 Of a variable, according to specific, expert, specific. 336 00:25:43,270 --> 00:25:50,620 Indexed indexes, index and places and. 337 00:25:51,790 --> 00:25:59,500 All right, so before we do that part, let's go a little bit back to this part. 338 00:25:59,830 --> 00:26:07,590 And right here we took the index zero am off this string. 339 00:26:07,630 --> 00:26:08,100 All right. 340 00:26:08,110 --> 00:26:10,450 You can see the square brackets right here. 341 00:26:10,450 --> 00:26:13,850 And we took the index zero, meaning this letter. 342 00:26:14,410 --> 00:26:19,450 So this is index zero and this is the index one and this is index two. 343 00:26:20,500 --> 00:26:29,110 So I would like to take not only the first not only one place, but I would like to take a range. 344 00:26:29,290 --> 00:26:34,240 Let's take a part of a variable called the specific index range. 345 00:26:34,450 --> 00:26:34,840 All right. 346 00:26:35,140 --> 00:26:36,820 So let's do it. 347 00:26:36,820 --> 00:26:42,490 Let's call it a range of 348 00:26:45,580 --> 00:26:46,510 indexes. 349 00:26:48,960 --> 00:27:00,360 And let's take the second serial number enter and then let's place the square brackets and let's place 350 00:27:00,360 --> 00:27:02,640 year zero, two dots and three. 351 00:27:04,610 --> 00:27:08,780 And let's try to present the range of indexes. 352 00:27:09,930 --> 00:27:17,040 All right, so what we are waiting to see is the printout of indexes between the places between zero 353 00:27:17,040 --> 00:27:17,520 and three. 354 00:27:20,640 --> 00:27:22,000 So there you have it. 355 00:27:22,140 --> 00:27:30,090 We have printed the values in the zero place in the first place and in the second place until we got 356 00:27:30,090 --> 00:27:32,530 to the third place, which is not included. 357 00:27:33,300 --> 00:27:33,780 All right. 358 00:27:33,790 --> 00:27:39,840 So we printed all the values in the index is between zero and three, while three is not included. 359 00:27:39,940 --> 00:27:41,860 And we have it right here. 360 00:27:42,540 --> 00:27:52,980 So by now, guys, if you have followed my lecture, you are having pretty much domination in the knowledge 361 00:27:53,130 --> 00:27:55,290 of knowing string values. 362 00:27:55,290 --> 00:28:00,630 You now familiar with manipulation, with multiple manipulations upon string values. 363 00:28:01,560 --> 00:28:06,300 And let's do one last thing. 364 00:28:07,770 --> 00:28:10,680 Combine adding words like that, adding. 365 00:28:12,120 --> 00:28:19,190 Spaces between multiple variables imprint. 366 00:28:19,710 --> 00:28:25,710 So let's do it, by the way, maybe you were asking yourself, why do I use print all the time? 367 00:28:26,010 --> 00:28:32,880 Because print is the way of programmers to see the result, because, for example, if I do the manipulation 368 00:28:33,030 --> 00:28:40,180 like here, I can't really know what's happened behind the curtain, what happened behind the scene. 369 00:28:40,560 --> 00:28:43,400 So if I printed, then I can see it. 370 00:28:43,860 --> 00:28:47,860 But before I if I'm not printing it, I'm not really sure what happened. 371 00:28:48,090 --> 00:28:54,510 So I always use print action to see if the manipulation which is here really occurred. 372 00:28:56,130 --> 00:28:57,900 So let's try to do this. 373 00:28:57,930 --> 00:28:59,100 The following thing. 374 00:28:59,100 --> 00:29:03,420 That's three variables, or in other words, three words. 375 00:29:04,080 --> 00:29:04,510 All right. 376 00:29:04,510 --> 00:29:10,710 The first word will be think second word would be you. 377 00:29:11,520 --> 00:29:14,160 And then Third World would be. 378 00:29:15,590 --> 00:29:16,370 Ninja's. 379 00:29:18,130 --> 00:29:24,280 And then let's try to print it all together with a plus sign you see right here, you have a plus sign 380 00:29:24,280 --> 00:29:25,620 once adding a variable. 381 00:29:26,020 --> 00:29:30,280 So the first variable comes without a plus sign because it's the first one. 382 00:29:31,420 --> 00:29:33,460 And then we add the second. 383 00:29:36,590 --> 00:29:44,390 And plus and then we had the third and last sprint that anyone can guess what will happen, would it 384 00:29:44,400 --> 00:29:45,470 printed correctly? 385 00:29:47,540 --> 00:29:49,430 So let's try to print it. 386 00:29:50,400 --> 00:29:53,530 Oh, boy, oh, boy, we have trouble here. 387 00:29:53,570 --> 00:29:57,620 You see, we have no spaces between the words and it's not good. 388 00:29:57,740 --> 00:29:58,490 It's not good. 389 00:29:58,520 --> 00:30:00,550 It's even worse than this thing right here. 390 00:30:00,890 --> 00:30:05,500 Like, if you your teacher would catch you writing this thing, you will get into trouble. 391 00:30:06,050 --> 00:30:08,000 So we have to fix it quickly. 392 00:30:08,360 --> 00:30:12,520 So we have to waste and adding spaces here. 393 00:30:12,920 --> 00:30:15,110 So the first way would be the following. 394 00:30:15,470 --> 00:30:16,730 You see here the first ring. 395 00:30:17,480 --> 00:30:20,930 So we have opening world marks and closing both marks. 396 00:30:21,110 --> 00:30:27,430 But what would happen if I would add a space space right here and the space right here? 397 00:30:27,770 --> 00:30:32,360 So we have the first word and then we would have space at the end of it. 398 00:30:32,570 --> 00:30:38,630 And then we have Second World and we have the space at the end of it, and then we have the Third World. 399 00:30:39,450 --> 00:30:41,270 I think we will be all right. 400 00:30:43,730 --> 00:30:44,170 All right. 401 00:30:44,180 --> 00:30:46,550 So you see here, guys, amazing. 402 00:30:46,560 --> 00:30:51,530 So once you have the space right here, you can see the sentence printed correctly. 403 00:30:52,430 --> 00:30:54,230 So this is one way to do it. 404 00:30:54,440 --> 00:30:57,940 But there is another way, and I'll show you that one as well. 405 00:30:58,220 --> 00:31:04,810 So here we have the first word and right after we have the second word and in between, if I leave it 406 00:31:04,810 --> 00:31:09,800 the space like this, so the program would not recognize that we have a space. 407 00:31:09,810 --> 00:31:14,200 You see, it doesn't recognize because this space is not mentioned inside the prints. 408 00:31:14,420 --> 00:31:21,110 So what you want to do is to add another plus here and to add like you can write here, whatever you 409 00:31:21,110 --> 00:31:21,350 want. 410 00:31:21,350 --> 00:31:23,750 But I want I don't want to write you anything. 411 00:31:23,750 --> 00:31:25,340 I just want to do the space. 412 00:31:25,590 --> 00:31:25,930 All right. 413 00:31:25,940 --> 00:31:32,330 So you see here in between, you have a space and I would like to do it one more time in here. 414 00:31:33,450 --> 00:31:34,230 And Espace. 415 00:31:35,580 --> 00:31:42,570 So now you have space in between words and this is great, so let's try to print it. 416 00:31:44,660 --> 00:31:52,520 And there you have it, you have spaces between words in a second in a second way, and this basically 417 00:31:52,520 --> 00:31:57,350 concludes our our part of examples for string variables. 418 00:32:10,520 --> 00:32:11,990 I hope you enjoyed the video.