Q:

Making Matrices without a library / Inserting nested lists without anything being in a list

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.

A:

It is bound to fail:
a = []
# ...
for j in range(0, m):
    a[j].append([])  # a is empty, so a[j] must fail!

Try instead:
a = []
n = int(input('Length of the row'))
m = int(input('Length of the column'))
for i in range(m):  # m is len of outer list: number of rows == len of column
    a.append([])
    for j in range(n):  # n is len of inner list (those are the rows)
        a[i].append(int(input()))  
        # append as well, as indexes to fill do not exist yet

# the loop could be written as a comprehension:
a = [[int(input()) for _ in range(n)] for _ in range(m)]

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

