board = ['b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b']
for item in board:
if item == 'b':
item = 'a'
print(board)
The result of this block of code is that none of the list items turn to 'a'. I cant seem to figure out why that is. I can still do a for loop where I use an index value to change each item in the list like such.
board = ['b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b']
for i in range(0, len(board)):
if board[i] == 'b':
board[i] = 'a'
print(board)
I don't understand why the first solution dosent work