Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Min and Max by sts10131
def min(*args, **kwargs):
key = kwargs.get("key", None)
if isinstance(args[0],int) or isinstance(args[0],float):
t=args
elif type(args[0])==list and len(args)>1:
t=args
else:
t=list(args[0])
min=t[0]
for i in t:
if type(key)!=type(None):
if key(min)>key(i):
min=i
else:
if min>i:
min=i
return min
def max(*args, **kwargs):
key = kwargs.get("key", None)
if isinstance(args[0],int) or isinstance(args[0],float):
t=args
elif type(args[0])==list and len(args)>1:
t=args
else:
t=list(args[0])
max=t[0]
for i in t:
if type(key)!=type(None):
if key(max)
Dec. 27, 2016