4

PHOTO EMBED

Thu Sep 26 2024 00:31:25 GMT+0000 (Coordinated Universal Time)

Saved by @JC

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)
content_copyCOPY