All language subtitles for 17. Accessing Items in Dictionaries

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian Download
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 0 1 00:00:00,660 --> 00:00:06,020 Do dictionaries have the same index system as lists and strings? 1 2 00:00:06,050 --> 00:00:07,380 Let's find that out. 2 3 00:00:07,380 --> 00:00:10,770 I have this dictionary here on my Python Shell. 3 4 00:00:11,190 --> 00:00:12,080 Student grades. 4 5 00:00:12,090 --> 00:00:17,650 So let's try to get the second item maybe. 5 6 00:00:18,670 --> 00:00:29,740 Nope, it's says KeyError: 1 which means that the dictionary doesn't have a key named 1. 6 7 00:00:29,820 --> 00:00:32,730 So what keys does the dictionary have? 7 8 00:00:32,800 --> 00:00:35,290 Maybe the "Sim" key. 8 9 00:00:35,910 --> 00:00:41,910 Yes, so dictionaries instead of integers they have keys as indexes. 9 10 00:00:41,910 --> 00:00:48,750 So a least would be access, the items of the list would be accessed via integers which start from 10 11 00:00:48,750 --> 00:00:49,940 zero. 11 12 00:00:49,940 --> 00:00:56,190 An end to the last item of the list, the index of the last item of the list. With dictionaries 12 13 00:00:56,190 --> 00:01:01,410 this is different as you can see and this is actually what makes dictionaries a dictionary. 13 14 00:01:01,440 --> 00:01:04,080 Let's see another example of how useful this is. 14 15 00:01:04,080 --> 00:01:11,100 Let's say you have this dictionary English the Portuguese. It's a real human dictionary. 15 16 00:01:11,100 --> 00:01:13,690 You have some words there. 16 17 00:01:14,150 --> 00:01:23,240 Let's say "rain", "chuva" in Portuguese and "sun" will be "sol." 17 18 00:01:24,220 --> 00:01:28,710 Sorry I've got a typo there, quote. 18 19 00:01:29,490 --> 00:01:37,250 So now if you want the Portuguese version of sun, you write that and that will give you that version. 19 20 00:01:37,530 --> 00:01:42,060 So having integers s indexes in this case would be very useless. 20 21 00:01:42,060 --> 00:01:48,420 So every use case has its own data structure to be used in Python. 2062

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