Ich habe den TypeError: 'function' object is not subscriptable für die folgende Zeile erhalten:
Code: Select all
row = random.choice(get_the_valid_locations[-2])
Code: Select all
def get_the_valid_locations(board):
valid_locations = []
for col in range(COLS_OF_BOARD):
for row in range(ROWS_OF_BOARD):
if available_square(board, row, col):
valid_locations.extend([row, col])
return valid_locations
Code: Select all
get_the_valid_locations[-2]
Wenn Sie mehr Code benötigen, fragen Sie einfach in den Kommentaren danach!