Looks like you are trying to index an uninitialized array. You just have to first initialize the outer list with lists before adding items; Python calls this "list comprehension".
# Creates a list containing 5 lists, each of 8 items, all set to 0
w, h = 8, 5;
Matrix = [[0 for x in range(w)] for y in range(h)]
Now, you can add items to the list like this:
Matrix = 1
Matrix = 3 # error! range...
Matrix = 3 # valid
Note that the matrix is "y" address major, in other words, the "y index" comes before the "x index".
print Matrix # prints 1
x, y = 0, 6
print Matrix[x][y] # prints 3; be careful with indexing!
But, you can name them as per your wish, I look at it this way to avoid some confusion that could arise with the indexing, if you can use "x" for both the inner and outer lists, and want a non-square Matrix.