

def summariseList(lst):
    '\n        Takes a sorted list of numbers, and returns a summary.\n        Eg. [1, 2, 3, 4, 9] -> [(1, 4), 9]\n            [1, 2, 3, 7, 8, 9] -> [(1, 3), (7, 9)]\n    '
    if (len(lst) < 2):
        return lst
    ranges = []
    start = 0
    for i in range(1, len(lst)):
        if ((lst[i] - lst[(i - 1)]) > 1):
            if ((i - 1) == start):
                start = i
                ranges.append(lst[(i - 1)])
            else:
                ranges.append((lst[start], lst[(i - 1)]))
                start = i
    if (lst[start] == lst[i]):
        ranges.append(lst[i])
    else:
        ranges.append((ranges[start], lst[i]))
    return ranges

dataset/ETHPy150Open cortesi/pry/libpry/utils.py summariseList/VarMisuse@174/279 `lst`->`ranges`