How Will You Remove The Duplicate Elements From The Given List?
words = [‘one’, ‘one’, ‘two’, ‘three’, ‘three’, ‘two’]
A simple solution is to iterate over the list, identify duplicates and remove them.
But the best solution which we can recommend is as follows.
a = [1,2,2,3] list(set(a))
The set is another type available in Python. It doesn’t allow copies and provides some good functions to perform set operations like union, difference etc.