I am having a problem with my try and except in python, so basically everytime a person types a letter the whole program will crash and I can not find a way to fix this error using try and except. TypeError: list indices must be integers or slices, not str
def add(user_A, user_B):
if board[user_A] == 0:
board[0] = 'X'
elif board[user_B] == 0:
board[0] = "O"
else :
print("Retry..")
def game():
user_A = ""
user_B = ""
game = False
while game != True:
try:
show()
user_A = int(input("\n'X' it is your turn: "))
game = True
except Exception as e:
time.sleep(1)
print(e)
add(user_A, user_B)
