All language subtitles for 013 Filtering Lists_en

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
sm Samoan
gd Scots Gaelic
sr Serbian
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

In the last section, we started talking about how we're going to use the built in function where that

belongs to every single list that we create to automatically walk through a list of cards and return

every card with some given suit.

So I'm going to flip back over to Dart Pad and we're going to start our implementation inside of the

cards with suit method that we added.

So inside of here, I'm going to reference the cards property that exists inside of every deck we create

and then on this cards list right here, I'm going to call the where method.

We're going to just write out the entire implementation of this method right here, and we'll talk a

little bit about how it works.

So inside of here, I'm going to place another set of parentheses and then I'll write out the word card.

Then outside those parentheses, I'll add a set of curly braces.

And then inside of there, I'll put return card, dot suit equals equals suit like so.

OK, so let's talk about what just happened here when we call cardstock, where we have to pass in a

function.

So that's what this is right here.

We defined a function without a name and we passed it in to the aware method.

The weird method then takes this function and it runs that function one time for every element within

the cards list.

So every single card within the cards list is taken and it's passed to this function as the first argument.

Then inside that function, you and I have to write some amount of logic that returns a boolean, if

we return a boolean value of true, then that value is retained.

Otherwise, if it if we return false, then it assumes that, no, we don't care about this element.

So we are looking for every card within our cards list that has some given suit.

So we looked at the card dot suit property and we said if this thing is equal to the string suit that

was passed in to our method here, then we want to keep that card around.

OK, so that's how this we're method right here works.

Now, the last thing we'll do is make sure that whatever gets returned from Card Square gets returned

from our cards with function as well.

And so to do so, we'll just add on the key word return right before it's.

OK, so let's now try testing this out inside of our main function, so I'll scroll up to the top and

let's take out our let's see the shuffle in.

What the heck?

And we'll print out the result of Dec dot cards with suit.

And notice how we now get this nice autocomplete here with a function that you and I added.

So we'll call this thing and I'm going to try to get every card with a suit of diamonds.

All right, so now I will run this code and we'll see what happens.

OK, just going to give it a minute, let's try it one more time here.

There we go, much better.

So I now get four of diamonds, five to three and Ace, so clearly we went through that list and we

pulled out every card with some given suit.

Now, one thing I want to point out here is that rather than the square brackets we had before, we

now have a set of parentheses.

So if you go back over to the documentation for that weird method, you'll notice that it says that

it returns a new lazy iterable.

So an iterable is something that is like a list, but not quite a list.

We're not going to make a big distinction between the two just yet, but this is a topic that will come

back to later in the course for right now.

I really just wanted to show you how to make use of the standard library and how to use some of the

built-In methods that exist on lists already.

OK, so it looks good, so let's take a quick pause right here and we'll come back in the next section.

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