Discuss / Python / 笨方法

笨方法

Topic source

viper1090

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

    result = [1, 1]

    yield [1]

    yield [1, 1]

    while True:

        temp = [1]

        for i, value in enumerate(result):

            if (i > len(result) - 2):

                break

            temp.append(result[i] + result[i + 1])

        temp.append(1)

        yield temp

        result = temp


  • 1

Reply