<qiyuangong>228_Summary_Ranges_1.py
def summaryRanges( nums):
    if nums is None or len(nums) == 0:
        return []
    res = []
    start, prev, ls = nums[0], nums[0], len(nums)
    for i in range(ls):
        curr = nums[i]
        if curr - prev > 1:
            if start == prev:
                res.append("%d" % start)
            else:
                res.append("%d->%d" % (start, prev))
            start = curr
        prev = curr
    if start == prev:
        res.append("%d" % start)
    else:
        res.append("%d->%d" % (start, prev))
    return res
def sample_funcname ( var_0 ) :
    if var_0 is None or len ( var_0 ) == 0 :
        return [ ]
    var_4 = [ ]
    var_5 , var_6 , var_7 = var_0 [ 0 ] , var_0 [ 0 ] , len ( var_0 )
    for var_9 in range ( var_7 ) :
        var_10 = var_0 [ var_9 ]
        if var_10 - var_6 > 1 :
            if var_5 == var_6 :
                var_4.append ( "%d" % var_5 )
            else :
                var_4.append ( "%d->%d" % ( var_5 , var_6 ) )
            var_5 = var_10
        var_6 = var_10
    if var_5 == var_6 :
        var_4.append ( "%d" % var_5 )
    else :
        var_4.append ( "%d->%d" % ( var_5 , var_6 ) )
    return var_4
