code 123456789101112131415 def (n): x = [1] i = 1 y = list.copy(x) while i <= n: yield y if i != 1: j = 1 while j < i: y[j] = x[j-1] + x[j] j += 1 y.append(1) x = list.copy(y) i += 1 result 12345 [1][1, 1][1, 2, 1][1, 3, 3, 1][1, 4, 6, 4, 1] 赞微海报分享
近期评论