''' Purpose: relate a cautionary tale -- make sure your expressions do what they are supposed to do ''' # Convert from celsius to farenheit # (9//5)*C + 32 # get Celsius temperature c reply = input( 'Enter Celsius temperature: ' ) c = int( reply ) print( ) # compute respectively, f1 and f2, the decimal and integer Fahrenheit equivalents of c f1 = ( 9//5 ) * c + 32 # f2 is the clearest form for our equation f2 = ( ( 9 * c ) // 5 ) + 32 # PEMDAS - python has "operator precedence" # it computes multiplication and division before addition and subtraction # reads left to right within the same type f1 = 9 * c // 5 + 32 f1 = 32 + 9 * c // 5 # display results print( c, 'C =', f1, 'F' ) print( ) print( c, 'C =', f2, 'F' )