I am having list of tuple from which I want the tuple with the minimum value at index 1
. For example, if my list is like:
a =[('a', 2), ('ee', 3), ('mm', 4), ('x', 1)]
I want the returned tuple to be ('x', 1)
.
Currently I am using sorted
function to get this result like:
min=sorted(a, key=lambda t: t[1])[0]
Is there better ways to do it? Maybe with min
function?