How do I remove consecutive duplicates from a list like this in python?
lst = [1,2,2,4,4,4,4,1,3,3,3,5,5,5,5,5]
Having a unique list or set wouldn't solve the problem as there are some repeated values like 1,...,1 in the previous list.
I want the result to be like this:
newlst = [1,2,4,1,3,5]
Would you also please consider the case when I have a list like this 
 [4, 4, 4, 4, 2, 2, 3, 3, 3, 3, 3, 3] 
and I want the result to be [4,2,3,3] 
rather than [4,2,3] .
 
     
     
     
     
     
     
    