-4
beginner alert。這是我的tictactoe代碼,當我試圖檢查播放器是否輸入可播放值(1-9)時,我找不到問題。感謝幫助。使用while來檢查輸入是否在範圍python3
# the player now inserts input (coordinates of the field where he want his symbol written)
print('Player', p, ', go! Enter the position that you want to play.')
i = input()
i = int(i) - 1
while i in range(10,99):
print('entered number does not match any position in the game, try again')
break
else:
pass
而與替換。 – Frogboxe
你應該看看https://stackoverflow.com/help/how-to-ask –