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
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
All right.
It feels like it's never going to end.
We have so many methods with less but like I said lists have a lot of methods because you can do a lot
with them.
It seems like a lot right now but trust me these are going to become second nature.
So hang in there.
I have a few more to show you the next one is called sort guess what sort is going to do if I click
Run I get none.
But remember sort sorts the list as you can imagine in place that means and modifies the list.
So if I remove this up to here and then do a sort or do basket and I click Run look at that I get a
sorted list where a D was moved in front of me.
If I add let's say x at the beginning here and I click run it's going to move the X all the way to the
end.
It's going to sort the list in place for me again if I hover over it sees that it's going to not return
anything which is why our print initially didn't work we had to print our basket not whatever this produces
which doesn't produce anything.
But what about this one if we go to built in functions I have something called sorted and if I do sorted
and because it's a function not a method I can do sorted dot or basket.
So around the brackets is just like print if I run this.
All right.
Nothing has changed but what if I remove this and put it in here if I click Run I get a b c d d e x.
What if I comment this out so that we're not sorting it anymore we just have the basket and then we
run this sorted function.
If I run did you see that sorted.
I know it's confusing why do they even have to but sorted produces a new array so if I do print basket
here and I click Run the basket hasn't been modified the basket still remains the same.
It's this one over here that's not sorted sorted.
On the other hand doesn't modify the basket in place.
Instead it creates a new copy of the basket and sorts it.
It's almost as if we're doing this.
We're saying new basket equals basket and then we're going to copy that basket.
Remember list slicing and then we're performing new basket dot sort on this new list so that if I do
new basket and I click Run we get the same thing so you have to be careful of certain actions that perform
an action in place or create a completely new list to begin with.
By the way there's also instead of this a dot copy method that we can use and if I run this again we
get the same thing copy just as the name suggests copy the list for us and returns for us a new list.
All right.
One last one and that is basket dot reverse.
What do you think this does.
Based on the name well if I check out the basket here and click Run is that what you expected.
It reverses the basket in place but notice that it's not like sort it's not sorting it's simply switching
all the indexes into opposite sides.
So D is now index of 0 E is now index of one index of 2 3.
So on and so forth.
So you can see here that it doesn't actually sort it.
Instead while we might want to do is sort first then reverse and if we click Run we have a sorted reversed
basket.
This is a little tricky one that some interviewers might ask.
All right.
Good job getting this far.
We're almost done with lists.
So I'll see you in the next video by.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.