All language subtitles for 2. More Operations with Lists

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 Let me now make you a bit more familiar with the list data types by showing you what you can do with 1

them. 2

And you know that already that what you can do with them. 3

You can check with dir lists. 4

You can ignore the attributes 5

that start with double underscore and ends with double underscore. 6

They are basically attributes used by Python internally and rarely 7

you're going to have to use them. 8

So for now you can just ignore them and focus on what you're going to actually use which is this set 9

in here. 10

Let me open another python shell and I'm going to apply some operations to that's the list in this 11

Python shell so we can see what methods we can apply in this window and we can apply the methods in 12

this other one here. 13

And I don't just want to show you what this does in the dark. 14

I want to show you the way you can find out yourself what these things do. 15

So always use the help function. 16

List, let's try the append method. 17

Now I'm going to type the variable, but you don't have to type all of it. 18

Once you have started to type that variable name you can use Tab and that will auto complete the variable 19

name, then use the dot notation and append and then two parentheses so inside the parentheses you'll 20

see that this takes two arguments. 21

Actually it's only one argument. 22

It's only the object itself, self is referring to the list itself and object is actually what you want 23

to append to that list. 24

Let's say you want to append 8.1 like that. If you check Monday temperatures you'll see that 25

it's now has one more item. 26

So that is the syntax of append. 27

You always ignore self because self is automatically passed as an argument to that method and self 28

is basically the actual list itself. 29

Let's try another method. Q here to quit, help list clear. 30

How does it work? 31

Well, in this case you see that it doesn't get any arguments. 32

So Monday_temperatures 33

dot clear. 34

Just like that. 35

And what it does it just clears the list it deletes all of its items. 36

Let me also try index and leave the rest for you to try. 37

So index gets actually a value, a start, and stop and it returns to the index of the value. 38

So what is an index? 39

Let's try it out. Dot index the value, with value what Python means is one of the values of the list. 40

Now since we have a list without values I'm going to recreate the list again like that. 41

So now this is our list. 42

And lets me try index with parenthesis, and the value let's say 8.8. 43

Oh will return 1. 44

Why? 45

That's because lists have indexing on the background. Even though we don't see it, each of these items 46

is associated with an index. 47

The first one has an index of zero. 48

The second has an index of one, and the last has an index of 2 in this case and so on. 49

Now in this particular case we also see this argument and this other one for the index method. 50

However if you don't want to pass those values you can just pass one value. 51

So like I did here 8.8. 52

That means 8.8 would be the value of this. 53

And by default start will be equal to zero. 54

A stop will be equal to this value. 55

So what is start and stop? Well, when it's 0 like it is by default that means you are looking 56

for 8.8. 57

Starting from the first item of the list. 58

So the interpreter will start the search from the first item, so the item with index 0 and will look for 59

8.8. 60

And it will find it and it will tell you that it has an index of 1. 61

However, if you want to tell Python to start from the item with index 2 let's say so to start the search 62

from here and forward, so to the right of seven point five which happens to not have any more items but 63

anyway so you are skipping this part of the list. 64

In this case the interpreter will tell you that 8.8 is not in the list with that start 65

and you also have the stop which is by default tis big number. 66

So if you want to limit the search on the index on the right you can do that too but by default you're 67

going to keep that zero. 68

And that will tell you that the number has that index. More about indexing in the next video.

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