2017-11-25 6 views
-4

初心者アラート。これは私の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 
+0

は、しばらくの間に置き換えて使用する必要があります。 – Frogboxe

+0

https://stackoverflow.com/help/how-to-askをご覧ください。 –

答えて

0
if i not in range(1,10): 
    print("Invalid entry") 

あなたはif文

関連する問題