Hi, everybody, and welcome, and this lecture will discuss our fourth and last collection, which
is Stop all this lecture will cover the basic part of the which will be followed by the dance spot with
many examples, as always.
OK, so let's begin this go straightforward to the characteristic list of Toppo.
All right.
So Toppo is indexed and ordered, meaning it has indexes for each cell.
If we compare it to a dictionary or a set that is unordered and on the index.
So in this case, we can extract values by index.
Also, tuple cells cannot be changed, same as set.
So once you created it, you cannot change Sayle values.
And you can also you cannot you cannot add cells after you create the double and you cannot delete cells
after you created.
So these three tell us the tuple is a sort of speak a fixed collection, meaning after you create it,
do not touch it.
This is very useful, but nevertheless it's a bit challenging.
So pay attention once you choose a collection, if you choose tuple, you will have a reliable data
that will be there forever.
It doesn't matter if you want to become a web developer or an information developer.
This collection is very, very useful.
All right.
Also tuple is a single value Purcell collection, meaning if we compare it to a dictionary, we had
there a key and the value for each cell.
So we had two items in a cell.
In this case, same as set and same as lists, we have only one item, Purcell and how actually tuple
can be differentiated from a list.
So once you see round brackets, you can identify definitely that we are discussing a tuple because
a list has square brackets while tuple, has a round bracket.
So this is what differentiates it from a list.
All right.
So from here, let's go straight ahead to our example that are following manipulations would be based
on I saw I created a tuple May called professions in the industry.
We have meaningful professions here, starting off with round brackets and the quotation marks, which
will include Excel cell value and Yepp and the way divided with a comma right here.
So we have front end back and they have all sensu same as last.
This cell starts from index zero.
This one is index one index to an index three.
All right.
So we can begin now with the basic manipulations upon tuple.
So first thing first, let's see how can we access a sale by its index?
So once we want to access a certain sale, we just mentioned the name of the tuple and use square brackets
with the index cell number inside it.
So pay attention and do not get confused.
Once you create a tuple, you use round brackets, but once you want to extract the value from a top,
you use square brackets.
So this is very important.
Remember it.
And also, of course, as always, you're going to practice it and the following lecture.
Next in line is, let's see, how can we access a sale by negative index?
OK, we've seen this material in lists.
So once we mentioned the couple name that the collection name and we put inside these square brackets,
the number minus one, we will get the extraction of the last cell.
So minus one means.
Give me the last cell if you want one before last.
Meaning this one just put minus two here and so on and so on.
All right.
So in our case, minus one, we'll extract us the Kuai value, which is the last cell value.
And last in line is how can we access several cells of by range of indexes?
Again, this material was mentioned in this lecture and I really advise you to go over it again if you
got confused.
And basically what that means is once we want to extract several values at once in a range of indexes,
we should use the following technique.
We just mentioned the name of the tuple and inside square brackets.
We put the range.
In our case, it's one till three.
And if you recall.
All right, so from this, this item is not included.
All right, so in our case, we have cell number one.
We have cell number two and cell number three is not included, so we'll get only the back end and their
ops extraction in this case.
OK, so basically it's a reversal to what we started in this, but here we applied it.
And Toppo, I think this sums up the basic part of Toppo.
As you can see, it has a bit different characteristics from the other collections.
It has some similarity to set regarding changing values.
But also in this case, you cannot add new cells and you cannot delete existing cells as well.
And it's basically, as I mentioned, it gives us reliable data that will stay there forever.
All right.
So this concludes our first lecture off topic.
I'll see you in the next video.