Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
try: first, *data = sorted(data) solution in Clear category for Create Intervals (iterator version) by flpo
def create_intervals(data):
try: first, *data = sorted(data)
except ValueError: return
last = first
for current in data:
if last + 1 < current:
yield first, last
first = current
last = current
yield first, last
Sept. 6, 2018