0

A=[[1,2,3], [5,3,2]]

How to find min value in matrix? How to sort matrix with the sum of elements?

19th Dec 2017, 7:17 AM
Ilya Grib
Ilya  Grib - avatar
2 Answers
0
my_matrix = [[1,2,3],[5,3,2]] # you can convert it to a standard list then find the minimum flattened = [i for j in my_matrix for i in j] print(flattened, min(flattened)) # or if you want the sum of matix elements the_sums = [sum(i) for i in my_matrix] print(the_sums)
19th Dec 2017, 12:15 PM
richard