Request for argmax(list) and argmin(list)

Paul Bryan pbryan at anode.ca
Wed Sep 1 02:32:06 EDT 2021


Why not:

>>> l = [1, 3, 5, 9, 2, 7]
>>> l.index(max(l))
3
>>> l.index(min(l))
0

On Tue, 2021-08-31 at 21:25 -0700, ABCCDE921 wrote:
> I dont want to import numpy
> 
> argmax(list) 
>    returns index of (left most) max element
> 
>  argmin(list)
>    returns index of (left most) min element



More information about the Python-list mailing list