Function to determine list max without itertools

Sayth Renshaw flebber.crue at gmail.com
Thu Apr 18 19:35:53 EDT 2019


> >        
> It's still overly complicated.
> 

This is where I have ended up. Without itertools and max its what I got currently.

def maximum(listarg):
    myMax = listarg[0]
    for item in listarg:
        for i in listarg[listarg.index(item)+1:len(listarg)]:
            if myMax < i:
                myMax = i

    return myMax

How would you simplify it?


More information about the Python-list mailing list