In this situation, we are discussing Biton metrics, implementation, and despite Permax metrics,
implementation will be demonstrated using some sample code.
We shall run them.
We shall execute them.
We should outputs.
And also from there will be getting the idea how to write the code.
So here is a demonstration.
A matrix is a two dimensional data structure.
In the real world, we often have to define one rectangular data table to support our data.
And obviously in this particular day that will be having multiple number of rows and multiple number
of columns.
So let us discuss in our PyCon how we can define a two dimensional matrix.
So here you see here we are defining a two dimensional matrix here.
We are defining one list at least as having three elements.
And each element individually is another list and consisting of, say, one string and five integer
data.
So this is known as a two dimensional matrix with integers and obviously with some strings here also.
So another nested list.
But it cannot be treated as a matrix because they are having different number of elements in this nested
lists.
Here you can find we are having the six elements that we are having.
Six elements are there, but we are having four elements have got listed here.
So now let us go for the printing.
We can see that how the outputs are coming.
So it is known as a two dimensional matrix with integers and along with the strings.
But the next one is not a matrix here because they are not having the same number of rules and columns.
So each and every data items are having different number of elements inside it.
So here we are having 611 cerebellar about having four elements here with having six elements back again.
So it is not a matrix, it is a list at least, but it can be considered as a matrix.
So having three rows and six columns, we can consider it.
So now let us go on creating one dynamic matrix, using the loop in between here.
So how to create that one.
So N is three, M is equal to four and it is equal to zero.
That is the one single element in this particular list.
Start end.
That means it will be repeated for any number of times.
That means it will be repeated for three number of times.
So if you this we are getting the outcome like this one.
So now for I in range N so end is there having the value three.
So this will be ranging from zero one and two eight is the goal to start in four for each and every
location of this.
I that is the location I ate.
Index will have a zero for any number of times.
So it means the the value for so far as for number of times it will be there for each and every index
of a.
So ultimately if I print then I'm getting a matrix which is having three rows and four columns and all
the members of this list and the nested list are zeroes.
So I know how to access our elements there.
So now let's go for this.
So if we print a zero, that means that zero element will get printed and that is another list.
So this particular outcome will be in if you go for this, a zero one.
So that means we are printing this very element because the zero location is having one list and it's
index number one.
That means this zero will get printed here.
So one comma two.
So that means we're not we are having this eight one two.
That is where having the zero index, there is a one index and two means it is there is a the index
that is at the one index and it is at zero at the index.
So this particular gyro will get printed here.
So also we can go for the negative indexing also we can go for the negative indexing so we can find
here.
So it has got printed.
Now we are going to print this minus one.
So minus one means this particular list will get printed here.
So minus one, minus two.
So from this minus one, we are having this minus two means this very element will get printed here.
So minus two, minus three.
So minus one, this is my minus two and it's minus three means.
This is our minus one, it is my minus two and it is my minus three.
So this particular element has got printed.
So in this way in case of Matrix also we can use that indexing, we can do the slicing accordingly with
using index.
We can we can extract the requested items from this matrix.
So change elements of metrics in baton, so print it.
So we are having this one.
So print date, we're having these respective metrics.
So be is equal to a zero.
That means this will be assigned to B and whenever we are printing B, we are getting these values here
and now we are going for this.
B one is equal to seventy five, so B one is seventy five minutes.
So this very location will have the value.
Seventy five and here you see written B is equal to zero.
That means here the respective values.
That means here we have done the.
The copy of this eight, there is a zero element will be copied to be, so be, and they both will be
referring to the same memory addresses.
So whenever you are printing this value of a I'm finding that that 75 has got updated here.
Also the seventy five has got updated here also.
So to get harder to get a better clarity on this concept, please watch the video on the shallow copy
and the tape copy we have done separately.
So now be one is equal to 75, so print.
So it has got the updated content of the beat.
But if you go for the print, we are finding that that 08 element is having the seventy five has got
updated in this list.
Also, it is equal to this.
That means we are having this zero one two.
So in the second index the list has got updated with this new list content.
So in this way we have shown you that how to do some changes of elements of a matrix in Python.
So in our discussion, we have discussed what is a matrix and how to implement it and how to do operations
on this matrix.
Thanks for watching this video.