I am making progress learning Python. and English. I understands tuples, lists and dictionaries, but sets don't make muchly sense. Why use a set? What is a set good for?

Thank you mawe,

so when I take the list with duplicates and make it one set then the duplicates are gone. How can I find out which were those duplicates?

Thank you mawe,

so when I take the list with duplicates and make it one set then the duplicates are gone. How can I find out which were those duplicates?

you can use the list method somelist.count(x),
which returns the number of i's for which somelist == x :

l=list('a list of characterstrings')
for item in set(l):
	print item,'counted',l.count(item),'times'

gives

a counted 3 times
  counted 3 times
c counted 2 times
e counted 1 times
...
This question has already been answered. Start a new discussion instead.