two dimensional array python

# Creates a list containing 5 lists, each of 8 items, all set to 0
w, h = 8, 5;
Matrix = [[0 for y in range(h)] for x in range(w)] 

Matrix[0][0] = 1
Matrix[0][6] = 3 # error! range... 
Matrix[6][0] = 3 # valid

Here is what the above code is Doing:
1. It creates a list of 5 lists, each of 8 items, all set to 0.
2. It sets the first item in the first list to 1.
3. It sets the seventh item in the first list to 3.
4. It sets the first item in the seventh list to 3.

The first item in the first list is valid, but the seventh item in the first list is not. This is because the range of items in a list is from 0 to 7, not 1 to 8.

To fix this, you need to change the seventh item in the first list from 3 to 2.