I am not able to print('player 1 is x'). what am I doing wrong.
def marker():
mark = ''
while mark != 'x' and mark != "o":
mark = input('select x or o:')
if mark == 'x':
print("player 1 is x")
I am not able to print('player 1 is x'). what am I doing wrong.
def marker():
mark = ''
while mark != 'x' and mark != "o":
mark = input('select x or o:')
if mark == 'x':
print("player 1 is x")
This works on my end. Are you running this with a Python 3 interpreter?
If you are running it with Python 2.7, input()
you will need to put quotes around your string input, due to eval()
being called on the input, behind the scenes. Otherwise, it will interpret your input as a name. See here for more.
With Python 2.7:
select x or o:"x"
player 1 is x
With Python 3:
select x or o:x
player 1 is x
Just to cover all bases, you are calling this marker
function later, correct?
def marker():
mark = ''
while mark != 'x' and mark != "o":
mark = input('select x or o:')
if mark == 'x':
print("player 1 is x")
marker() # <---
Is it throwing you any error ?, I ran on my local machine with Python 3.7 interpreter and it works fine after calling the method marker().