python sum whole matrix comand 1

python sum whole matrix comand

x = np.matrix([[1, 2], [4, 3]])
>>> x.sum()

Here is what the above code is Doing:
1. We create a matrix x with the values 1, 2, 3, and 4.
2. We then print the sum of all the values in the matrix.

The sum of all the values in the matrix is 10.

Similar Posts