Does anyone know why this code wouldnt work if there was hypothetically an empty list. When I run a test for the empty list it give me indexerror that it is out of range.
def dedup(l):
dl = [l[0]]
for v in l[1:]:
if dl[-1] != v:
dl.append(v)
return dl