Is there a simple way to find the list index to the max value?
wolftracks at invalid.com
Tue Feb 16 16:34:51 CET 2010
On 2/16/2010 4:41 AM, Arnaud Delobelle wrote:
> Arnaud Delobelle<arnodel at googlemail.com> writes:
>> "W. eWatson"<wolftracks at invalid.com> writes:
>>> See Subject. a = [1,4,9,3]. Find max, 9, then index to it, 2.
>> Here are a few ways.
> My copy past went wrond and I forgot the first one:
>>>> a = [1,4,9,3]
>>>> max_index = a.index(max(a))
Ah, the good one for last! Thanks.
More information about the Python-list