I am trying to make a tic-tac-toe game. I have this code:
row1 = [' ',' ',' ']
row2 = [' ',' ',' ']
row3 = [' ',' ',' ']
x = ""
y = ""
def screen(row1,row2,row3):
print(row1)
print(row2)
print(row3)
def inputter():
x = ""
y = ""
acceptable = [0,1,2]
if x not in acceptable and y not in acceptable:
x = int(input("enter row number:" ))
y = int(input("enter position:" ))
row[x][y] = 'X'
screen(row1,row2,row3)
inputter()
Where it says row[x][y] = 'X'
, I want to make it so that either row1
, row2
or row3
will get updated, depending on the value of x
.
But instead, I get an error that says NameError: name 'row' is not defined
. How can I fix the problem?