culpritNr1 <ig2ar-s...@yahoo.co.uk> writes: > a = [0 , 1, 3.14, 20, 8, 8, 3.14] > > Is there a simple python way to count the number of 3.14's in the list in > one statement?
n = sum(1 for x in a if x == 3.14) -- http://mail.python.org/mailman/listinfo/python-list