''' Purpose: relate a cautionary tale -- make sure your expressions do what they are supposed to do ''' # get Celsius temperature c reply = input( 'Enter Celsius temperature: ' ) # We get a celcius temparature from the user, which is stored as a string in reply. # So if we put 12 in the console after prompted for the input, reply is "12" as a string! input() returns a string! # Since reply is a string of the number we entered, we need to convert it to an integer! c = int( reply ) print( ) # compute respectively, f1 and f2, the decimal and integer Fahrenheit equivalents of c f1 = 9 // 5 * c + 32 # This computes 9//5 using integer division! f2 = 9/5 * c + 32 # This computes 9/5 which is normal division which keeps the decimals f3 = ( 9 * c ) // 5 + 32 # 9 * c // 5 is the integer division of (9*c) divided by 5 # display results print( c, 'C =', f1, 'F' ) print( ) print( c, 'C =', f2, 'F' ) # Integer division gives you the quotient as an integer! So it divides it and chops off the decimals. # Keep in mind what KIND of division we want and what type of division will yield a particular integer or decimal product # on your homework assignments!