Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Compress List by Tinus_Trotyl
from typing import Iterable
def compress(items: list) -> Iterable:
compressed_items, items = items[:1], items[1:]
for item in items:
if item != compressed_items[-1]: compressed_items.append(item)
return compressed_items
Jan. 10, 2021