0

I am new to programming and even newer to python. As part of my assignment i have to create a tik tak toe game. For the input where the program asks the user to choose a character x or o, i chose to go with a while loop which would also serve as a kind of error handling in case the user mistyped the answer. the loop would go until the user hits x or o. I have tried it in various forms but i just con not make it run as i want it. i am working in Jupiter notebook.

def input_player():
    i = input('player1! Please choose your weapon (x or o):  ')
    while i is 'x' or 'o':
        if i != 'x' or 'o':
            print('Please choose the right character X or O')
            input()
            continue
        elif i == 'x' or'o':
            print('Thank You!')
            break

the loop keeps asking me the first question even pressing the right characters. Where did i go wrong? Your help is much appreciated.

roganjosh
  • 12,594
  • 4
  • 29
  • 46
Taffid
  • 1

0 Answers0