1 00:00:00,680 --> 00:00:05,360 Now, tuples, like I said, are quite similar to lists, so. 2 00:00:06,340 --> 00:00:15,970 If I wanted to, I can say new tuple and use my tuple and then slice that tuple. 3 00:00:17,600 --> 00:00:23,330 So, for example, if I do want to like this and print new. 4 00:00:26,250 --> 00:00:28,680 I'm going to get to comma. 5 00:00:29,850 --> 00:00:31,800 Hmmm, why is that? 6 00:00:33,020 --> 00:00:39,500 Well, we started zero one and a two if I did four here and click Run. 7 00:00:40,950 --> 00:00:43,080 I get two, three, four. 8 00:00:44,170 --> 00:00:49,570 It's still a tuple, but you have to remember that a tuple that only has a single item tends to have 9 00:00:49,570 --> 00:00:53,200 this little comma at the end, but it's still a tuple. 10 00:00:54,660 --> 00:01:02,760 And just like a list, I can assign different things, for example, I can say X equals to my tuple 11 00:01:03,660 --> 00:01:13,170 zero and then I can say Y equals my tuple one and X and Y will equal one and two. 12 00:01:14,010 --> 00:01:17,580 But a short form of doing this, again, similar to lists. 13 00:01:18,790 --> 00:01:20,530 Is to say, hey, I want. 14 00:01:24,930 --> 00:01:25,440 Z. 15 00:01:27,280 --> 00:01:28,700 You know what other. 16 00:01:29,880 --> 00:01:39,030 To be the values assigned from the top so that if I do X here and I run, I get one, if I do Z and 17 00:01:39,030 --> 00:01:39,420 I run. 18 00:01:40,950 --> 00:01:49,540 I get three what if I do other and if I click run, I get four and five as a list. 19 00:01:50,280 --> 00:01:53,780 All right, if your head doesn't hurt by now, don't worry. 20 00:01:53,790 --> 00:01:54,800 I have some good news. 21 00:01:55,290 --> 00:02:00,510 Luckily for us, a couple has only two methods that we care about. 22 00:02:00,930 --> 00:02:02,060 Count and index. 23 00:02:02,070 --> 00:02:02,940 How nice is that? 24 00:02:03,090 --> 00:02:04,140 So nice and simple. 25 00:02:05,630 --> 00:02:06,900 Guess what these mean? 26 00:02:07,220 --> 00:02:08,750 So let's go back to my. 27 00:02:11,540 --> 00:02:17,770 And now try this out, if I go my toppled that count, well, it's going to count the value. 28 00:02:18,320 --> 00:02:23,990 So if we want to count how many fives occur in the tuple, I get one. 29 00:02:24,320 --> 00:02:28,040 If I had another five in the table I get to. 30 00:02:28,940 --> 00:02:30,080 What about index? 31 00:02:31,340 --> 00:02:32,960 What's the index of five? 32 00:02:34,650 --> 00:02:42,240 Well, the index of five is four because zero one, two, three for the first. 33 00:02:43,590 --> 00:02:46,360 Value that it finds it's going to return the index of. 34 00:02:47,070 --> 00:02:51,500 And then finally, we can also do lenth, right? 35 00:02:53,170 --> 00:02:59,320 We can use this built in function to run length, and it's going to tell us that, yep, it's has a 36 00:02:59,320 --> 00:03:00,850 length of six. 37 00:03:01,570 --> 00:03:02,010 Awesome. 38 00:03:02,650 --> 00:03:03,330 There it is. 39 00:03:03,340 --> 00:03:04,750 We're flying through them now. 40 00:03:05,020 --> 00:03:07,200 This is our third data structure. 41 00:03:07,250 --> 00:03:10,180 Remember, they're simply lists that. 42 00:03:11,030 --> 00:03:14,300 Are immutable, I'll see in the next one by.