0
這段代碼來自我製作的tic tac toe遊戲。我必須將一個值插入列表中的子列表中。這是我的嘗試,但它不起作用(Python 3.5.1)。是否可以使用insert()
將值插入子列表中,如果是這樣,您如何執行此操作?將值插入列表中的子列表。 PYTHON
game_board_lst = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
play1_row = int(input("Player 1: What row? "))
play1_col = int(input("Player 1: What column? "))
game_board_lst.insert((play1_row - 1)(play1_col - 1), 1)