Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Hurray.
It's time for our third data structure as we continue down to our different data types in Python and
this one is called a couple or tuple depending on how you like to pronounce it and we actually saw this
slightly when we talked about dictionaries.
But before we get into that what are couples well a topple our like list.
But unlike lists we cannot modify them.
There are immutable.
So you can think of them as immutable lists and they look like this.
So let's call it my topple is going to use brackets to denote a couple and we can do one two three four
five just like a list.
Now you remember how in a list we could have modified this and said index of 1.
Well now is going to equal Z.
If I run this it's going to error out it's going to tell me hey tuple object does not support item assignment
a topple is immutable.
Once you create it it's the way it is.
You can't sort it or reverse it like we saw with lists.
It's just there.
What about this.
Can I just print a topple and just grab the second item on that topple Well yes you can.
Just like a list you can access it through an index.
Can I maybe do does 5 exist in my topple just like we could in a list.
Well yes we can.
The difference is that it's immutable right now.
Why do we need this.
I mean we already have lists so why do I have to learn to spell if you know it's pretty much the same
as lists.
The only thing is I can't change it.
There's a few benefits to this.
For example if you don't need to change the list that makes things easier because it tells other programmers
looking at your code hey this shouldn't be changed.
I'd like a list.
I want this to stay the way it is.
Keep this order so it makes things easier and more efficient.
It makes your code safer because people can modify right it makes code more predictable.
However it makes code more predictable but it's less flexible than a list.
I can't really sort a top or I can't run reverse on topple now because of this because they are less
flexible.
The other good thing about them is that they're slightly more performance than lists so they're usually
faster than lists and if you don't need a list to change we'll use a couple.
So a good use of a typo for example if you work at Uber is a geographic location and coordinates right.
You can have latitude and longitude here and because let's say this won't change or maybe a user's location
or pickup point doesn't often change we can just use a couple.
However maybe when you're in a car as a driver and you're Uber driver well you probably need your coordinates
your latitude longitude and a list because your car is moving that's constantly changing and we saw
it topple when we talked about dictionaries right.
Remember when we did user 4 we did user dot items and then I said Hey just print user dot items and
we saw here that we got a dictionary items and inside of this dictionary we see that basket one two
three greet Hello.
An H 20 are a Tupolev so this actually returns are key and value as a couple.
And as I mentioned before a dictionary can have keys that are immutable.
So a topple is a completely valid key in Python so I can do want to hear and that is a valid key in
a dictionary and the way I would access this would be like user curly bracket.
Want to so that if I click Run here I have an extra bracket.
Let's fix that.
Let's click run again.
And there you go.
I'm able to grab user top a 1 2 and grab 1 2 3.
List you see here how I'm trying to use different data structures combining them together.
Let's take a break and finish off our understanding of couple in the next video.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.