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