On Sat, 4 Jun 2022 13:36:26 -0500, "Michael F. Stemper"
<michael.stem...@gmail.com> declaimed the following:

>
>Are there similar functions that return not only the minimum
>or maximum value, but also its position?
>
        If it isn't in the library reference manual, NO...

        But it also isn't that difficult to write...

>>> def whatAt(function, data):
...     what = function(data)
...     at = data.index(what)
...     return (at, what)
... 
>>> l = [       1.618033,       3.1415923536,   2.718282        ]
>>> whatAt(min, l)
(0, 1.618033)
>>> whatAt(max, l)
(1, 3.1415923536)
>>> 

(properly, I should either reverse the order of the return value, or change
the name to atWhat() )


-- 
        Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfr...@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to