All language subtitles for 2. More Operations with Lists

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian Download
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 0 1 00:00:00,480 --> 00:00:06,810 Let me now make you a bit more familiar with the list data types by showing you what you can do with 1 2 00:00:06,810 --> 00:00:07,080 them. 2 3 00:00:07,740 --> 00:00:10,380 And you know that already that what you can do with them. 3 4 00:00:10,380 --> 00:00:14,020 You can check with dir lists. 4 5 00:00:14,220 --> 00:00:15,830 You can ignore the attributes 5 6 00:00:15,830 --> 00:00:20,120 that start with double underscore and ends with double underscore. 6 7 00:00:20,160 --> 00:00:24,910 They are basically attributes used by Python internally and rarely 7 8 00:00:24,960 --> 00:00:26,510 you're going to have to use them. 8 9 00:00:26,520 --> 00:00:33,480 So for now you can just ignore them and focus on what you're going to actually use which is this set 9 10 00:00:33,870 --> 00:00:35,380 in here. 10 11 00:00:35,610 --> 00:00:44,400 Let me open another python shell and I'm going to apply some operations to that's the list in this 11 12 00:00:44,400 --> 00:00:49,830 Python shell so we can see what methods we can apply in this window and we can apply the methods in 12 13 00:00:49,830 --> 00:00:50,920 this other one here. 13 14 00:00:51,060 --> 00:00:55,650 And I don't just want to show you what this does in the dark. 14 15 00:00:55,680 --> 00:01:00,650 I want to show you the way you can find out yourself what these things do. 15 16 00:01:00,660 --> 00:01:06,130 So always use the help function. 16 17 00:01:06,470 --> 00:01:10,100 List, let's try the append method. 17 18 00:01:10,100 --> 00:01:15,350 Now I'm going to type the variable, but you don't have to type all of it. 18 19 00:01:15,650 --> 00:01:21,770 Once you have started to type that variable name you can use Tab and that will auto complete the variable 19 20 00:01:21,770 --> 00:01:30,770 name, then use the dot notation and append and then two parentheses so inside the parentheses you'll 20 21 00:01:30,770 --> 00:01:34,940 see that this takes two arguments. 21 22 00:01:34,940 --> 00:01:37,690 Actually it's only one argument. 22 23 00:01:37,940 --> 00:01:48,050 It's only the object itself, self is referring to the list itself and object is actually what you want 23 24 00:01:48,050 --> 00:01:49,590 to append to that list. 24 25 00:01:50,180 --> 00:02:02,800 Let's say you want to append 8.1 like that. If you check Monday temperatures you'll see that 25 26 00:02:02,830 --> 00:02:04,840 it's now has one more item. 26 27 00:02:05,320 --> 00:02:08,360 So that is the syntax of append. 27 28 00:02:08,590 --> 00:02:15,940 You always ignore self because self is automatically passed as an argument to that method and self 28 29 00:02:15,940 --> 00:02:20,300 is basically the actual list itself. 29 30 00:02:20,320 --> 00:02:27,820 Let's try another method. Q here to quit, help list clear. 30 31 00:02:27,820 --> 00:02:29,630 How does it work? 31 32 00:02:29,680 --> 00:02:33,880 Well, in this case you see that it doesn't get any arguments. 32 33 00:02:33,880 --> 00:02:35,800 So Monday_temperatures 33 34 00:02:35,830 --> 00:02:37,710 dot clear. 34 35 00:02:38,320 --> 00:02:40,200 Just like that. 35 36 00:02:40,630 --> 00:02:50,410 And what it does it just clears the list it deletes all of its items. 36 37 00:02:50,520 --> 00:02:54,770 Let me also try index and leave the rest for you to try. 37 38 00:02:59,180 --> 00:03:08,990 So index gets actually a value, a start, and stop and it returns to the index of the value. 38 39 00:03:09,180 --> 00:03:12,550 So what is an index? 39 40 00:03:12,840 --> 00:03:22,600 Let's try it out. Dot index the value, with value what Python means is one of the values of the list. 40 41 00:03:22,710 --> 00:03:32,330 Now since we have a list without values I'm going to recreate the list again like that. 41 42 00:03:33,070 --> 00:03:34,400 So now this is our list. 42 43 00:03:38,620 --> 00:03:45,990 And lets me try index with parenthesis, and the value let's say 8.8. 43 44 00:03:48,990 --> 00:03:50,690 Oh will return 1. 44 45 00:03:50,740 --> 00:03:51,460 Why? 45 46 00:03:51,460 --> 00:03:59,950 That's because lists have indexing on the background. Even though we don't see it, each of these items 46 47 00:04:00,360 --> 00:04:02,080 is associated with an index. 47 48 00:04:02,080 --> 00:04:04,440 The first one has an index of zero. 48 49 00:04:04,450 --> 00:04:12,240 The second has an index of one, and the last has an index of 2 in this case and so on. 49 50 00:04:12,250 --> 00:04:19,270 Now in this particular case we also see this argument and this other one for the index method. 50 51 00:04:19,270 --> 00:04:25,410 However if you don't want to pass those values you can just pass one value. 51 52 00:04:25,420 --> 00:04:27,550 So like I did here 8.8. 52 53 00:04:27,550 --> 00:04:32,040 That means 8.8 would be the value of this. 53 54 00:04:32,250 --> 00:04:35,300 And by default start will be equal to zero. 54 55 00:04:35,390 --> 00:04:37,170 A stop will be equal to this value. 55 56 00:04:37,240 --> 00:04:44,760 So what is start and stop? Well, when it's 0 like it is by default that means you are looking 56 57 00:04:44,820 --> 00:04:45,510 for 8.8. 57 58 00:04:45,850 --> 00:04:49,590 Starting from the first item of the list. 58 59 00:04:49,750 --> 00:04:58,030 So the interpreter will start the search from the first item, so the item with index 0 and will look for 59 60 00:04:58,060 --> 00:04:59,470 8.8. 60 61 00:04:59,770 --> 00:05:04,490 And it will find it and it will tell you that it has an index of 1. 61 62 00:05:04,500 --> 00:05:13,750 However, if you want to tell Python to start from the item with index 2 let's say so to start the search 62 63 00:05:13,750 --> 00:05:21,520 from here and forward, so to the right of seven point five which happens to not have any more items but 63 64 00:05:21,610 --> 00:05:25,730 anyway so you are skipping this part of the list. 64 65 00:05:25,810 --> 00:05:32,860 In this case the interpreter will tell you that 8.8 is not in the list with that start 65 66 00:05:33,130 --> 00:05:37,150 and you also have the stop which is by default tis big number. 66 67 00:05:37,180 --> 00:05:44,140 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 68 00:05:44,140 --> 00:05:46,470 going to keep that zero. 68 69 00:05:46,630 --> 00:05:52,580 And that will tell you that the number has that index. More about indexing in the next video. 6839

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