""" Purpose: relate a cautionary tale -- make sure your expressions do what they are supposed to do """ # get Celsius temperature c as an integer reply = input( 'Enter Celsius temperature: ' ) c = int( reply ) # compute respectively, f1 and f2, the decimal and integer Fahrenheit equivalents of c f1 = ( 9/5 * c ) + 32 # decimal temperature # python follows PEMDAS, generally - operator precedence # multiplication and division are done in one step from left to right f2 = ( 9 * c ) // 5 + 32 # int(f1) would work, but decimal arithmetic is less precise than integer arithmetic # 9//5 * c + 32 this doesn't work, because 9//5 = 1 # if your output doesn't look correct, look at order of operations and integer division # arithmetic style guidelines - add spaces separating multiplication/division from addition/subtraction # display results print( ) print( c, 'C =', f1, 'F' ) print( ) print( c, 'C =', f2, 'F' )