So what I'm going to do now basically is to resolve the homework and we're going to try and do it together.
I'll just open the project, as we did in last lectures and this window.
All right.
And.
That's great, Hugh.
A new file called.
Variables, homework.
I'm just going to mention a small quick note.
All right, once you create classes or in other words, a module and become, you have to start with
the capital letter.
We already discussed it in the previous lecture.
But if you have several words, just stick them all together.
And each and every word will start with a capital case, meaning capital letter at the beginning of
every war that you have.
All right.
So the headline will be like this string variables, homework, practice.
Right.
And the first assignment was to create a sorry guys windows serial number variable that each value will
be A, B, C, D, E, F, G, H, I and J, k, l.
Great.
So let's just mention that this is part one.
Create a simple variable.
With the following values.
All right, so let's head up to the second part, which is part two, and we talked about using the
index and ranges to take part of the original string.
Correct.
So let's try to do it.
Let's just do let's just do give the first the names new partial.
You can give any name you want.
As long as it is.
As long as who reads it can understand what your meaning here, as long as it's a meaningful name.
All right.
So it's very important to give meaningful names.
So I'm just going to create four of these and just change the last letter here to indicate the difference
between them.
And right now, as I just mentioned in the hint, we're going to use we're going to just take the original
a variable.
Right.
You see, it's you have a pop up of to completion here from just hit enter whoopsie again and then square
brackets.
And I'm just going to take the zero to three values and this will basically give me A, B, C.
Correct.
So I want to do the same thing and just copying it with control C and control V to based.
Basting a three year and here I'm going to take four to seven.
All right, so just a quick reminder, we're starting the count from zero.
So this is one to zero count.
This one is one and this one is two.
And this one is three.
Wow.
Three is not counted.
We talked about it in the previous lecture that you have the range here and the last number is not counted.
So basically you take from zero to three without the three.
So we have zero to three without the three zero one and two.
And then we want to skip the minus and start off from force of this one is four, five and six.
All right, and this one is seven, so we have four to seven without the seven, same as the same as
we did in as we did in here.
All right.
And so on and so on.
So here it will be a 211.
And here it's going to be a 12 to 15.
And now this just for verification, let's just try to print them, all right, we print the first one.
I'm always going to mention the small tips, even if it's annoying.
Guys, for those of you that don't remember, I still once you try typing, you have this pop up and
you have all the options, you don't need to manually type everything.
So, for example, now I want you to print the new partial variable B, so I have it right here.
I just hit enter boom.
So it's you.
And now I'm going to do it for C and I'm going to do it for.
D..
All right, so for now, let's just try to verify that what we did here in part two is correct.
All right, so great, we have what we wanted.
We have ABCDE, Faggotry and Jayco and exactly what we wanted.
All right, so we broke down the four parts of this year number exactly like and we wanted to do in
part two.
And let's head up for part three.
So in part, were you what we were needed to do is to.
Replace values with new ones.
Using replace.
All right, so this is the name of the action that we have studied in the previous lecture.
Oh, I missed here the number.
And capital.
All right, so let's just do let's just take the the variables ABCDE all right.
From here, I'll just copy copy them manually.
So we have a.
Now we have the.
S..
And so because, you know, I'm copying them altogether, because it's the same action up on each and
every one of them.
So once we figure out how to do it, the first one, always the same thing for the other ones as well.
So what we want to do actually, guys, is to replace the the values.
So how do we do it?
It's really easy.
Think of it as a logically, we just take the existing value.
All right.
We take the existing this one and this one are the same.
Right.
But here we declared a new variable.
This is one is a new variable is same is in math that you write, for example.
This is just an example, right?
Same as in math that you write like X is five plus three.
All right.
So you declare a variable.
And you put a value to it, so the left side is always a declaration and the right side is always the
value that you put inside the variable.
This is very important.
All right.
You can get your life really easy regarding these street variables.
So this is the variable that I have.
And now on the right side, I'm going to put the value to it.
So what value do I wanted to put in it?
So I'm just going to hit it that they replace.
And then as I recall, we needed to take the ABC.
Right, because this is what we have in new partial variable and replace it with AAA.
Right.
And we wanted to do the same with the second one.
Let's just choose B here.
Don't be.
And that's replace and single quote and then.
Replace the DSF with baby.
Oh, I've missed the single quote, maybe be all right.
Thirty one new partial C that's in place, then we have GHC.
And right after the coma and quoting Mark, we have a coma and then another clotting and C.C.C. and
the last one knew partial these dots place and we want to replace the J.
K l.
Coma with the the the correct just to verify the step, let's let us just print it again.
So.
So, guys, the program runs from top to bottom.
OK, so here we declared the new partial a variable here we printed it, but here we declared a new
value to it.
So once once the program runs from top to bottom and it got to this point right here.
So we have inserted a new value into a new partial variable, new partial variable.
A has a new value now.
So the print over here is going to print ABC, but once we print again here.
He's going to print AAA because this line indicates that new partial variable A has a new value inside
it.
So it's going to print AAA according to what we wrote here.
All right.
So so I'm just going to copy all of these.
All right.
Because it's the same command, the same variables, but different values to the variable.
So it's very important.
All right.
So let us just verify it and.
Right.
Click and run.
All right, so we have A, B, C, D, E, F, G, G, Chai and Jakiel from the previous from like a
step two part to and from part three, we have AAA, BBB, CCC and DVD.
This is exactly what we wanted to achieve.
We use here the replace action and we replaced the current value inside it with what we wanted right
here on the right side.
So we're down to part four.
And in part four, we wanted to create a new serial number.
Out of the new.
But sorry, partial partial ones.
All right, we wanted to take.
Sorry, guys, we wanted to take these four variables and we wanted to create a new one.
So we were asked to call the variable and encoded.
Windows serial number.
And how can we actually combine these four?
It's really simple.
We'll just take the first one and then use plus so it's not a mathematical action, we're not going
to combine AAA and plus BBB, it's not going to give a mathematical result because this plus sign is
upon a string.
All right.
Well, we're dealing with string values here.
All right.
We're dealing with string values here.
So this action will actually just stick them together because you can't really do a plus sign upon letters
or it doesn't matter if even if you had, like, numbers here, you can do a plus plus assign upon string
values because it's not possible.
So this is just going to stick them together.
So I'm just going to double click the new partial variable B and control V to base it here.
Another plus control C to copy control V and another plus and print it.
So let's just print it and just copy it.
Double click control.
See.
And print, enter and control V to paste it as just right, click and run.
All right, so we have the serial number right here, but we have a slight problem because the original
the original serial number had like minus signs between them.
And we've been over this in the previous lectures.
So what we're going to do is just insert another plus here.
All right.
We have a look.
I just wanted you to go into the details.
We have the first one right here.
We had the second one right here.
And between then, we have a plus.
So what we want to do is to add another plus here and then add quoting Marx and then add a space between
them.
And actually, we don't need a space.
We need a minus sign between them because we want the new serial number to look like this with a minus
sign between each part.
So what we got here, we have the first part and then we have a plus with a minus and then we have the
second part and so on.
So let's do it here as well.
Plus.
Quoting Marks and minus and here as well, plus quoting Marx and Mind and minus, so right, click on
the file and run it.
Whoa, guys, you see it.
We have exactly what we wanted.
And Part five was.
Print the serial number.
Along with plain text, so this one is pretty easy, just add the quoting marks and state and encoded
serial number.
Ahead and then another space and after the quoting marks, just add the plus sign and take this very
this final variable that we have copied and pasted here and let's print it.
So there we have it, we have the final serial number that we wanted after we manipulated it.
So let's have a quick look what we did here.
We've taken a base serial on the serial number, and afterwards we first declared variables A, B,
C and D, partial ones.
And we've put these values inside them.
We've taken the original serial number and we have just extracted values zero to three into it.
And same here a and here just printed it afterwards for verification.
Then we've taken these four variables right here.
We declare them again and we have changed the value which is inside them.
We've taken the same value and we applied to replace action upon them, change the value inside from
this value to that one and the same for all of them.
Then we printed it quickly to see what we have inside, just to verify it.
Afterwards, we combine the four parts altogether and added a minus sign between them in order for the
new serial number to look like this.
And the last part was just to add plain text here and afterwards sprint the new serial number.
So guys, we finish to practice string variables.
This was amazing.
I think dominant dominating the string variable if we got until this part.
Don't be scared if it wasn't very easy for you because it was indeed a challenging assignment.
So I just want you to understand what we have done.
And this is the important part to understand what we are doing.
And even if you didn't do everything by yourself, even if you did some parts, it's all right.
We're in a learning process.
And don't worry, we're going to practice the shrink variables and again and again in the future as
well.
And I recommend that after this lesson, the homework lesson, just try to play with these variables.
Just for example, just for I'm just just an example.
Just changes from AAA to AA and just printed again just like that.
Right.
So, for example, we have printed the V.A. We see it here and afterwards we can see it also in here.
Just do some do some tricks on the cold, as you can see right here.
And also this file is attached to the lecture, so you can just copy it.
It's a plain text file.
You can just copy it into your polytrauma and use it.
And just don't be afraid to change values here and just to get the hang of it deeper as much as you
can.
All right, guys, thank you.
And I will see you in the next lecture.