Grant Edwards 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! :)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to