1

I have a list of lists. I want to remove from this list all of the duplicate elements. I have attempted to write a function to do this, but am getting the error TypeError: unhashable type: 'list' when I try to use it. I think it is something about the compatibility of lists with sets. How should this type of operation be done?

def remove_duplicates(x):
    elementsSet = set(x)
    elements = [element for element in elementsSet]
    return elements
d3pd
  • 7,935
  • 24
  • 76
  • 127

0 Answers0