I'm trying to write a hang-man game in python 3. I choose a player to enter the secret word and check to ensure there are no numbers, special characters, etc.. What i want to be able to do is give the other player the chance to pick the word if the current player tries to break these rules. Then i want that to keep alternating until someone enters a word that meets the criteria. What I have now...
word_to_guess = input(First_player + " has been randomly chosen to pick a word! Please type it in now with no numbers, spaces or special characters: ").lower()
while True:
if word_to_guess.isalpha():
break
word_to_guess = input("OK, " + Second_player + ", since " + First_player + " can't follow the rules, you try it. Again, no numbers, spaces or special characters: ").lower()
So if the first player gets it, we move on, if the first player fails and the second player gets it, we move on, but if they both fail, the code as written will just keep giving player 2 the choice of word. I essentially just want to alternate the position of the "First_player" and "Second_player" variable locations in that last statement, with each repetition. Any ideas?