min, max with position
Michael F. Stemper
michael.stemper at gmail.com
Sat Jun 4 14:36:26 EDT 2022
Python contains built-in functions that return the minimum or
maximum items in a list.
>>> l = [1.618033,3.141593,2.718282]
>>> min(l)
1.618033
>>> max(l)
3.141593
>>>
Are there similar functions that return not only the minimum
or maximum value, but also its position?
>>> specialmin(l)
(0,1.618033)
>>> specialmax(l)
3.141593
>>>
--
Michael F. Stemper
I feel more like I do now than I did when I came in.
More information about the Python-list
mailing list