Python TypeError: Das Objekt „function“ kann nicht abonniert werdenPython

Python-Programme
Anonymous
 Python TypeError: Das Objekt „function“ kann nicht abonniert werden

Post by Anonymous »

Was bedeutet der Fehler und wo ist der Fehler?
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])
hier ist die Funktion get_the_valid_locations:

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]
ist ein int (ich habe es überprüft).
Wenn Sie mehr Code benötigen, fragen Sie einfach in den Kommentaren danach!

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post