# Is there a way to add an amount of lists, and append that to a list? [closed]

Basically, i want a list, which contains an increasing number of lists, (which I’ve now getten the answer to):

```l = []
for i in range(3):
l.extend([[i] for _ in range(i+1)])
print(l)
```

output: [, , , , , ]

But i want to ‘group’ the numbers together, so the output is: [[], [, ], [, , ]]

Now that you’ve provided a clear example of your desired output,

```In : top = 1  # starting number

In : num_rows = 4

In : [[[top + i] for _ in range(i + 1)] for i in range(num_rows)]
Out: [[], [, ], [, , ], [, , , ]]
```

Your three different example outputs all seem to contradict each other in various ways, and as such your question is very confusing, hence the vastly different results produced by the current answers.

```In : top = 4  # starting number, at the top of the pyramid

In : num_rows = 5

In : pyramid = [[(top + i) for _ in range(i + 1)] for i in range(num_rows)]

In : pyramid
Out:
[, [5, 5], [6, 6, 6], [7, 7, 7, 7], [8, 8, 8, 8, 8]]

In : for row in pyramid:
...:     print(*row)
...:
4
5 5
6 6 6
7 7 7 7
8 8 8 8 8
```

If also want to print them centered:

```In : width = 2 * num_rows - 1

In : print("n".join(" ".join(map(str, row)).center(width) for row in pyramid))
4
5 5
6 6 6
7 7 7 7
8 8 8 8 8
```