All language subtitles for 39. Tuples

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian Download
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

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.