Thanks, everyone. Very helpful!
Che
--
http://mail.python.org/mailman/listinfo/python-list
On 20/07/11 06:19, Steven D'Aprano wrote:
> On Wed, 20 Jul 2011 01:17 pm CM wrote:
>
>> I have three items in a dict, like this:
>>
>> the_dict = {'a':1, 'b':2, 'c':3}
>>
>> but the vals could be anything. I want to configure something else
>> based on the "winner" of such a dict, with these rule
On Tue, Jul 19, 2011 at 10:10 PM, CM wrote:
> On Jul 19, 11:17 pm, CM wrote:
>> I have three items in a dict, like this:
>>
>> the_dict = {'a':1, 'b':2, 'c':3}
>>
>> but the vals could be anything. I want to configure something else
>> based on the "winner" of such a dict, with these rules:
> I
> 1. In this dict, if there is a UNIQUE max value, then its *key* is the
> winner.
> 2. If there are any TIES for max value, then the *key* 'b' is the
> winner by default.
This will store the max value(s) in a list. In case of a tie, you can
take the first value in the list, but it may be differe
On Jul 19, 11:17 pm, CM wrote:
> I have three items in a dict, like this:
>
> the_dict = {'a':1, 'b':2, 'c':3}
>
> but the vals could be anything. I want to configure something else
> based on the "winner" of such a dict, with these rules:
>
> 1. In this dict, if there is a UNIQUE max value, that
On Tue, Jul 19, 2011 at 8:17 PM, CM wrote:
> I have three items in a dict, like this:
>
> the_dict = {'a':1, 'b':2, 'c':3}
>
> but the vals could be anything. I want to configure something else
> based on the "winner" of such a dict, with these rules:
>
> 1. In this dict, if there is a UNIQUE max
On Wed, 20 Jul 2011 01:17 pm CM wrote:
> I have three items in a dict, like this:
>
> the_dict = {'a':1, 'b':2, 'c':3}
>
> but the vals could be anything. I want to configure something else
> based on the "winner" of such a dict, with these rules:
>
> 1. In this dict, if there is a UNIQUE max
I have three items in a dict, like this:
the_dict = {'a':1, 'b':2, 'c':3}
but the vals could be anything. I want to configure something else
based on the "winner" of such a dict, with these rules:
1. In this dict, if there is a UNIQUE max value, that's the winner.
2. If there are any TIES for m