2017-11-25 67 views
-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 
+0

而与替换。 – Frogboxe

+0

你应该看看https://stackoverflow.com/help/how-to-ask –

回答

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

您应该使用if语句

相关问题