Everybody and welcome to the next video.
So in the past two videos we talked about a dictionary and a list.
Now we're going to round this up with something called a double now topple is an immutable list.
Think of it as an immutable list.
Now what immutable means is that it cannot be changed once you've created it.
Now that's an important concept because lists and dictionaries you can change on the fly you can add
things remove things.
However couples they're going to stay the same once created.
It's important to understand that they have their uses.
However it's not nearly as used as you're going to find lists and dictionaries.
However sockets when you create a socket as an example which will go over and it's own video.
But when you create that it takes a hostname and a port.
Now that hostname or IP address and a port has to be passed as a Tupolev now because because of that
they're not going to change and they will not change once they're passed.
And that's the important bit.
Because they cannot change when you start making in working with socket connections.
But we're going to go over how to create a table.
Right.
So how we create this will do great double
tuple area.
The way this works.
Just read the quotes and we'll do.
Brandon comma 26.
Hello red team.
Right.
So this is how a couple works.
It looks different than what's good is not using block quotes and it's it's different than a dictionary
because it's not using the curly close or curly brackets so since this has been built let's do a quick
print table.
We should get our print just like we're used to before.
Right.
Sorry about that.
Forgot the other
print.
We see prints perfectly fine.
However if we try to do double and we try to set let's say element zero or 1 go to twenty seven and
we print
double again
we get an error.
It does not support it you can't change it it's not meant to be changed.
It is static.
However we can do things similar to how we did with dictionaries and less.
So how do we look up if Brandon is in or 26 or random nation is in trouble.
So we could do if for example if Brandon
in trouble then we print
it right
perfect about it so you can look through things with the top just like you would normally.
That's not a problem.
Just to understand that it's immutable in that it does not change.
Now to look through this we can do the exact same thing we did with lists.
We have two options.
We can do our for loop so for x in trouble we print out x.
So if we go ahead and do that we'll get our print.
So Brandon twenty six right.
Right.
However we can print it out by index as well.
For i in range and the length of the double print double
just exactly as we did Phyllis and we can see we print it twice here.
So that's what the trouble is.
Understand that it's very very similar to a list.
However it does not change.
It doesn't matter how many you can't add to it removed from it.
If you can delete the whole thing you can reset the whole trouble to be empty but you cannot modify
it or the data once it's been set.