''' Purpose: quick refresher on Boolean calculations ''' # determine whether its input pH level is acidic; i.e., less than 7.0 # non-acidic: >= 7.0 # acidity limit ACIDIC_THRESHOLD = 7.0 # samples less than threshold are acidic # get pH level of interest reply = input( 'Enter pH level: ' ) pH = float( reply ) # we want a decimal because the problem asks for a more precise pH instead of just ints print( ) # determine whether sample is acidic is_acidic = ( pH < ACIDIC_THRESHOLD ) # compare the input to our ACIDIC_THRESHOLD # () helps you order things in the way you want to calculate things # you can have more than one operators in an expression, we'll get there # sometimes, you want to do some operations first before others that's not left to right # you don't need () if there's only one logical operation # we're using () so we can organize our expression better and helps you prepare for other languages # if pH is less than 7.0, then is_acidic = True because it is a True relationship # if pH is greater than or equal to 7.0, then is_acidic = False, because the relationship is False # when we have variables that hold a boolean truth value, we tend to have a verb in front of the name # like is_acidic, has_something... # other operators include # greater than ( > ), # greater or equal to ( >= ), # less than ( < ), # less or equal to ( <= ), # equal to ( == ) # also give us back boolean truth values # print result print( 'is_acidic =', is_acidic ) # all done