''' Purpose: introduce the if-elif-else construct ''' # prompt for one or two words and get the response reply = input( 'Enter one or two words: ' ) # turn response into a list list = reply.split() # get the length of the list n = len( list ) # what are the possibilities for the user response # enters no words # enters one word # enters two words # enters more than two words (i.e., it is not of the prior cases) # output whether they followed directions response = '' # none so far if ( n == 0 ) : # they did not follow directions -- no words were supplied` response = 'You did not enter any words' elif ( n == 1 ) : # they did follow directions by entering one word response = 'Thanks for following directions by entering one word' elif ( n == 2 ) : # they did follow directions by entering two words response = 'Thanks for following directions by entering two words' else : # they did not follow directions -- too many words supplied` response = 'You entered too many words' print( response) # all done