Preview:
lst=list(map(int, input("Enter list of integers: ").split()))
result_lst = [lst[i] for i in range(len(lst)) if i==0 or lst[i]!= lst[i-1]]
print("List with consecutive duplicates removed:",result_lst)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter