On 2006-05-02, John Salerno <[EMAIL PROTECTED]> wrote:

>> Python knows how to count.  :)
>> 
>> def countFalse(seq):
>>     return len([v for v in seq if not v])
>> 
>> def countTrue(seq):
>>     return len([v for v in seq if v])
>> 
>> def truth_test(seq):
>>     return countTrue(seq) == 1
>
> Gosh, so much to learn! Of course, I already know all about list 
> comprehensions, but now I just need to learn to *use* them! :)

That's the part that takes a while...

-- 
Grant Edwards                   grante             Yow!  Is this "BOOZE"?
                                  at               
                               visi.com            
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to