if __name__ == '__main__':
    while True:
        entered = input(
            'Please enter your three-letter code or leave a blank line to quit: '
            )
if not entered:
    break
if len(entered) != 3:
    print("%r is NOT three letters, it's %d" % (entered, len(entered)))
continue
if not entered.isalpha():
    print('%r are NOT all letters -- please enter exactly three letters, nothing else!')
continue
process(entered)
How to let a raw_input repeat until I want to quit?