I'm relatively new to python, and I can't figure out how to do this. I need to take a number input from a user, then turn that into an already existing variable. So far, I've managed to take the input, but I don't think I can make it into a variable. I am trying to turn this said input (number) to be added onto the back of a string (the string is pos)
So, for example, If I entered the number 1, i would have pos1, 2 would be pos2, so on.
if win == 0:
displayboard()
newPlot = input("")
postochange = "pos"+newPlot
if postochange == "X" or "O":
print ("Sorry, but that space is taken!")
else:
if playerTurn == 1:
postochange = "X"
else:
postochange = "O"
I'll try to simplify this some more, I want to have the user give me a number, that I add to the text "pos" and that corresponds to a variable that I already have.
posttochange = "pos"+str(newPlot)