Dear Jacob, thank you for your suggestion. however, i think my question was not clear. what i meant to ask in my previous question was, how to know which elements repeated and how many times they were repeated.
while my question was flying, i did a small test: took a list: >>> a [1, 1, 2, 3, 4, 2, 2] wanted to know which elements repeated and how many times: for i in range(len(a)): for k in range(len(a)): if i != k: if a[i] == a[k]: print a[i] break 1 1 2 2 2 In this very huge list (:-) kidding) of 7 elements, it is easy know by the above primitive code that there 1 s repeated two times, and 2 s repeated three times and finally 1 and 2 numbers are repeated in list a: With sets option i get a list of unique elements, but by no means i get to know which elements were repeated and how many times. With the above primitive code , I know that 1 and 2 are peated. However, in case where there are thousands of entries, how can I get to kno wich elements got repeated and how many times. Do you see any flaws in this code, how can that be made to look more pyhonian way. Hope my question is clear now and appreciate your suggestions. Thank you in advance Srini > >>> import sets > >>> a = sets.Set([1,2,1,4,3,5,5,2,3,3,2]) > >>> a > Set([1, 2, 3, 4, 5]) > >>> list(a) ## This is one of the uses of the > builtin list -- to make a > >>> list of an iterable. > [1, 2, 3, 4, 5] > >>> > > HTH, > Jacob > > > This isnt working either. logic appears correct. > > looking forward for help pleas. > > > > thank you > > > > Srini > > > > > > > > > > > > > > __________________________________ > > Do you Yahoo!? > > The all-new My Yahoo! - What will yours do? > > http://my.yahoo.com > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://mail.python.org/mailman/listinfo/tutor > > > > > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor