Invalid Choice

[Back] <- - + - -> [Next]

If the user's choice is not one of the valid ones then the choice must be invalid.
The else statement applies if none of the previous tests resulted in True.
# previous code
if option == 'a':
    print 'You selected "a"'
elif option == 'b':
    print 'You selected "b"'
elif option == 'c':
    print 'You selected "c"'
else:                                     ### Note that else has no test of its own.
    print 'Invalid choice - try again'

Running the code produces this output:

Enter your choice: g
Invalid choice - try again
   
Enter some invalid input,
for example, g.
A suitable message is displayed.

Currently the only way to try again is to re-start the program.