Take the 2-minute tour ×  I'm working on a Hangman game in
Python and I need user validation for the input, which I have
made an attempt at, but I don't know why its not working.  My
task was to have "error" messages for 1. empty input, 2. non-
integer, non-empty input, 3. index out of range input. By index
out of range, I mean that I am asking the user for an integer
from 0-9 to select a word from the list already in the program.
def getLetterFromUser(totalGuesses):    while True:
userInput = input("\nPlease enter the letter you guess:")
if userInput == '' or userInput == ' ':           print("Empty
input.")       elif userInput in totalGuesses:
print("You have already guessed that letter. Try again.")
elif userInput not in 'abcdefghijklmnopqrstuvwxyz':
print("You must enter an alphabetic character.")
return userInput  For clarity's sake, the subsequent call to
getLetterFromUser is in a while loop so that it repeatedly
checks these conditions.  EDIT: I took out