When you created the initial zero-matrix:
resultmat = (h+1) * [(l+1) * [0]]
This creates a list of lists of zeros. But, the lists of zeros (the rows) are all a reference to the same list. When you change one, it changes all the others:
>>> l = 3*[3*[0]]
>>> l
[[0, 0, 0], [0, 0, 0], [0, 0, 0]]
>>> l[0][0] = 1
>>> l
[[1, 0, 0], [1, 0, 0], [1, 0, 0]]
>>>
When I changed the first list to contain a 1, all the lists now contain the 1 because they're all actually the same list.
While Patrick's answer is correct, here is a slightly more readable version of your code, which accomplishes what you want. It creates a matrix for which every cell is the sum of the two indices, and then zeros the first row and the first column.
from pprint import pprint
def create_matrix(height, length):
matrix = [ [ i + j for j in range(length) ] for i in range(height) ]
matrix[0] = length*[0] # zero the first row
for row in matrix:
row[0] = 0 # zero the first column
return matrix
pprint(create_matrix(10, 11))
Output:
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
[0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
[0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
[0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
[0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
[0, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17],
[0, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18],
[0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]]