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
Using collections.Counter:
from collections import Counter dic = Counter([10, 11, 13, 14, 15, 16, 17, 18, 20]) print([i for i in range(10, 20) if dic[i] == 0])
Output:
[12, 19]