In Python, given a 2d list of the form:
L = [[0, 4],[10, 2],[20, 1],[30, 2]]
How can I obtain the pair that contains the minimum value in the second place? In other words, how to obtain the pair x,y such that y is the smallest among all ys?
That is, in the list above that would be L[2]=[20,1]
. I could not find how the min
function can be used here.
Edit: I was not able to do a proper search in SO for possible repeated questions. OP agrees to close if needed.