im trying to check that the input the user enters is either a single letter or word and not an integer or nothing, if they enter something which isnt valid then they should be kept in the loop until they enter a single letter. this is my code so far but it doesnt seem to be working in the desired way:
animalcount = 0
animal = 0
data = False
while data == False:
try:
letter = str(input("what letter would you like to search for? "))
data = True
except:
print ("please enter a letter, try again.")
if letter == "":
print ("please enter an item,try again!")
data = False
for animal in animallist:
if letter in animal:
print(animal)
animalcount = animalcount + 1
if animalcount == 0:
print ("That letter cannot be found")