Index of maximum element in list

Hexamorph hexamorph at gmx.net
Fri Jan 25 16:47:37 EST 2008


Henry Baxter wrote:
> Oops, gmail has keyboard shortcuts apparently, to continue:
> 
> def maxi(l):
>     m = max(l)
>     for i, v in enumerate(l):
>         if m == v:
>             return i
> 

What's about l.index(max(l)) ?



More information about the Python-list mailing list