On Sun, 5 Jun 2022 at 08:09, dn <pythonl...@danceswithmice.info> wrote:
>
> On 05/06/2022 09.50, Chris Angelico wrote:
> > No, but it shouldn't be too hard to make it if you want it. The
> > obvious option of calling max/min on the enumerated list won't work on
> > its own, since the index comes before the value, but with a key
> > function it would work fine:
> >
> >>>> min(enumerate(l), key=lambda x: x[1])
> > (0, 1.618033)
> >>>> max(enumerate(l), key=lambda x: x[1])
> > (1, 3.141593)
>
> An elegant solution!
>
> But, but, but which of the above characters is an 'el' and which a 'one'???
> (please have pity on us old f...s and the visually-challenged!)
>

Fair point, but I stuck to the OP's example list and kept it called
'l' for list :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to