I don't know why I never thought of this before... but I'm wondering if there's a neater/shorter/more efficient manner of error handling a user input. For example, if I ask the user to enter either "hello" or "goodbye", and they type something else, I need it to tell the user it's wrong and ask again.
For all of coding I've ever done, this is how I've done it (typically the question is better):
choice = raw_input("hello, goodbye, hey, or laters? ")
while choice not in ("hello","goodbye","hey","laters"):
print "You typed something wrong!"
choice = raw_input("hello,goodbye,hey,or laters? ")
Is there a smarter way of doing this? Or should I just stick with how I've had it? This is the method I use for all languages I've written in.