matrix shape python check code example
Example 1: size of matrix python
>>> a=[[1,5,6,8],[1,2,5,9],[7,5,6,2]]
>>> len(a)
3
>>> len(a[0])
4
Example 2: python check matrix dimension
>>> a.shape
(2, 2)
>>> a=[[1,5,6,8],[1,2,5,9],[7,5,6,2]]
>>> len(a)
3
>>> len(a[0])
4
>>> a.shape
(2, 2)