All language subtitles for 11. Accessing Items and Slices with Negative Indexes

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,300 --> 00:00:05,310 So how do we get the last item of this list? 1 2 00:00:05,310 --> 00:00:12,240 Well, you can do that by referring to the list and then square brackets, and then refer to the index of the 2 3 00:00:12,240 --> 00:00:13,440 item you want. 3 4 00:00:13,440 --> 00:00:18,650 So 9.9 has an index of 0, 1, 2, 3, 4. 4. 4 5 00:00:19,110 --> 00:00:28,780 OK, but a smarter way is to use negative indexing which means instead of counting you can just write 5 6 00:00:28,870 --> 00:00:31,370 minus one and you get 9.9. 6 7 00:00:31,530 --> 00:00:37,770 So each of the items of a Python list has two indexes, a negative and positive index. 7 8 00:00:37,770 --> 00:00:46,680 So minus one for this, minus two for that, minus three, months four, minus five, so minus five is the first 8 9 00:00:46,680 --> 00:00:49,800 item actually 9.1. 9 10 00:00:49,860 --> 00:00:57,150 And of course you can to list slicing using negative indexing. 10 11 00:00:57,150 --> 00:01:02,430 Let's try to get the last two items, so to do this slicing 11 12 00:01:02,430 --> 00:01:06,990 you have to put the index or the first item of the slice 12 13 00:01:07,410 --> 00:01:16,250 so the first item of the slice is 6.6, and 6.6 has a negative index of 2, use a colon. 13 14 00:01:16,420 --> 00:01:23,280 Then you don't want to assign anything here because you want everything that comes after 6.6. 14 15 00:01:23,280 --> 00:01:27,390 So just like that and you get that tail of the list. 15 16 00:01:27,840 --> 00:01:35,880 So similarly you can do minus four minus two for example, that will give you 8.8. 16 17 00:01:35,880 --> 00:01:44,910 Minus four, minus three, and minus two is not included in the slices because I told you that to the upper limit 17 18 00:01:44,910 --> 00:01:47,450 is never included in the slice. 18 19 00:01:49,110 --> 00:01:56,250 So you only get this and that. You can also start from the beginning of the list to get 9.1. 19 20 00:01:56,370 --> 00:01:58,320 The first item like that. 2128

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