Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Compress List by twilyght
from typing import Iterable
def compress(items: list) -> Iterable:
return items[0:1] + [n1 for n1, n2 in zip(items[1:], items) if n1 != n2]
May 4, 2020
Comments: