''' 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' if ( pH < ACIDIC_THRESHOLD ): # if the test expression evaluates to True print('pink') # we jump into this action (actions indented # into the if statement # if the tests above it don't evaluate to True then we do this else: # else never has a (logical expression) - it's like a last resort print('blue') # Python can only represent up to about 15 decimal digits. It # will use the closest representation after that to use the number. # Code from Scratch File # So Python's kinda weird because in computers, boolean values # False and True correspond to 0 and 1 respectively. # So if we say if( 0 ) that's always False otherwise its always True # if ( 0 ): # print('huh') # else: # print('uhuh?') # all done