All language subtitles for 6. Accessing List Items

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 Download
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
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: 0 1 00:00:01,140 --> 00:00:08,400 Previously I showed you that in order to get the index off an item you can use the index method. 1 2 00:00:08,430 --> 00:00:10,350 Now how can we do the reverse? 2 3 00:00:10,350 --> 00:00:15,180 How can we get an item given its index? 3 4 00:00:15,380 --> 00:00:21,590 Well for that we need to look one more time at the least of attributes that you can apply to the 4 5 00:00:21,590 --> 00:00:22,400 list. 5 6 00:00:22,670 --> 00:00:29,080 And I know that we can use the __getitem___ method. 6 7 00:00:29,170 --> 00:00:29,430 Okay. 7 8 00:00:29,450 --> 00:00:36,710 I know I told you earlier that these methods rarely you're going to use and in fact we don't need 8 9 00:00:36,770 --> 00:00:44,390 these methods for what I'm going to do now, but let me explain why in just a bit you'll understand, 9 10 00:00:44,390 --> 00:00:46,850 and this is a very secret of Python. 10 11 00:00:47,540 --> 00:00:55,710 So let me go ahead and use __getitem__ with double underscores. 11 12 00:00:55,880 --> 00:01:01,640 And of course it's a method so it needs this round brackets parentheses. 12 13 00:01:01,760 --> 00:01:10,620 So let's try to get the item with index 1. Which would that be? Well, 8.8. 13 14 00:01:10,620 --> 00:01:16,830 Not the secret is that you don't have to use that ugly method there. 14 15 00:01:17,300 --> 00:01:22,940 With those double underscores, all you have to do is use this syntax. 15 16 00:01:22,940 --> 00:01:26,600 So call the variable name like that. 16 17 00:01:27,110 --> 00:01:32,280 And then add open and closing square brackets and then inside them just enter the index. 17 18 00:01:32,610 --> 00:01:40,450 And that will give you the value, the item for that index again even though you're doing this, Python 18 19 00:01:40,480 --> 00:01:49,400 on the background actually is calling this method and is passing this item, this value as an input for 19 20 00:01:49,400 --> 00:01:51,210 that methods. 20 21 00:01:51,230 --> 00:01:58,070 So this is actually what's going on on the ground but Python lets you do it in a better fashion. 21 22 00:01:58,300 --> 00:01:59,330 Like this in here. 2281

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