On Sat, Jun 4, 2022 at 9:07 PM Greg Ewing
wrote:
> On 5/06/22 10:07 am, dn wrote:
> > On 05/06/2022 09.50, Chris Angelico wrote:
> > min(enumerate(l), key=lambda x: x[1])
> >> (0, 1.618033)
> >
> > But, but, but which of the above characters is an 'el' and which a
> 'one'???
> > (please have
On 5/06/22 10:07 am, dn wrote:
On 05/06/2022 09.50, Chris Angelico wrote:
min(enumerate(l), key=lambda x: x[1])
(0, 1.618033)
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!)
ell = l
one = 1
min(enum
On Sun, 5 Jun 2022 at 08:09, dn 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
>
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(enumerat
On Sun, 5 Jun 2022 at 08:00, dn wrote:
>
> On 05/06/2022 06.56, Dennis Lee Bieber wrote:
> > On Sat, 4 Jun 2022 13:36:26 -0500, "Michael F. Stemper"
> > declaimed the following:
> >
> >>
> >> Are there similar functions that return not only the minimum
> >> or maximum value, but also its position
On 05/06/2022 06.56, Dennis Lee Bieber wrote:
> On Sat, 4 Jun 2022 13:36:26 -0500, "Michael F. Stemper"
> 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 manua
On Sun, 5 Jun 2022 at 07:46, Michael F. Stemper
wrote:
>
> 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
(*) Question
How can I, in a single line, write a statement followed by an
expression? For example, if /d/ is a dicionary, how can I write
d["key"] = value # and somehow making this line end up with d
(*) Where does the question come from?
>From the following experiment-exercise.
(*) Intro
Meredith Montgomery writes:
How can I execute a statement followed by a value in a single line?
def roberry_via_reduce(rs):
return my_reduce(rs, lambda d, r: ``increment and return d'', {})
The grammar or Python is deliberately designed so that the body of a
lambda expression cannot
On 04/06/2022 13.56, Dennis Lee Bieber wrote:
On Sat, 4 Jun 2022 13:36:26 -0500, "Michael F. Stemper"
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...
"Michael F. Stemper" writes:
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
>>>
I believe that what you are looking for is usually called "argmax" and
"argm
On Sat, 4 Jun 2022 13:36:26 -0500, "Michael F. Stemper"
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 writ
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)
13 matches
Mail list logo