Thank You for the explanations. I found this counter implementation is really cool and easily adaptable to more solutions.
Thanks > Alternatively collections.Counter() supports an arbitrary number of bins... > > >>> import collections > >>> freq = collections.Counter(t[1] for t in stats) > >>> freq > Counter({1: 12, 2: 12, 3: 12, 4: 12, 5: 12}) > > ...but you can easily reduce them: > > >>> freq = collections.Counter(t[1] == 1 for t in stats) > >>> freq > Counter({False: 48, True: 12}) > >>> one = freq[True] > >>> total = sum(freq.values()) > >>> print("{} of {} ({}%) have t[1] == 1".format(one, total, one/total*100)) > 12 of 60 (20.0%) have t[1] == 1 -- https://mail.python.org/mailman/listinfo/python-list