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
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

Original subtitles

0 I have a list of five items here. 1

Let me show you why. Use the len function and you see that it has, it really has five items. 2

Now besides accessing single items out of your list like that item with index 3. 0, 1, 2, 3, so 6.6, 3

you can also access portions of the list. 4

Let's say from 1 to 4 and that will give you another list. 5

So the outputs of this is also a list and it's going to contain the items with index 1, index 2 and 6

index 3, the upper limit 7

it's not included, it's never included in a python slice. 8

So this is a slice. 9

And this is the output of the slice. 10

Let's try to get the first two items of the list. The first two items have an index of zero and one. 11

So we'll start with 0 since we also want the item with index 1 12

we are going to write 2 there, so that we get 1and that is the output. 13

So the index 2 is not included, 7.5 is not included. 14

You can also use a shortcut for that. 15

You don't have to type 0 16

if you meant to get everything starting from the first item and that will give you the same output. 17

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

from 3 and this has an index of 4. 19

So we are going to write 5 there. Even though we got the expected output. 20

You'd better be using the shortcut for that. 21

So this is more intuitive because it tells you that you're extracting from item with index 3 to the 22

last item of the list. 23

So without knowing how many items there are in the list. Similar here you extracting from the very first 24

item to the item with index 1, now for big lists 25

when you want to extract the last items, it may make not much sense to count from the beginning. 26

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.

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