Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Min and Max solution in Clear category for Min and Max by Dominik_Witczak
def min(*args, **kwargs):
key = kwargs.get("key", lambda x: x)
items = args[0] if len(args) == 1 else args[:]
minValue = None
for i in items:
if minValue is None or key(i) < key(minValue):
minValue = i
return minValue
def max(*args, **kwargs):
key = kwargs.get("key", lambda x: x)
items = args[0] if len(args) == 1 else args[:]
maxValue = None
for i in items:
if maxValue is None or key(i) > key(maxValue):
maxValue = i
return maxValue
Oct. 27, 2017