I am trying to write a function that goes through a matrix (array of arrays) and deletes all rows that contain in them one specific value. As an example, my matrix looks for example like this:
a = [[[1,2,3], [1,3,2], [0,2], 0, True],
[[2,1,3], [1,3,2], [4,3], 2, False],
[[4,3,1], [9,2,1], [5,2], 1, True],
[[3,1,4], [5,2,1], [5,4], 2, False]]
I'd like to delete all rows that contain a False in the last column, so that I would end up with:
a = [[[1,2,3], [1,3,2], [0,2], 0, True],
[[4,3,1], [9,2,1], [5,2], 1, True]]
I tried amongst other things this:
def rmRows(a):
for i in range(len(a)-1):
if a[i][4] == False:
a.remove(a[i])
return a
but that doesn't seem to work. Any ideas on how to tackle that?