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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,540 --> 00:00:00,960 Hurray. 2 00:00:00,970 --> 00:00:07,380 It's time for our third data structure as we continue down to our different data types in Python and 3 00:00:07,390 --> 00:00:15,340 this one is called a couple or tuple depending on how you like to pronounce it and we actually saw this 4 00:00:15,430 --> 00:00:18,270 slightly when we talked about dictionaries. 5 00:00:18,400 --> 00:00:26,670 But before we get into that what are couples well a topple our like list. 6 00:00:26,680 --> 00:00:30,670 But unlike lists we cannot modify them. 7 00:00:30,670 --> 00:00:31,950 There are immutable. 8 00:00:32,080 --> 00:00:36,900 So you can think of them as immutable lists and they look like this. 9 00:00:36,970 --> 00:00:47,060 So let's call it my topple is going to use brackets to denote a couple and we can do one two three four 10 00:00:47,180 --> 00:00:49,700 five just like a list. 11 00:00:49,760 --> 00:00:57,640 Now you remember how in a list we could have modified this and said index of 1. 12 00:00:57,710 --> 00:01:00,720 Well now is going to equal Z. 13 00:01:01,040 --> 00:01:08,330 If I run this it's going to error out it's going to tell me hey tuple object does not support item assignment 14 00:01:08,960 --> 00:01:10,830 a topple is immutable. 15 00:01:10,850 --> 00:01:13,210 Once you create it it's the way it is. 16 00:01:13,220 --> 00:01:17,010 You can't sort it or reverse it like we saw with lists. 17 00:01:17,030 --> 00:01:19,220 It's just there. 18 00:01:19,250 --> 00:01:19,910 What about this. 19 00:01:19,910 --> 00:01:29,970 Can I just print a topple and just grab the second item on that topple Well yes you can. 20 00:01:29,980 --> 00:01:33,790 Just like a list you can access it through an index. 21 00:01:33,790 --> 00:01:43,740 Can I maybe do does 5 exist in my topple just like we could in a list. 22 00:01:43,750 --> 00:01:46,890 Well yes we can. 23 00:01:46,900 --> 00:01:50,490 The difference is that it's immutable right now. 24 00:01:50,560 --> 00:01:51,670 Why do we need this. 25 00:01:51,670 --> 00:01:56,680 I mean we already have lists so why do I have to learn to spell if you know it's pretty much the same 26 00:01:56,680 --> 00:01:57,550 as lists. 27 00:01:57,640 --> 00:01:59,950 The only thing is I can't change it. 28 00:01:59,950 --> 00:02:01,770 There's a few benefits to this. 29 00:02:01,780 --> 00:02:08,020 For example if you don't need to change the list that makes things easier because it tells other programmers 30 00:02:08,020 --> 00:02:10,720 looking at your code hey this shouldn't be changed. 31 00:02:10,760 --> 00:02:11,500 I'd like a list. 32 00:02:11,500 --> 00:02:13,120 I want this to stay the way it is. 33 00:02:13,120 --> 00:02:17,480 Keep this order so it makes things easier and more efficient. 34 00:02:17,710 --> 00:02:23,680 It makes your code safer because people can modify right it makes code more predictable. 35 00:02:23,680 --> 00:02:28,940 However it makes code more predictable but it's less flexible than a list. 36 00:02:28,990 --> 00:02:35,800 I can't really sort a top or I can't run reverse on topple now because of this because they are less 37 00:02:35,800 --> 00:02:37,090 flexible. 38 00:02:37,090 --> 00:02:43,120 The other good thing about them is that they're slightly more performance than lists so they're usually 39 00:02:43,120 --> 00:02:49,370 faster than lists and if you don't need a list to change we'll use a couple. 40 00:02:49,390 --> 00:02:56,370 So a good use of a typo for example if you work at Uber is a geographic location and coordinates right. 41 00:02:56,380 --> 00:03:04,780 You can have latitude and longitude here and because let's say this won't change or maybe a user's location 42 00:03:04,810 --> 00:03:09,810 or pickup point doesn't often change we can just use a couple. 43 00:03:10,000 --> 00:03:17,050 However maybe when you're in a car as a driver and you're Uber driver well you probably need your coordinates 44 00:03:17,050 --> 00:03:23,890 your latitude longitude and a list because your car is moving that's constantly changing and we saw 45 00:03:23,890 --> 00:03:27,580 it topple when we talked about dictionaries right. 46 00:03:27,580 --> 00:03:40,920 Remember when we did user 4 we did user dot items and then I said Hey just print user dot items and 47 00:03:40,920 --> 00:03:47,760 we saw here that we got a dictionary items and inside of this dictionary we see that basket one two 48 00:03:47,760 --> 00:03:50,160 three greet Hello. 49 00:03:50,250 --> 00:03:58,830 An H 20 are a Tupolev so this actually returns are key and value as a couple. 50 00:03:59,720 --> 00:04:06,560 And as I mentioned before a dictionary can have keys that are immutable. 51 00:04:06,560 --> 00:04:14,300 So a topple is a completely valid key in Python so I can do want to hear and that is a valid key in 52 00:04:14,300 --> 00:04:21,730 a dictionary and the way I would access this would be like user curly bracket. 53 00:04:21,820 --> 00:04:27,910 Want to so that if I click Run here I have an extra bracket. 54 00:04:27,910 --> 00:04:28,680 Let's fix that. 55 00:04:28,690 --> 00:04:30,250 Let's click run again. 56 00:04:30,250 --> 00:04:31,000 And there you go. 57 00:04:31,000 --> 00:04:35,560 I'm able to grab user top a 1 2 and grab 1 2 3. 58 00:04:35,590 --> 00:04:41,860 List you see here how I'm trying to use different data structures combining them together. 59 00:04:41,980 --> 00:04:46,060 Let's take a break and finish off our understanding of couple in the next video. 5826

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.