I have some code where I want the inputted position to be replaced with the desired string but I can't find a way for it to happen from input.
pos1 = ("_")
pos2 = ("_")
pos3 = ("_")
pos4 = ("_")
pos5 = ("_")
pos6 = ("_")
pos7 = ("_")
pos8 = ("_")
pos9 = ("_")
def board():
print(pos1,pos2,pos3)
print(pos4,pos5,pos6)
print(pos5,pos6,pos9)
while True:
board()
print("player one you are x\n")
choice = input("player one enter a position.")
choice = ("x")
I want to have the position that they choose replace the original variable. For example if the user inputs pos1
then the value of pos1
becomes "x"
.