I'm trying to figure out how to make sure that the consecutive values are not the same in a list. Expected output: [1, 2, 3] Actual output: [1, 1, 3, 3]
I also tried using next() but that gave me "list object is not an iterator"
What is best practices here and what am I doing wrong?
def unique_in_order(iterable):
return [x for x in iterable if not iterable[x] == iterable[x+1]]
print(unique_in_order([1,1,2,2,3,3]))
for x in iterableherexis the values in the list not the index