user7077252 - 7 months ago 36

Python Question

This is my code so far:

`import numpy as np`

board=np.zeros((8,8))

for a in range(7):

row=board[a,0:7]

I want to create a set of this results, named all_rows, but don't know how to do it.

Thank you very much.

Answer

Create a list and append a row to that list each time through your loop:

```
all_rows = []
for a in range(7):
row=board[a,0:7]
all_rows.append(row)
```

Source (Stackoverflow)