I'm trying to write a loop that checks whether a certain number in lists in a list is not appearing. For example: if I have the list
[[1,'O', 3], [4, 5, 6], [7, 8, 'X']]
I want to write a loop that checks whether number 2 appears in one of the lists, and if not, asks you to pick a new number. So far I'm stuck on this:
move = 2
for i in range(3):
for j in range(3):
if move not in board[i][j]:
move = int(input("Number already taken. Pick another"))
But it doesn't work. It seems to be a fairly straightforward check, but I don't know why it wouldn't run. Does anybody have a better suggestion how to check these lists for a given number?
Cheers