Please look as these two code attempts and let me know where my brainfart is.
The first one gives:
remove_duplicates([4, 5, 5, 4]) resulted in an error: list index out of range
def remove_duplicates(x): myset = set() for i in x: if i not in myset: myset.add(x[i]) return myset
The second one:
SyntaxError: invalid syntax
def remove_duplicates(x): myset = set() return [myset.add(x[i]) if i not in myset for i in x]