''' Purpose: demonstrate arithmetic and use of variables for naming things ''' # name some values x = 3.5 y = 4.25 print( "x =", x ) print( "y =", y ) # If one of the operators is a decimal, the result will be decimal. input() # display some float calculations print( 'Float arithmetic' ) # This is all variable assignment! The left are variables and the right are the values. total = x + y difference = x - y product = x * y dec_quotient = x / y int_quotient = x // y remainder = x % y power = x ** y # Remember what we said about variables and identifiers? # In the above section, we have several variables assigned to values of calcuations # so Python knows the values of those variables as identifiers which is why # we can just print( total ) # print( total ) # total is a variable that stores the value of that calculation # print( 'total' ) # this is a string not the variable. print( 'x + y =', total ) print( 'x - y =', difference ) print( 'x * y =', product ) print( 'x / y =', dec_quotient ) print( 'x // y =', int_quotient ) print( 'x % y =', remainder ) print( 'x ** y =', power ) print()