【发布时间】:2018-12-24 11:12:50
【问题描述】:
我尝试了几种方法,但似乎都不适合我。
board = [[0,0,0,0],[0,0,0,0]]
if not 0 in board:
# the board is "full"
然后我尝试了:
if not 0 in board[0] or not 0 in board[1]:
# the board is "full"
这些方法都不起作用,尽管第二种方法通常会让数组填满更多。 (我写了代码来随机填充数组)。
【问题讨论】:
-
你所说的“没有工作”到底是什么意思?
-
# the board is full(因为没有更好的词)在错误的时间运行。
标签: python arrays python-3.x list