''' Purpose: demonstrate decimal arithmetic Things to remember: Arithmetic operations involving decimals ALWAYS produce decimal values!!! Python represents a decimal number as a float ''' # PYTHON NUMBER TYPES # 3 (int) # 3.0 (float / decimal) # name some values x = 15.0 # float y = 6.25 # float print() print( 'Values of interest' ) print() print( 'x =', x ) print( 'y =', y ) print() reply = input( 'Enter when ready: ' ) print() # perform amd display some float calculations total = x + y difference = x - y product = x * y dec_quotient = x / y int_quotient = x // y # It will produce the integer result but will be represented as a float since it's float//float remainder = x % y power = x ** y # SNAKE CASE # Style rule for variable naming # variables will multiple words will have _ (underscores) between the words # a_long_variable_name = 2 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() reply = input( 'Enter when ready: ' ) print() # IMPORTANT # int( x ) -> Takes whatever is in the parentheses and convert it to an integer # Chops off decimal portion int_x = int( x ) print( 'int( x ) =', int_x ) # int(3.75) -> 3 # int(0.2) -> 0 # int(-3.7) -> -3 print()