*I am trying to input and then print a matrix in Python without a library.*

### Code:

```
a = []
n = int(input('Length of the row'))
m = int(input('Length of the column'))
for j in range(0, m):
    a[j].append([])
for i in range(0, n):
    for j in range(0, m):
        a[i][j] = int(input())

for i in range(0, n):
    print()
    for j in range(0, m):
        print(a[i][j], end=" ")

```

### Working:

When I put my list to be let's say:

```
a = [[1,1,1],[1,1,1],[1,1,1]]

```

And put both *m* and *n* to be ***3***, It works exactly as it should.

### Error:

But having only an empty list, as in the code example, I always get an error that list index is out of range.

```
a[j].append([]) IndexError: list index out of range

```

### Problem:

I don't know how to input nested lists inside a list, and integers inside those nested lists, with a loop, or with anything for that matter.