Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
not list of tuple but test is ok solution in Clear category for Create Intervals (generator version) by Oleg_Domokeev
def create_intervals(data):
if not data:
return []
data = sorted(data)
left = data[0]
for i in range(len(data)):
if i + 1 == len(data):
yield left, data[i]
elif data[i+1] - data[i] > 1:
yield left, data[i]
left = data[i+1]
Sept. 4, 2018