Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
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 (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
1
Great, now let's look at lists, so in the
previous lecture we were looking at
3
strings and indexing and splitting
strings and I will be working with lists
5
which are very similar to strings. They
are similar because they are both
7
referred to as sequences, so there are
sequences of items. The difference is
9
that, let me open Python, and so the
difference is that the string is made of
11
other strings so it can contain only
strings of characters or strings.
13
whatever you like to call it, however
lists can contain various other data
15
types, let's say H a letter, a number, and
also a string. So this is a string the
17
first one, this is a number, an integer.
This is also string with multiple
19
characters and that is a list, so for
this you want to use square brackets to
21
create a list. Execute and yeah you can
call it and so this is a list of three
23
items and you can also store other
objects in a list but we'll cover other
25
objects in later sections, you know we
have table of objects with lots of data.
27
You may store files in a list you may
store widgets of a graphical user
29
interface that you are building and so
on, so these are very useful and lists also
31
have indexing and you can split lists,
you can extract items and so on. So the
33
good news is that lists have the
same indexing system as strings and so
35
you've learned that in the previous
lecture and you can go ahead and apply
37
that system not, so let's extract number 2.
That would have an index of one.
39
Execute that and yeah you get 2 there. If you
check the type you'll see that's an integer.
41
So every item of a list has its own
data type, even also access more than
43
white one item of a list. Let's say
you want the first two items. You do 0 1 2, so
45
like that or 0 to 2 whatever you like.
That will produce another list so the
47
type of this split is a list. The type of
the split of a string is a string, so S
49
for the string here, C for the list.
Lists now have methods associated with
51
them just like strings do and so you can
check what methods you have available
53
there by just doing a dir list.
So this a the blueprint you can use
55
lists, you can pass empty square brackets
in there, it's the same thing and then
57
you can use help to look at each of
these methods, so these are the methods.
59
Without the underscore and let's look at
the append method, so to apply methode
61
you do c the dot notation append and here
on that 3. What that does, it adds
63
another item to the end of the list,
So it appends an item to the
65
list and you can explore the other
methods if you like so let's say help.
67
Remove like that and you'll see how to
use that remove method, so you do
69
c.remove and then you pass the value of
the item that you want to remove, so
71
not the index but the value. Let's say we
want to remove 2 and you see that 2
73
is now gone from the list so look
at the other methods of the list and try
75
to experiment with this and play around
with them access items and split them
77
and you'll be good to go then.
Thanks, I'll talk to you later.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.