I'm producing lists of data iteratively. Each of these lists has the same number of values, and my goal is to store the `N` worst lists, this criteria being defined by a specific column.
I've tried several things, but none of them satisfy me, and I'd like to know if I missed something.

For the example, let's imagine each of my rows contains 5 elements, and that I want to keep the 10 worst rows.
I want to compare on the last value, knowing this one is always positive.

```
array = [[0] * 5] * 10
while (...)
    # processing
    # I now have a "my_row" that looks like [5, 102.24, -3.12, 2, 7.37] for instance
    indexes = [array.index(row) for row in array if row[-1] == min(r[-1] for r in array)] # can return several indexes
    if array[indexes[0]][-1] < my_row[-1]:
        array[indexes[0]] = my_row

```

However, this solution is far from being elegant, nor optimal.
Does anyone have an idea how to code it better?

Thanks for your help!