Hello, so and this video will resolve last videos assignments, so once you open your project, just
create a new file, give it an indicative name, for example, collections.
List.
And then practice basics.
Let's give a nice comment, basically the same one.
And all right, so first of all, I asked you guys to create a new list, so just declare a name and
then put the equal mark.
And once you do that, you see Python does not know if it's a variable of its own or if it's a list
or he doesn't know what it is.
But once you apply the square brackets, he immediately removes the red area from below and he knows
that this is a list.
So add and then a car brands into the list, so their names.
So we have to put quotation marks and let's start off with BMW and then it Colma dividing it and then
Toyota
and then we have Dassler and Kiya.
Do you have closing quotation marks here and also, let's see, a small thing, what happens if I remove
the quotation marks by Chami immediately sets a red line B below the text and Southeastern error, and
he has some trouble with it.
All right.
So let's print it out print and the indicative comment.
All right, and then put outside quotation marks, the glass.
Then do the casting into a string.
All right, we all remember a whole pie chart was angry.
We were not casting.
So here we have a string and here we have a list.
So by Trump does not like two types of data types inside the print, so we need to cast it for all of
it will be a string that's trying to run it.
And there we have it.
We have the list printed as following.
So let's head over to the next assignment.
Just print out.
That one before last, I last them.
Out of cars list and how do we do it?
So, first of all, declare the list cars and then if you remember, when we want the last item, we
put minus one here.
This is the last item on the off the list.
But we want one before last.
So we go one lower minus two.
Basically what we want to print out is Destler.
So let's try to print it.
All right.
And right here had a comment and a comment, one before last night off the list.
Plus casting and close it and also, guys, you see when you put your cursor near the brackets, you
can see the sibling brackets is marked for you.
So if you get confused, if you're having too many brackets, so you always, always can see who the
sibling bracket, LAMARTINE Yellow.
All right.
And this one as well.
All right, let's try to run it.
Great.
So we have Dassler printed out exactly what we wanted.
Let's head over to the next assignment and compare it like something happening here in COMPAR.
Uh, compare.
Lists item on index one to.
Toyota strength.
So we want to pull out from cars.
The value from one and use a comparison operator double equals sign and to compare it to a simple string,
which is quotation marks, Toyota like that.
So all of that needs to be covered with a print.
All right.
So closing in, that's an indicative comment about comparison between zero one.
From cars.
To.
Toyota.
And then close quotation Mark Glass and casting is always to a.
So I just want to hold on here for a second.
You might notice that our print actions used to be really simple.
We just added a simple string and then a variable, and that's it.
But here we are already trying to print out manipulations.
So like actions taken inside the print.
And here we are.
We have also a comparison operator inside it.
So it's not as simple as it was before because we have some complications here.
We have some calculations and but it's the same the same principle.
Like if you want to add a comment, just add it in quotation marks and then add a plus and cast whatever
you want inside of records and it will be printed up.
So let's check this out.
By the way, what value are we expecting once we're applying a comparison operator?
So we're expecting a boolean variable rate, a true or false value as we study.
So let's try to print it.
Great.
So we got what we want here.
We compare the Toyota from inside the list and we compare that with Toyota's simple string and we got
a true value.
Let's try to change it to N equals with an exclamation mark, an equal saying.
And when we run this one, so we get a false because we asked whether Toyota and Toyota are not equal.
And this is a false statement.
All right, so let's head over to the next one.
So now we would like to create a new list called.
Mixed values, right?
So we have the mixed values.
And we want to put some values in it, so first one in line is Jim, so give us a name.
So we have to put quotation marks in order to indicate that this is a string variable inside the list.
And this one is a number.
So no quotation marks needed.
Next one is Alex, which is also a string.
And then we have to dot five three, which is a float, also a number of quotation marks.
And last but not least, we have the boolean variable, which is true.
And there you go.
So we have a list that makes one that contains string and float and boolean, and that's great.
So we have lots of types here and now.
Once we have it, let's try to printout.
First of all, we want to print.
Bring the list, makes the values.
All right, so closing quotation marks.
And casting and then mixed values.
Yeah, all right, that let's try to run it.
All right, so we printed it out and now let's do an interesting thing, let's just pull out the values
in the sales between zero and three, including three.
So print out the values out of mixed values.
From the cells.
Zero to three, including three.
Right.
So how do we do it?
So we studied it in the theory part of this, which is declare the list.
Then inside the square brackets we put the limitation and we have two dots between them like that.
And do you remember if this is the correct answer?
Because I think that we need to think again if we agree that this is the correct, because if anyone
remembers, we said something about the ending of the limitation here, that this one, the third one,
which one is the third one in the mixed values.
All right.
This is zero.
This is one.
This is two.
And this is three.
So let's see if this value will also be printed.
As you can see, it's not printed, all right, so it's not printed and this causes us a trouble because
we wanted to print this value as well.
So what we need to do is to put number four here and then three will be included as well, which is
to dot five three.
So now we see it right here.
Great.
And let's go over to the next assignment and try to print out the value off.
And that's six out of the mixed.
Values.
So when we try to print it and that's put the mixed values and square brackets six where we try to print
it as see, we have no sixth sell in the list.
We have cell number zero sell number one, two, three, four, and we're finished.
So we're trying to tell the cold print of the cell number six, but we don't have it.
So once we run it, obviously we have an error.
All right.
So our everything comes after this will not be executed.
Let us check.
Let's try to see if we can get the print of lots of X's after this one, after the error.
All right.
So when we try to run it, you see the exact printout did not occur because it was not executed this
year or has blocked the running of the code.
So basically, what we need to do now is what we discussed in assignments and assignments.
Assignment number seven, just to mark up this line and then heat up control and backslash together.
And you see this was edited and this one is commented out of the code.
When we run it right now, we can see the Xs printed up.
All right.
And now let's go after the last assignment, which is.
And the value.
All federal mail to the cars.
List, and when we want to add some items to the list, we just do the following, we just do the cars,
declare the we call out the list and then use that.
And we have actions here.
So that's just the action.
Bend it.
And inside, because we have a string that supply quotation marks and add alpha.
ReMail and this action adds a value to the list as the last item.
It adds another index to the list.
All right.
So let's try to print it out.
Glassless, printed after the hour of.
All right, so let's add the cast list.
So basically what happened is we had the cast list.
Declared here, and it had only BMW, Toyota, Tesla and Kia, and then right here we have added another
item to the list.
So since this point and on so since this dot, since this moment and so on down the road, once we print
the cars, it will be an updated list.
All right.
It's an updated list.
And if we try to print it right here where the courser is right now, right here, it will be printed
out without the alpha male because it hasn't been updated yet.
OK, so that's casting.
And you know what, that's out here after adding.
We already have the after, all right, and that's the here and now the president, because I want to
show you what what I just talked about cars list before at the of.
So, all right, so that's the plus here, gas the cars.
OK, so let's try to print it out.
And there you have it, so cast list before adding Alfa Romeo, all right, which we try to print it
right here before we apply the append action does not have Alfa Romeo.
Once we used the append action, once we tried to bring the updated list, we can see Alfa Romeo added
right here.
So we're complete.
We have completed the basics practice part of this again, don't be worry about if you did not succeed
the last assignment, because we haven't covered it yet in the material, we will start covering this
advanced lecture and the next video.
So don't worry about it.
And that's about it.
You guys see you and the next video.