我试图让 3 个 while 循环无限期地运行,但是现在当 while player == 2 循环结束时,由于函数,变量 player = 0,但循环不会回到第一个 while 循环。
def nextplayer():
global player
if player == 0:
player = 1
elif player ==1:
player = 2
elif player == 2:
player = 0
while player == 0:
print('Player 1 turn')
spinwheel()
nextplayer()
while player == 1:
print('Player 2 turn')
spinwheel()
nextplayer()
while player == 2:
print('Player 3 turn')
spinwheel()
nextplayer()