【发布时间】:2021-05-21 03:12:19
【问题描述】:
我的代码有问题的部分是:
history = np.array([[0, 0, 1, 1],[1, 0, 0, 1]])
opponentsActions = history[1]
if opponentsActions == [0, 0, 0, 0]:
print("nice")
我得到的错误是:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
【问题讨论】:
-
使用错误消息进行搜索 - 您会发现很多要阅读的内容,可以让您了解问题所在。你可能想要
if (opponentsActions == [0, 0, 0, 0]).all():