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
ru Russian Download
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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,890 --> 00:00:05,360 In the last section, we started talking about how we're going to use the built in function where that 2 00:00:05,360 --> 00:00:10,250 belongs to every single list that we create to automatically walk through a list of cards and return 3 00:00:10,250 --> 00:00:11,990 every card with some given suit. 4 00:00:12,720 --> 00:00:16,490 So I'm going to flip back over to Dart Pad and we're going to start our implementation inside of the 5 00:00:16,490 --> 00:00:18,770 cards with suit method that we added. 6 00:00:19,700 --> 00:00:25,040 So inside of here, I'm going to reference the cards property that exists inside of every deck we create 7 00:00:25,670 --> 00:00:30,800 and then on this cards list right here, I'm going to call the where method. 8 00:00:32,090 --> 00:00:36,410 We're going to just write out the entire implementation of this method right here, and we'll talk a 9 00:00:36,410 --> 00:00:37,820 little bit about how it works. 10 00:00:38,600 --> 00:00:43,790 So inside of here, I'm going to place another set of parentheses and then I'll write out the word card. 11 00:00:44,600 --> 00:00:47,870 Then outside those parentheses, I'll add a set of curly braces. 12 00:00:49,360 --> 00:00:56,650 And then inside of there, I'll put return card, dot suit equals equals suit like so. 13 00:00:57,750 --> 00:01:03,840 OK, so let's talk about what just happened here when we call cardstock, where we have to pass in a 14 00:01:03,840 --> 00:01:04,550 function. 15 00:01:04,890 --> 00:01:06,210 So that's what this is right here. 16 00:01:06,210 --> 00:01:10,830 We defined a function without a name and we passed it in to the aware method. 17 00:01:11,580 --> 00:01:18,720 The weird method then takes this function and it runs that function one time for every element within 18 00:01:18,720 --> 00:01:19,980 the cards list. 19 00:01:21,140 --> 00:01:26,780 So every single card within the cards list is taken and it's passed to this function as the first argument. 20 00:01:27,780 --> 00:01:33,870 Then inside that function, you and I have to write some amount of logic that returns a boolean, if 21 00:01:33,870 --> 00:01:37,980 we return a boolean value of true, then that value is retained. 22 00:01:38,340 --> 00:01:43,550 Otherwise, if it if we return false, then it assumes that, no, we don't care about this element. 23 00:01:44,340 --> 00:01:49,320 So we are looking for every card within our cards list that has some given suit. 24 00:01:49,940 --> 00:01:56,400 So we looked at the card dot suit property and we said if this thing is equal to the string suit that 25 00:01:56,400 --> 00:02:00,870 was passed in to our method here, then we want to keep that card around. 26 00:02:02,050 --> 00:02:04,490 OK, so that's how this we're method right here works. 27 00:02:04,690 --> 00:02:10,180 Now, the last thing we'll do is make sure that whatever gets returned from Card Square gets returned 28 00:02:10,180 --> 00:02:12,290 from our cards with function as well. 29 00:02:12,310 --> 00:02:16,180 And so to do so, we'll just add on the key word return right before it's. 30 00:02:18,110 --> 00:02:24,200 OK, so let's now try testing this out inside of our main function, so I'll scroll up to the top and 31 00:02:24,200 --> 00:02:26,660 let's take out our let's see the shuffle in. 32 00:02:26,660 --> 00:02:27,290 What the heck? 33 00:02:27,290 --> 00:02:31,910 And we'll print out the result of Dec dot cards with suit. 34 00:02:31,910 --> 00:02:37,430 And notice how we now get this nice autocomplete here with a function that you and I added. 35 00:02:37,940 --> 00:02:42,530 So we'll call this thing and I'm going to try to get every card with a suit of diamonds. 36 00:02:43,520 --> 00:02:46,640 All right, so now I will run this code and we'll see what happens. 37 00:02:50,980 --> 00:02:53,880 OK, just going to give it a minute, let's try it one more time here. 38 00:02:56,110 --> 00:02:57,070 There we go, much better. 39 00:02:57,370 --> 00:03:03,550 So I now get four of diamonds, five to three and Ace, so clearly we went through that list and we 40 00:03:03,550 --> 00:03:05,860 pulled out every card with some given suit. 41 00:03:06,550 --> 00:03:10,780 Now, one thing I want to point out here is that rather than the square brackets we had before, we 42 00:03:10,780 --> 00:03:12,420 now have a set of parentheses. 43 00:03:13,060 --> 00:03:18,190 So if you go back over to the documentation for that weird method, you'll notice that it says that 44 00:03:18,190 --> 00:03:20,560 it returns a new lazy iterable. 45 00:03:20,920 --> 00:03:25,500 So an iterable is something that is like a list, but not quite a list. 46 00:03:26,200 --> 00:03:30,250 We're not going to make a big distinction between the two just yet, but this is a topic that will come 47 00:03:30,250 --> 00:03:32,800 back to later in the course for right now. 48 00:03:32,800 --> 00:03:37,510 I really just wanted to show you how to make use of the standard library and how to use some of the 49 00:03:37,510 --> 00:03:39,910 built-In methods that exist on lists already. 50 00:03:40,830 --> 00:03:45,330 OK, so it looks good, so let's take a quick pause right here and we'll come back in the next section. 5290

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