1 00:00:00,680 --> 00:00:01,700 Welcome back. 2 00:00:01,730 --> 00:00:04,820 Let's talk about our next data type. 3 00:00:04,820 --> 00:00:06,000 And it's a big one. 4 00:00:06,020 --> 00:00:08,570 A very, very useful one. 5 00:00:09,670 --> 00:00:11,560 It's called List. 6 00:00:12,400 --> 00:00:18,400 And list is an ordered sequence of objects that can be of any type. 7 00:00:19,620 --> 00:00:22,670 So you can think of them as strengths, right? 8 00:00:22,680 --> 00:00:29,790 We had strengths previously that we learned about, except that each sequence of this string, well, 9 00:00:29,790 --> 00:00:34,890 was was a string was a letter or a number wrapped in quotation marks. 10 00:00:35,610 --> 00:00:39,030 Lists, on the other hand, looks something like this. 11 00:00:39,420 --> 00:00:46,200 Let's say we create a variable ally and lists we denote with square brackets. 12 00:00:46,350 --> 00:00:50,430 And inside of the square brackets we can have different objects. 13 00:00:50,430 --> 00:00:54,660 So for example, we can have one, two, three, four, five. 14 00:00:55,170 --> 00:00:57,450 We can also have, let's say, Ali two. 15 00:00:57,630 --> 00:00:59,700 And this is going to have a. 16 00:01:01,270 --> 00:01:01,990 Be. 17 00:01:03,370 --> 00:01:04,069 See. 18 00:01:04,360 --> 00:01:08,870 And it can have any collection of items that we want. 19 00:01:08,890 --> 00:01:14,560 We can even mix and match and say that we have one too. 20 00:01:14,590 --> 00:01:18,760 Then a then maybe even the boolean value. 21 00:01:18,790 --> 00:01:19,480 True. 22 00:01:20,080 --> 00:01:23,260 So all of these are lists. 23 00:01:24,040 --> 00:01:34,810 Now lists are extremely important and in other programming languages you might have heard the word arrays. 24 00:01:34,930 --> 00:01:39,100 So in Python lists are a form of array. 25 00:01:39,700 --> 00:01:45,640 And later on when we get into the modules section of the course, we will talk about the difference 26 00:01:45,640 --> 00:01:47,070 between lists and erase. 27 00:01:47,080 --> 00:01:54,550 But if you are coming from a different programming background, then lists are like arrays in your language. 28 00:01:55,570 --> 00:01:57,220 A collection of items. 29 00:01:57,790 --> 00:02:03,700 Now, the neat thing about lists is that it's the first data structure that we're learning. 30 00:02:04,150 --> 00:02:07,480 Now, what is a data structure? 31 00:02:08,289 --> 00:02:12,310 Data structure is a very important concept in programming languages. 32 00:02:12,520 --> 00:02:22,210 It's a way for us to organize information and data into, let's say, a folder or a cupboard or a box 33 00:02:22,210 --> 00:02:27,120 so that these data structures can be used with different pros and cons. 34 00:02:27,130 --> 00:02:33,580 For example, you have a fridge where you store your food, and fridges are really, really good at 35 00:02:33,580 --> 00:02:37,750 putting your food inside, keeping it cold, and then taking it out. 36 00:02:37,780 --> 00:02:39,850 Or you might have a backpack. 37 00:02:39,880 --> 00:02:43,090 A backpack is really, really good to stuff everything in there. 38 00:02:43,090 --> 00:02:46,630 But when you're looking for things in a backpack, it's really, really hard. 39 00:02:46,630 --> 00:02:54,070 So you can think of data structures similar to that, a container around your data that has different 40 00:02:54,070 --> 00:02:58,930 pros and cons of accessing that data, removing that data, writing data. 41 00:02:58,930 --> 00:03:01,810 But that's something we'll get into a little bit later. 42 00:03:02,020 --> 00:03:11,050 The key here is that the square brackets allow us to contain information and data like strings, integers, 43 00:03:11,050 --> 00:03:15,670 floats if we want to booleans into a contained fashion. 44 00:03:15,670 --> 00:03:17,710 So let's think of a good example here. 45 00:03:17,710 --> 00:03:19,780 What if we had a shopping cart? 46 00:03:19,780 --> 00:03:26,170 Let's say we're Amazon here, and then Amazon has the Amazon shopping cart. 47 00:03:26,350 --> 00:03:29,590 And in here we can collect different things that we want. 48 00:03:29,590 --> 00:03:33,100 Maybe we collect some, I don't know, notebooks. 49 00:03:33,730 --> 00:03:34,480 And you know what? 50 00:03:34,480 --> 00:03:35,530 Let's get some gadgets. 51 00:03:35,530 --> 00:03:38,830 Let's get some maybe some sunglasses. 52 00:03:39,400 --> 00:03:45,910 We can add different items here, different strings, different data into this cart. 53 00:03:46,910 --> 00:03:52,580 And now, just like we saw in strings, we can access the Amazon cart in different ways. 54 00:03:53,660 --> 00:04:00,620 For example, I can access it again with square brackets and simply say I want to item zero. 55 00:04:00,950 --> 00:04:02,540 So if I print here. 56 00:04:04,130 --> 00:04:05,630 And do Amazon cart. 57 00:04:07,090 --> 00:04:07,690 Look at that. 58 00:04:07,690 --> 00:04:08,780 I get notebooks. 59 00:04:08,800 --> 00:04:09,970 The second item. 60 00:04:12,080 --> 00:04:13,820 I get sunglasses? 61 00:04:14,390 --> 00:04:16,339 What about the third item? 62 00:04:18,820 --> 00:04:19,450 Nope. 63 00:04:19,600 --> 00:04:22,060 Lyst index out of range. 64 00:04:23,240 --> 00:04:24,920 But this should make sense now. 65 00:04:24,950 --> 00:04:28,640 This is a list where we're accessing the index of. 66 00:04:29,210 --> 00:04:31,040 But it only contains two items. 67 00:04:31,040 --> 00:04:35,720 So if we're going zero one to the third item, nothing exists. 68 00:04:35,720 --> 00:04:38,100 So our program says that doesn't work. 69 00:04:38,120 --> 00:04:39,170 You're doing something wrong. 70 00:04:40,090 --> 00:04:47,470 And just like strengths, these list items are in memory in their separate bookshelf. 71 00:04:47,470 --> 00:04:47,740 Right? 72 00:04:47,740 --> 00:04:49,480 But one right next to each other. 73 00:04:49,480 --> 00:04:55,720 So we can go zero one, two, three, four, five, so on and so forth until the list ends. 74 00:04:56,260 --> 00:04:56,770 All right. 75 00:04:56,770 --> 00:04:58,410 Let's learn about lists. 76 00:04:58,420 --> 00:05:00,250 A lot more in the next video. 77 00:05:00,520 --> 00:05:01,000 Bye bye.