All language subtitles for 36. Dictionary Keys

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
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

Welcome back.

I mentioned to you that a dictionaries of values can hold any sort of data type.

But what about the keys.

Up until now I've only used strings to denote a key but could I do something like this could I do one

two three like this.

Well let's have a look.

Let's give it a try.

If I do one two three and I click Run I get one two three.

Awesome.

That works.

What about what about true.

If I select if I have a key true and I click Run will that work yeah.

It looks like it works.

What about a list.

What if I have a list of let's say just a hundred.

Would that work if I click Run Nope.

It doesn't work.

It says on hash table type list.

What does that mean.

Dictionary keys need to have a special property a key needs to be immutable.

That is a key cannot change and numbers billions.

I mean this is a value that cannot change a string.

If you remember is a value that cannot change it's immutable but a list.

If you remember can be changed right on a list.

I can reassign let's say the index of zero to something else.

Right.

So because of that a dictionary says Hey my keys because I'm storing them in memory and I don't want

to lose them.

It has to be something that isn't going to change on me.

Maybe a programmer comes in and by mistake changes this array of 100 to have an index of something else.

Well dictionary doesn't really want that because it doesn't want to lose this value.

So a dictionary key always has to be immutable.

And as we learn a few other things like a couple that we'll see in upcoming videos you can use those

as keys as well.

However most of the time ninety five ninety nine percent of the time a key for a dictionary is usually

something descriptive like a string okay.

But what about this.

What if we have a nother string.

One two three.

And let's just remove this for now what happens when I search for one two three the string.

If I click Run I get.

Hello a key in a dictionary has to be unique because there can only be one key because that key is going

to represent a bookshelf in that memory space.

So anytime I do the same key and maybe add a value it's going to overwrite.

So this no longer exists.

A key has to be unique and it's something that can only exist.

Well just once.

Otherwise we overwrite it which is why you see hello here.

We've lost the array.

One two three let's explore this idea a little bit more in the next video.

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