Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,660 --> 00:00:05,280
In this section, we're going to take care of our last method down here, the remove card method.
2
00:00:05,820 --> 00:00:11,310
So the idea behind this method is that we're going to try to remove one particular card from our deck.
3
00:00:11,880 --> 00:00:16,530
I can't really imagine where we would use this method in a real card game, but I'm sure there's some
4
00:00:16,530 --> 00:00:20,940
card game out there where you have to, like, find the ace of spades or something and take it out of
5
00:00:20,940 --> 00:00:21,340
the deck.
6
00:00:21,990 --> 00:00:25,040
Now, for this method, we're going to do things just a little bit differently.
7
00:00:25,080 --> 00:00:26,160
So here's what's going to happen.
8
00:00:26,610 --> 00:00:32,070
We're going to have you take a shot at putting the remove card method together.
9
00:00:32,400 --> 00:00:37,050
OK, so you're going to take a shot at it on your own using nothing but the code that we've already
10
00:00:37,050 --> 00:00:42,810
got over here and dart pad and the list class reference that we've been looking at quite a bit so far.
11
00:00:43,590 --> 00:00:47,640
So I'm going to give you a couple of little tips here just to get you started and then I'm going to
12
00:00:47,640 --> 00:00:48,560
cut you loose.
13
00:00:49,320 --> 00:00:54,930
So the first thing I want to point out here is inside of the last class documentation, if you scroll
14
00:00:54,930 --> 00:00:56,610
down inside the documentation.
15
00:00:56,640 --> 00:01:01,230
So I'm going to go down, down, down again until I find the method section.
16
00:01:01,240 --> 00:01:02,190
I think I just passed it.
17
00:01:03,000 --> 00:01:04,230
So here's the method section.
18
00:01:04,590 --> 00:01:06,900
And I want to point out one particular method to you.
19
00:01:08,140 --> 00:01:11,290
The remove where method right here.
20
00:01:11,990 --> 00:01:16,840
I want you to take a look at this method right here and I don't know, just kind of get a sense of how
21
00:01:16,840 --> 00:01:17,380
it works.
22
00:01:18,070 --> 00:01:21,790
The removed method expects you to pass in a function to it.
23
00:01:22,270 --> 00:01:26,230
That function will then be executed with every element within a list.
24
00:01:26,650 --> 00:01:30,280
And then if that function returns true, the element will be removed.
25
00:01:30,550 --> 00:01:33,150
But if it returns false, the element will stay around.
26
00:01:33,760 --> 00:01:39,410
And so we've already worked on a very similar function, very similar in nature to this one right here.
27
00:01:39,760 --> 00:01:41,650
You'll recall we put together our.
28
00:01:42,820 --> 00:01:44,650
Cards with suit to function right here.
29
00:01:44,710 --> 00:01:50,620
So this was very similar in nature, but this was where and maybe, I don't know, maybe you might want
30
00:01:50,620 --> 00:01:52,660
to take a look at remove wear right here.
31
00:01:53,540 --> 00:01:58,640
OK, so then the other thing I want to show you very quickly is back inside of Darte Pad, I really
32
00:01:58,640 --> 00:02:01,820
expect that you're probably going to add a new method to our class.
33
00:02:01,820 --> 00:02:03,830
So maybe a method right here.
34
00:02:04,760 --> 00:02:09,320
Maybe you're going to call that method something like remove card, I don't know, it's totally up to
35
00:02:09,320 --> 00:02:14,360
you and chances are that when we call remove card, we're going to have to pass in both the suit and
36
00:02:14,360 --> 00:02:16,410
rank of the card that we want to remove.
37
00:02:16,970 --> 00:02:18,710
So whereas back on the.
38
00:02:19,560 --> 00:02:24,180
Tarred with suit method that we passed in right here, or the method that we created right here, we
39
00:02:24,180 --> 00:02:25,520
were only passing in the suits.
40
00:02:25,740 --> 00:02:32,340
I kind of expect that for a remove card method, we'll have to pass in both a suit and a rank to specify
41
00:02:32,340 --> 00:02:33,780
what card we're trying to remove.
42
00:02:34,590 --> 00:02:37,670
OK, so I want you to give it a shot, do the best job you can.
43
00:02:37,800 --> 00:02:39,760
If you get stuck, don't sweat it.
44
00:02:39,780 --> 00:02:42,510
We're going to go over a solution together right in the next section.
45
00:02:42,510 --> 00:02:44,120
So I'll see you in just a minute.
4410
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.