1 00:00:00,460 --> 00:00:04,840 Welcome back, I want to talk to you quickly about something called Matrix. 2 00:00:05,820 --> 00:00:15,240 And The Matrix is a way to describe 2D lists or multidimensional lists. 3 00:00:15,480 --> 00:00:16,110 What do I mean? 4 00:00:16,650 --> 00:00:24,420 Well, I can create a matrix and this is a name that I just made so I can call it whatever I want. 5 00:00:24,840 --> 00:00:27,180 But usually these are called matrix in programming. 6 00:00:28,130 --> 00:00:30,650 And it looks something like this, it's an array. 7 00:00:31,670 --> 00:00:33,320 With another array inside of it. 8 00:00:34,630 --> 00:00:36,220 So let's say, for example. 9 00:00:39,420 --> 00:00:41,130 I have one, two, three here. 10 00:00:42,420 --> 00:00:47,220 And then another array, one or less, two to four. 11 00:00:50,130 --> 00:00:54,150 And then another seven, eight, nine. 12 00:00:55,320 --> 00:00:56,280 What's happening here? 13 00:00:56,970 --> 00:00:59,140 Well, it's a two dimensional array. 14 00:00:59,730 --> 00:01:02,130 We have the main array. 15 00:01:03,290 --> 00:01:07,400 And then we have sub iRace, three arrays, to be exact. 16 00:01:08,000 --> 00:01:10,010 Now, why is this useful? 17 00:01:10,490 --> 00:01:15,190 And by the way, this is two dimensional, but we can have multiple ones. 18 00:01:15,320 --> 00:01:19,160 For example, we can have another array inside of this array. 19 00:01:21,680 --> 00:01:23,210 But why is this important? 20 00:01:24,490 --> 00:01:31,100 These type of mattresses come up a lot in topics like machine learning or image processing. 21 00:01:31,900 --> 00:01:36,130 For example, a computer doesn't really know what a photo of a dog is. 22 00:01:37,000 --> 00:01:39,780 The only thing it understands is zeros and ones. 23 00:01:40,180 --> 00:01:48,370 So a lot of photos, for example, let's say we had a very simple photograph of a giant X, maybe this 24 00:01:48,520 --> 00:01:49,300 letter X. 25 00:01:50,080 --> 00:01:56,920 Well, a computer can understand an image based on pixels on the screen, so maybe we can have zero 26 00:01:57,400 --> 00:01:59,470 one zero. 27 00:02:01,210 --> 00:02:12,190 One zero zero or sorry, one here, zero here and then one, and right now a computer can look at this. 28 00:02:12,370 --> 00:02:19,210 And if this represented, let's say, a tiny little pixel here or maybe a pixel here on my screen, 29 00:02:19,750 --> 00:02:22,640 the computer is going to say, oh, there's a one here. 30 00:02:22,660 --> 00:02:30,580 So that means I should make this green in this corner, then dark here, then green, then dark green, 31 00:02:30,580 --> 00:02:32,650 dark green, dark green. 32 00:02:33,130 --> 00:02:39,550 And a computer is able to draw, let's say, an X, and this is a simple example. 33 00:02:39,700 --> 00:02:44,380 And using matrices, we can do a lot of these heavy calculations. 34 00:02:44,380 --> 00:02:49,450 And that's how computers work underneath the hood when let's say, for example, it's trying to display 35 00:02:49,450 --> 00:02:49,870 something. 36 00:02:50,230 --> 00:02:58,150 But the reason I wanted to talk about this here is when you want to access a multi dimensional list, 37 00:02:58,600 --> 00:03:02,380 well, you would do something like this, let's say matrix. 38 00:03:04,070 --> 00:03:06,710 Access the first item. 39 00:03:07,860 --> 00:03:15,210 And the Matrix, which in this case will be this first array, because it's the first item and then 40 00:03:15,210 --> 00:03:19,420 let's say we want to access the zero, and here are let's change this to five. 41 00:03:19,980 --> 00:03:24,120 Well, how do square brackets again and just do zero one. 42 00:03:24,330 --> 00:03:25,080 So if I go. 43 00:03:26,730 --> 00:03:28,580 One here, and let's print that out. 44 00:03:33,590 --> 00:03:34,580 And I click run. 45 00:03:36,590 --> 00:03:42,940 I get five, so it's accessing the first item in the array, so it's going to look at the first Ottery 46 00:03:43,460 --> 00:03:49,250 grab the first item, which is right here, and then grab the second item in that array. 47 00:03:49,250 --> 00:03:51,890 So zero one, which is five. 48 00:03:53,110 --> 00:03:58,180 And you can keep doing this, if he had multidimensional arrays, you can keep adding, keep adding, 49 00:03:58,360 --> 00:03:59,080 keep adding. 50 00:04:00,460 --> 00:04:07,390 To access that information from an array or list, but remember in Python, we want to use the term 51 00:04:07,390 --> 00:04:07,900 list. 52 00:04:08,710 --> 00:04:09,650 I'll see you in the next one. 53 00:04:10,210 --> 00:04:10,560 Bye bye.