Given a list of strings I want to remove the duplicates and original word.
For example:
lst = [\'a\', \'b\', \'c\', \'c\', \'c\', \'d\', \'e\', \'e\']
lst = ['a', 'b', 'c', 'c', 'c', 'd', 'e', 'e'] from collections import Counter c = Counter(lst) print([k for k,v in c.items() if v == 1 ])
collections.Counter will count the occurrences of each element, we keep the elements whose count/value is == 1 with if v == 1
count/value is == 1
if v == 1