For循环返回实际项目的-1

时间:2017-01-20 19:21:58

标签: python for-loop

好的,出于某种原因,我的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个?

0 个答案:

没有答案