Ad
Code
Diff
  • def unique_in_order(iterable):
        iterable = list(iterable)
        result = [iterable[0]]
        for i in range(1, len(iterable)):
            if result[-1] != iterable[i]:
                result.append(iterable[i])
        return result
    • def unique_in_order(iterable):
    • iterable = list(iterable)
    • while 1==1:
    • for x in range(len(iterable)):
    • if iterable[x]==iterable[x-1]:
    • del iterable[x]
    • break
    • if x==len(iterable)-1:
    • return iterable
    • result = [iterable[0]]
    • for i in range(1, len(iterable)):
    • if result[-1] != iterable[i]:
    • result.append(iterable[i])
    • return result