Suppose we have two items missing in a sequence of consecutive integers and the missing elements lie between the first and last elements. I did write a code that does accomp
>>> l = [10,11,13,14,15,16,17,18,20] >>> [l[i]+1 for i, j in enumerate(l) if (l+[0])[i+1] - l[i] > 1] [12, 19]