that's my problem:
self.gameField = [
['-', '-', '-', '-', '-', '-', '-']
['-', '-', '-', '-', '-', '-', '-']
['-', '-', '-', '-', '-', '-', '-']
['-', '-', '-', '-', '-', '-', '-']
['-', '-', '-', '-', '-', '-', '-']
['-', '-', '-', '-', '-', '-', '-']
]
As you can see, I've created a matrix using list, I need to change a single element of a column selected by user, so I've tried with this code:
for z in self.gameField:
if z[num] == "-":
z[num] = "X"
print "Done"
Where 'num' is an integer from 0 to 6 to indicate the sub-list. I want to select a colum, and set the lowest ' - ' available (like if there's gravity), so for example, if I select '0'
['-', '-', '-', '-', '-', '-', '-']
['-', '-', '-', '-', '-', '-', '-']
['-', '-', '-', '-', '-', '-', '-']
['-', '-', '-', '-', '-', '-', '-']
['-', '-', '-', '-', '-', '-', '-']
['X', '-', '-', '-', '-', '-', '-']
But actually my program change the value of all the column
['X', '-', '-', '-', '-', '-', '-']
['X', '-', '-', '-', '-', '-', '-']
['X', '-', '-', '-', '-', '-', '-']
['X', '-', '-', '-', '-', '-', '-']
['X', '-', '-', '-', '-', '-', '-']
['X', '-', '-', '-', '-', '-', '-']
How can I fix it? Have you got any ideas to do that?