I am trying to simplify this function at his maximum, how can I do?
def eleMax(items, start=0, end=None):
if end is None:
end = len(items)
return max(items[start:end])
I thought of
def eleMax(items, start=0, end=-1):
return max(items[start:end])
But the last element is deleted from the list.
max(items)
. And if you need to slicemax(items[start:end])
or evenmax(items[start:])
works.