3 ms·
min and max can also be comparing one part of a more complex object: In [1]: l = [(19, "John"), (19, "Jack"), (20, "Jim")] In [2]: min(l, key=lambda x
by rcar 7y ago
min and max can also be comparing one part of a more complex object:
In [1]: l = [(19, "John"), (19, "Jack"), (20, "Jim")]
In [2]: min(l, key=lambda x: x[0])
Out[2]: (19, 'John')