Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
0 Previously I showed you that in order to get the index off an item you can use the index method. 1
Now how can we do the reverse? 2
How can we get an item given its index? 3
Well for that we need to look one more time at the least of attributes that you can apply to the 4
list. 5
And I know that we can use the __getitem___ method. 6
Okay. 7
I know I told you earlier that these methods rarely you're going to use and in fact we don't need 8
these methods for what I'm going to do now, but let me explain why in just a bit you'll understand, 9
and this is a very secret of Python. 10
So let me go ahead and use __getitem__ with double underscores. 11
And of course it's a method so it needs this round brackets parentheses. 12
So let's try to get the item with index 1. Which would that be? Well, 8.8. 13
Not the secret is that you don't have to use that ugly method there. 14
With those double underscores, all you have to do is use this syntax. 15
So call the variable name like that. 16
And then add open and closing square brackets and then inside them just enter the index. 17
And that will give you the value, the item for that index again even though you're doing this, Python 18
on the background actually is calling this method and is passing this item, this value as an input for 19
that methods. 20
So this is actually what's going on on the ground but Python lets you do it in a better fashion. 21
Like this in here.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.