I was curios about the question: Eliminate consecutive duplicates of list elements, and how it should be implemented in Python.
What I came up with is this:
A "lazy" approach would be to use itertools.groupby.
itertools.groupby
import itertools list1 = [1, 2, 3, 3, 4, 3, 5, 5] list1 = [g for g, _ in itertools.groupby(list1)] print(list1)
outputs
[1, 2, 3, 4, 3, 5]