我正在使用 random.choice 选择足球运动员,但出现错误。它在几次迭代后停止。
class footballist(Person):
def choose(self):
teams = ['A', 'B']
countA = 0
countB = 0
for i in range(0, 22):
team = random.choice(teams)
if team == 'A':
countA += 1
else:
countB += 1
name = random.choice(names)
names.remove(name)
print(team, name)
print(countA, countB)
if countA or countB == 11:
teams.remove(team)
else:
pass