好的,出于某种原因,我的For循环将返回我调用-1的所有项目。
实施例
global keep
global hand
global next_hand
for choice in hand:
if keep == choice:
next_hand.append(keep)
hand.remove(keep)
if len(next_hand) == 0:
print("No dice match that value")
else:
print("I found some dice!")
我得到的结果是[3, 3]
和[3,1,4]
为什么不拿起最后3个?