Discuss / Python / 鄙人的接地气答案

鄙人的接地气答案

Topic source

winner丶John

#1 Created at ... [Delete] [Delete and Lock User]

row = [1]

    while True:

        yield row[:]

        lastRow = row[:]

        row.append(1)

        index = 1

        if len(row) >= 3:

            for n in row:

                if index == len(row) - 1:

                    pass

                else:

                    row[index] = lastRow[index -1] + lastRow[index]

                    index +=1


  • 1

Reply