All language subtitles for 10. Accessing List Slices

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,710 --> 00:00:05,050 I have a list of five items here. 1 2 00:00:05,250 --> 00:00:11,520 Let me show you why. Use the len function and you see that it has, it really has five items. 2 3 00:00:13,870 --> 00:00:25,360 Now besides accessing single items out of your list like that item with index 3. 0, 1, 2, 3, so 6.6, 3 4 00:00:25,360 --> 00:00:31,540 you can also access portions of the list. 4 5 00:00:31,540 --> 00:00:39,830 Let's say from 1 to 4 and that will give you another list. 5 6 00:00:39,850 --> 00:00:48,910 So the outputs of this is also a list and it's going to contain the items with index 1, index 2 and 6 7 00:00:48,910 --> 00:00:53,230 index 3, the upper limit 7 8 00:00:53,360 --> 00:00:57,770 it's not included, it's never included in a python slice. 8 9 00:00:57,830 --> 00:00:59,230 So this is a slice. 9 10 00:00:59,930 --> 00:01:01,790 And this is the output of the slice. 10 11 00:01:01,790 --> 00:01:09,540 Let's try to get the first two items of the list. The first two items have an index of zero and one. 11 12 00:01:09,710 --> 00:01:14,560 So we'll start with 0 since we also want the item with index 1 12 13 00:01:14,560 --> 00:01:21,650 we are going to write 2 there, so that we get 1and that is the output. 13 14 00:01:22,070 --> 00:01:27,740 So the index 2 is not included, 7.5 is not included. 14 15 00:01:27,920 --> 00:01:30,380 You can also use a shortcut for that. 15 16 00:01:30,470 --> 00:01:31,950 You don't have to type 0 16 17 00:01:31,970 --> 00:01:39,670 if you meant to get everything starting from the first item and that will give you the same output. 17 18 00:01:39,680 --> 00:01:52,700 Similarly, if you want to get let's say the last two items you can start to count 0, 1, 2, 3, so 3 start 18 19 00:01:52,700 --> 00:01:56,490 from 3 and this has an index of 4. 19 20 00:01:56,660 --> 00:02:03,470 So we are going to write 5 there. Even though we got the expected output. 20 21 00:02:03,740 --> 00:02:08,630 You'd better be using the shortcut for that. 21 22 00:02:08,810 --> 00:02:16,910 So this is more intuitive because it tells you that you're extracting from item with index 3 to the 22 23 00:02:16,910 --> 00:02:18,040 last item of the list. 23 24 00:02:18,320 --> 00:02:24,980 So without knowing how many items there are in the list. Similar here you extracting from the very first 24 25 00:02:24,980 --> 00:02:29,080 item to the item with index 1, now for big lists 25 26 00:02:29,090 --> 00:02:36,500 when you want to extract the last items, it may make not much sense to count from the beginning. 26 27 00:02:36,510 --> 00:02:45,350 1, 2, 3, 4, 5, 6 and so on but Python has another system of indexing and I'll show you that in the next video. 2881

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