Handle Option

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

Use if to print an appropriate message depending on the user's input.
This would normally be replaced by code to do a particular action.
# previous code
print
option = raw_input('Enter your choice: ')
if option == 'a':                           ### A double = is used to test for equality.
    print 'You selected "a"'                ### Note the : (colon) on the if line.
                                            ### The line after the : is indented 4 spaces.

Running the code produces this output:
a AAA
b BBB
c CCC

Enter your choice: a
You selected "a"
   
 

Currently, a message is only displayed if 'a' is selected.