I am trying to delete an item from a list in a for loop but as the first item gets removed the list goes out of range to be deleted from. I have tried a few different ways of getting around it, but none of them worked. Here is the original code:
availibleMoves = ["TL", "TM", "TR", "CL", "CM", "CR", "BL", "BM", "BR"]
while True:
print("Please enter the current state of the board in 1D, current move is", move)
current_board = input("> ")
board_list = list(current_board)
if len(board_list) != 9:
print("Please enter the correct value\n\n")
else:
for i in range(0, 9):
if board_list[i] == "0":
pass
else:
del availibleMoves[i]
print(availibleMoves)
break
Any help is appreciated, thanks, sorry if this question is bad but I am in year 10 doing computer science GCSE and this is just a project for fun.
Edit: an example of what I typed in as an input was
100000001