Discuss / Python / 之前不知道可以直接加号连接list,学到了

之前不知道可以直接加号连接list,学到了

Topic source
# -*- coding: utf-8 -*-

def triangles():
    L = [1]
    while 1:
        yield L
        L = [0] + L + [0]
        L = [L[i] + L[i + 1] for i in range(len(L) - 1)]

祥子920

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

优秀

Pooki201

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

优秀啊

张小黑900

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

厉害厉害

WeissP

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

原来还有这种操作,感觉自己智商被完爆了。(扶额

老哥6啊

Young_TZ

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

nb

厉害厉害。

牛了~

Cccc-彩

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

有谁解释下吗?有点懵


  • 1
  • 2

Reply