All language subtitles for 41. Sets

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
bg Bulgarian
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
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

Can you believe it.

I hope I didn't put you to sleep but we're almost there.

We have one last main data type set and then we're done.

I know I know this isn't the most exciting topic.

Trust me this is the hardest part when you're starting out and you're just learning these things without

understanding.

Why do I need this.

How am I going to build the next game How am I going to build the next Netflix how we're going to build

the next coolest Apple app.

You're looking at this and thinking I just learned a bunch of theory I feel like I'm in math class all

over again.

I know trust me.

I went through this.

I was a self-taught programmer as well.

These are the Lego blocks that builds our foundation.

Once we learn these we can move on to new things and you'll see that once you climb this little mountain

things become so much easier and you'll realize the power.

When we start building these projects toward the end of the class where you're going to say oh all these

blocks that we learned all this frankly boring part is all going to make sense.

So hang in there.

It's supposed to be hard.

It's supposed to be tough but you'll see very soon why this is so powerful and why what we've just learned

is going to allow us to build some really awesome things and create some really awesome programs.

So let's finish off with the last one.

The last data type the last data structure that we'll see in Python at least from the main ones and

it's called set and sets are simply on ordered collections of unique objects.

Let's have a look.

Let's create a my set and my set.

We create with curly brackets like a dictionary.

But instead of a dictionary we don't have key value pairs.

Instead we just have values like One two three four or five.

That's it.

That's a set we just created a set.

But remember the definition I gave you set is an unordered collection of unique objects.

What does that mean.

Well if I print this and say my set and I click Run I get a set but if I had let's say another five

in here and I click Run it only returns the unique sets or unique items you see in a set.

There's no duplicates.

Everything has to be unique so this fire just never gets added to a set.

For example you can add things to a set like my set and then I can say dot add and give it a value like

100 and then let's say I do my set dot add and then give it to if I click Run here I see that I was

able to add a hundred but two well to wasn't really added because my set already contained that data.

It's on ordered.

I mean we've created one two three four five here but there's no real order to it.

There's no bookshelf in our memory space.

That is right next to each other.

These are all over the place in memory but a set is able to find them because they're all unique.

So they're all in just one location in memory so let me ask you this and this is going to be a fun little

exercise if I gave you an array and let's say this array contained.

Well this right here and I want you to return an array with no duplicates.

So I want everything in let's say let's call it my list and a programmer has already created this OK

and then your task is to create or return a list or a collection that has only unique items.

How would you go about converting this into a set.

Well we've seen this before.

We have a set function and we simply wrap my list in that set and that's printed out i click Run.

Check it out.

We have formed a new set from a list and I've removed all duplicate values.

When would this be useful.

Imagine if we had user names right.

Or email addresses where collecting email addresses on our startup page.

But we don't want to have duplicate emails.

We might want to convert this a list of emails to a set and remove any duplicates so we're not sending

emails over and over.

So that's really cool.

What about this.

Can I.

Let's change this into a set.

So let's call it my set going to change this into a set.

There you go.

And then what if I wanted to access my set at index of 0 set.

Object does not support indexing.

Well again you can think of it more as a dictionary in order to access a set.

We have to grab by the item that's in it.

That's the key to getting the information from memory.

The way we would check if something exists is we simply say hey is one in my set.

And we run this and we get true we can also do length of my set and we get 5 again.

Nothing too crazy but one two three four five.

Remember it only counts the unique things because this will never gets entered.

It's a set and alternatively we can also convert this into a list.

If I click Run here you'll see that I now have my set as a list and then we can also do let's say my

set dot copy and actually copy my set into something let's say new or new set and then this will be

completely different or a new copy then this original one.

So let's test the set this new set if I use a method that we may have seen before which is my set dot

clear which as you can imagine clears the set and I click Run I have that new set but when I try and

print are all set which was my set it's going to be empty an empty set but the true power of sets comes

in the next couple methods that I'm going to show you and sets have quite a few methods but don't worry

most of them are quite similar.

So let's explore that in the next video.

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