I am currently learning python and got stuck at one of the program. Here is the snippet
test_board = ['#','X','O','X','O','X','O','X','O','X']
print(test_board)
def place_marker(board, marker, position):
board[position] = marker
place_marker(test_board, '$', 8)
print(test_board)
The output of above program is
['#', 'X', 'O', 'X', 'O', 'X', 'O', 'X', 'O', 'X']
['#', 'X', 'O', 'X', 'O', 'X', 'O', 'X', '$', 'X']
I am confused that how did the value of variable test_board got updated ? I didn't set the global variable nor I am returning the value. Can someone please help me understand ?