Discuss / Python / practice

practice

Topic source
def triangles(max):    i = 1    L = [1]    while i < max:        length = len(L)        if len == 1:            L = [1, 1]            yield L        R = [1]        lastValue = 1        for x in L[1:length]:            R.append(lastValue + x)            lastValue = x        R.append(1)        yield R        L = R        i += 1
def triangles(max):    i = 1    L = [1]    while i < max:        length = len(L)        if len == 1:            L = [1, 1]            yield L        R = [1]        lastValue = 1        for x in L[1:length]:            R.append(lastValue + x)            lastValue = x        R.append(1)        yield R        L = R        i += 1

  • 1

Reply