Welcome back.
I want to talk to you quickly about something called Matrix and a matrix is a way to describe 2D lists
or multidimensional 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 in 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 listed 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 0 1 0 1 0 0 or sorry 1 here 0 here and then 1.
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 or my screen the computer's 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 else change us to five.
Well I'll do square brackets again and just do 0 1.
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 0 1 which is 5 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 in the next one.
Bobby.