I'm new to python and I tried to store integer values in a 2 dimensional list using loops(I use this logic in C for getting input for matrix). When I run this code, it shows IndexError: list assignment index out of range. What caused this error? Code to print numbers from 1-9 in matrix form:
num=1
a=[[]]
for i in range(0,3):
for j in range(0,3):
a[i][j]=num
++num
for i in range(0,3):
for j in range(0,3):
print(a[i][j]+" ")
print("\n")