I have created a basic python program that is eventually going to try to be usable with Matricies, but I have come up against an issue that I can't understand.
When setting the 0'th
element of the 0'th
list, the program assignes the 0'th
element of the first list to the same value (in this case one)
There is no reason for it to do so, as the program has no imported modules or anything else that should be affecting what I've already written
Please help
class Matrix(object):
def createMatrix(self):
self.values = [1, 2, 3, 4]
self.rows = 2
self.coloms = 2
self.colomList = [0] * self.coloms
self.matrix = [self.colomList] * self.rows
test = Matrix()
test.createMatrix()
print(test.matrix)
test.matrix[0][1] = 1
print(test.matrix)