code: def ranges_to_set(lst):
      
      return set(itertools.chain(*(range(x[0], x[1]+1) for x in lst)))
docs: Convert a list of ranges to a set of numbers::
  
      >>> ranges = [(1,3), (5,6)]
      >>> sorted(list(ranges_to_set(ranges)))
      [1, 2, 3, 5, 6]