Welcome back.
I want to talk to you quickly about something called Matrix.
And a matrix is a way to describe 2D lists or multi dimensional lists.
What do I mean?
Well, I can create a matrix, and this is a name that I just made, so I can call it whatever I want.
But usually these are called matrix and programming.
And it looks something like this.
It's an array.
With another array inside of it.
So let's say, for example.
I have one, two, three here.
And then another array one or let's do two for.
Six.
And then another array.
Seven, eight, nine.
What's happening here?
Well, it's a two dimensional array.
We have the main array.
And then we have sub arrays, three arrays to be exact.
Now, why is this useful?
And by the way, this is two dimensional, but we can have multiple ones.
For example, you can have another array inside of this array.
But why is this important?
These type of matrices come up a lot in topics like machine learning or image processing.
For example, a computer doesn't really know what a photo of a dog is.
The only thing it understands is zeros and ones.
So a lot of photos.
For example, let's say we had a very simple photograph of a giant X, maybe this letter x.
Well, a computer can understand an image based on pixels on the screen, so maybe we can have zero,
one, zero.
100 or sorry, one here, zero here, and then one.
And right now, a computer can look at this.
And if this represented, let's say, a tiny little pixel here or maybe a pixel here on my screen,
the computer is going to say, oh, there's a one here.
So that means I should make this green in this corner, then dark here, then green, then dark green,
dark green, dark green.
And a computer is able to draw, let's say, an X.
And this is a simple example.
And using matrices, we can do a lot of these heavy calculations.
And that's how computers work underneath the hood when, let's say, for example, it's trying to display
something.
But the reason I wanted to talk about this here is when you want to access a multi dimensional list,
well, you would do something like this, let's say matrix.
Access the first item.
In The Matrix, which in this case will be this first array because it's the first item.
And then let's say we want to access the zero in here or let's change this to five.
Well, I'll do square brackets again and just do zero one.
So if I go.
One here, and let's print that out.
And I click Run.
I get five.
So it's accessing the first item in the array.
So it's going to look at the first order array, grab the first item which is right here, and then
grab the second item in that array.
So zero one, which is five.
And you can keep doing this.
If he had multi dimensional arrays, you can keep adding, keep adding, keep adding.
To access that information from an array or list.
But remember in Python, we want to use the term list.
I'll see you in the next one.
Bye bye.