Now, tuples, like I said, are quite similar to lists.
So.
If I wanted to.
I can say new tuple and use my tuple and then slice that tuple.
So for example, if I do one to like this and print new.
Tuple.
I'm going to get to comma.
Hmm.
Why is that?
Well, we start at zero one and end at two.
If I did four here and click Run.
I get two, three, four.
It's still a tuple, but you have to remember that a tuple that only has a single item tends to have
this little comma at the end, but it's still a tuple.
And just like a list, I can assign different things.
For example, I can say x equals to my tuple zero and then I can say y equals my tuple one and x and
y will equal one and two.
But a short form of doing this again similar to lists.
Is to say, hey, I want.
X.
Why?
Z.
And you know what other?
To be the values assigned from the tuple, so that if I do X here and I run, I get one.
If I do z and I run.
I get three?
What if I do other and if I click run, I get four and five as a list.
All right.
If your head doesn't hurt by now, don't worry.
I have some good news.
Luckily for us, a tuple has only two methods that we care about count and index.
How nice is that?
So nice and simple.
Guess what these mean?
So let's go back to my.
Couple.
And now try this out.
If I go my top old debt count, well, it's going to count the value.
So if we want to count how many fives occur in the tuple, I get one.
If I had another five in the tuple, I get two.
What about index?
What's the index of five?
Well, the index of five is four because zero one, two, three for the first.
Value that it finds it's going to return the index of.
And then finally, we can also do length, right?
We can use this built in function to run length and it's going to tell us that, yep, it has a length
of six.
Awesome.
There it is.
We're flying through them now.
This is our third data structure, remember?
They're simply lists that.
Are immutable.
I'll see you in the next one.
Bye bye.