On Thu, Jan 22, 2009 at 11:35 AM, blueiur <blue...@gmail.com> wrote:
> i think it's best way
> lst = [0, 1, 3.14, 20, 8, 8, 3.14]
> len( filter(lambda x: x > 3.13 and x < 3.15, lst) )
> 2

I prefer this way (cleaner):

>>> lst = [0, 1, 3.14, 20, 8, 8, 3.14]
>>> len([x for x in lst if 3.13 < x < 3.15])
2
>>>

cheers
James
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to