I can't get this short piece of code to work. What I am trying to do is ask user to enter a 4 letter word, if they don't then ask them to try again, if they do then to say thanks. I added the while True, try & except part as it looked like the best way to keep looping around but I didn't really get it.
while True:
try:
word=input("Please enter a four letter word: ")
word_length=len(word)
except word_length != 4:
print("That's not a four letter word. Try again: ")
continue
else:
break
if word_length ==4:
print("Thanks")
except. You useexceptto catch an exception thrown by something.