fork(1) download
  1. lst = [0, 1, 3, 8, 9, 10, 12, 13, 14, 17, 18, 20]
  2. w = []
  3. for i in range(0, len(lst) - 1):
  4. if((lst[i + 1] - lst[i]) > 1):
  5. w.append(lst[i])
  6. w.append(lst[i+1])
  7. print(set(w))
Success #stdin #stdout 0.04s 44680KB
stdin
Standard input is empty
stdout
set([1, 3, 8, 10, 12, 14, 17, 18, 20])