''' Purpose: introduce decision making ''' # determine chrysanthemum color given an input soil pH level # acidic soil produces pink chrysanthemums # non-acidic soil produces blue chrysanthemums # acidity threshold ACIDIC_THRESHOLD = 7.0 # samples less than threshold are acidic # get soil pH level of interst reply = input( 'Enter soil pH level: ' ) pH = float( reply ) print( ) # analyze and report effect on chrysanthemums # if acidic print 'pink'; otherwise print 'blue' # keyword if followed by test expression in parentheses and then by a colon. # if the first test expression evaluates to true the indented code is executed #color = 'blue' if ( pH < ACIDIC_THRESHOLD ): color = 'pink' #print ( 'pink') You can have multiple lines of code underneath and if # if the first test expression evaluates to false and the in the elif test expression evals to true # the indented code below the elif is executed elif ( pH == ACIDIC_THRESHOLD ): color = 'purple' #elif (pH > ACIDIC_THRESHOLD): # This works but can lead to missed possibilities # color = 'blue' # if both test expressions evaluate to false the indented code below the else is executed else: # pH greater than 7.0 color = 'blue' # Note: the pattern is if, elif, else; the if must come first and the else must come last # elif allows for a series of possibilities; print( color ) # all done