All language subtitles for 018 Dictionaries-subtitle-en

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
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
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
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,709 --> 00:00:08,580 Hey, hello! Let's look at dictionaries in this lecture. This far we've looked at strings 3 00:00:08,580 --> 00:00:15,150 we've looked at lists and tuples and now we have yet another data type and these are 5 00:00:15,150 --> 00:00:23,430 dictionaries. Let me open the python shell. And let me create a list first I'm just 7 00:00:23,430 --> 00:00:28,140 creating this for reference, so to compare lists with dictionaries, but you 9 00:00:28,140 --> 00:00:32,940 don't need to create a list for creating a dictionary. So to create a dictionary 11 00:00:32,940 --> 00:00:40,140 you need curly brackets, so open and closing curly brackets and then inside 13 00:00:40,140 --> 00:00:45,719 that you'd pass the items of the dictionary. Now the difference here with 15 00:00:45,719 --> 00:00:52,230 dictionaries is that instead of letting Python add default indexes for your 17 00:00:52,230 --> 00:01:00,390 items you want to create those indexes yourself exclusively so therefore for 19 00:01:00,390 --> 00:01:09,960 dictionaries you do something like this. Name, a column and then the item. Let me 21 00:01:09,960 --> 00:01:20,159 write another one, surname column and then the other item and yeah that's it. 23 00:01:20,159 --> 00:01:25,950 That's the dictionary. So what we have here is when I was talking about 25 00:01:25,950 --> 00:01:31,229 indexing I was referring to these things. Actually these two are referred to as 27 00:01:31,229 --> 00:01:38,189 keys, not indexes so for dictionaries you can create custom indexes so to say and 29 00:01:38,189 --> 00:01:45,329 so these are keys so we have key and value, key and value. This is good because 31 00:01:45,329 --> 00:01:51,329 now if you want to access one of the values of the dictionary again you'd use 33 00:01:51,329 --> 00:01:56,939 square brackets just as you did with strings lists and tuples and then there you 35 00:01:56,939 --> 00:02:02,909 pass the key which value you want to extract, so if you want to extract John, 37 00:02:02,909 --> 00:02:09,300 you want to pass the key of John and that will extract the John value. Something 39 00:02:09,300 --> 00:02:13,470 to note is that dictionaries are an unordered colecton 41 00:02:13,470 --> 00:02:20,250 of items and so sometimes you may notice that the order of the key and 43 00:02:20,250 --> 00:02:26,550 values is not maintained so you may see that surname has gone to the first place, so 45 00:02:26,550 --> 00:02:32,160 surname Smith and the pair has gone the first one and name John is the second 47 00:02:32,160 --> 00:02:37,110 one and so on. So this is different from lists, strings and tuples. The reason why 49 00:02:37,110 --> 00:02:42,210 Python doesn't keep the order is that you know the way you access dictionaries 51 00:02:42,210 --> 00:02:49,890 is you exclusively pass the key of the dictionary when you access it and so you 53 00:02:49,890 --> 00:02:54,209 don't need to know the order of the dictionary. And whenever you want to access 55 00:02:54,209 --> 00:02:57,510 something you say the surname for instance and that will the return Smith 57 00:02:57,510 --> 00:03:02,340 no matter where Smith is, so whether it is the first one, the second one or over 59 00:03:02,340 --> 00:03:10,500 and so on. And interestingly in dictionaries you can also pass, you can 61 00:03:10,500 --> 00:03:17,940 have like lists as values or even tuples, so let me write a circle there or let me 63 00:03:17,940 --> 00:03:27,000 keep it like that and let me add another key and pair here. Let's say cities. Let's say 65 00:03:27,000 --> 00:03:42,750 Joe Smith lives in three cities, Porto and San Diego and Bali. You close 67 00:03:42,750 --> 00:03:49,769 bracket there so as you see we have the key here, we have a column and then you 69 00:03:49,769 --> 00:03:54,030 have the value which can be anything so it can be string, it can be a number, it 71 00:03:54,030 --> 00:04:01,100 can be at list, a tuple. In this case that's a tuple so if you access now 73 00:04:01,100 --> 00:04:10,070 cities like that, you'd getโ€ฆ Sorry, I'll add two bracket there, so you'd get the tuple. 75 00:04:10,070 --> 00:04:15,959 And then you can also do tricks like you know if you want to access Bali you'd 77 00:04:15,959 --> 00:04:23,789 have other brackets there and pass 2. And that would return Bali, so why is that? 79 00:04:23,789 --> 00:04:27,710 That's because you know up to here you have a tuple, 81 00:04:27,710 --> 00:04:35,849 but that's a triple object and then from that tuple you use again the 83 00:04:35,849 --> 00:04:40,560 square brackets notation to access an item from that tuple, so you want item 85 00:04:40,560 --> 00:04:47,759 with index two and that is Bali and yeah that's about dictionaries. Try them out 87 00:04:47,759 --> 00:04:55,110 some more, play around and you will be able to comfortably create and access items 89 00:04:55,110 --> 00:05:01,099 from a dictionary. So I hope you enjoyed this and talk to you later. 5486

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