l = [_f for _f in l if _f]
for i in range(len(l) - 1):
    cur = l[i]
if cur is None:
    continue
next = l[i + 1]
if cur['e'] == next['b'] - 1:
    cur['e'] = next['e']
l[i + 1] = None
changed = True
l = [_f for _f in l if _f]
print(l)
How to simplify list of dictionaries by condition?