But you can see there is no function in last line of code at all:
SizeDiffE(k) = j
Try a
print type(SizeDiffE)
to see what it is. Also, if SizeDiffE(k) is not passing 'k' to the function SizeDiffE() then what is it doing. If it is a tuple, then it can't be modified. If it is a list then use
SizeDiffE[k] = j
It is difficult to tell with just this snippet of the program, so post some code on what these variables do as well. Also, comment the last line to confirm that it is the error. It may be printing the error after the last line, but referring to a previous line.