So, I try to create a program that use a board created with lists inside a list :
[[0,0,0,...,L], [0,0,0,...,L], [0,0,0,...,L], [0,0,0,...,L],...,H]]
Example with x = 4 and y = 2 ( x = H, y = L ) :
>> [[0,0,0,0],[0,0,0,0]]
My code is :
...
#>> Initialistation
board = []
temp = []
H = int(input('height : '))
L = int(input('lenght : '))
for i in range(0,L):
temp.append('0')
for j in range(0,H):
board.append(temp)
temp_x = int(input('x :'))
temp_y = int(input('y :'))
board[temp_y[temp_x]] = 'f' # line 29
print(board)
Basically, I would add value in my board, but anything I've tried not working as I would :
My Result:
# with the example above
board[0][1] = 'f'
>> [[0,0,'f',0],[0,0,'f',0]
Excpected Result:
# with the example above
board[0][1] = 'f'
>> [[0,0,0,0],[0,0,'f',0]
What i have tried:
board[[0][1]] = 'f'
>> IndexError (line 29): list index out of range
board([0][1]) = 'f'
>> SynthaxError (line 29) : can't assign function call
board[p0[1]] = 'f'
>> TypeError (line 29): 'int' object is not subscriptable
The problem is that 'f' is write in the board each line and not only the expected one So How can I get the expected result ?