I made a function that would ask a player to enter a letter until the letter was X, x, O or o.
But, whenever i call the function , somehow the while loop evaluates to False and never starts executing. What might be the problem ? Thank you very much.
def getLetter():
letter = ""
while letter not in "XxOo":
print("Would you like to be X or O ?")
letter = input()
The empty string is member of all strings. Just try it in the Python prompt:
You can initialise
letterto some thing you know is not among the choices, for example<not chosen yet>, instead of the empty string.