''' Purpose: demonstrate mixed arithmetic ''' # name some values a = 10 # integer x = 5.0 # decimal print() print( 'a =', a ) print( 'x =', x ) print() reply = input( 'Enter when ready: ' ) print() # perform and display some mixed-arithmetic calculations total = a + x difference = a - x product = a * x dec_quotient = a / x int_quotient = a // x remainder = a % x power = a ** x print( 'a + x =', total ) print( 'a - x =', difference ) print( 'a * x =', product ) print( 'a / x =', dec_quotient ) print( 'a // x =', int_quotient ) print( 'a % x =', remainder ) print( 'a ** x =', power ) print() # Mixed Calculations # If you have at least one float number in an operation, it does decimal arithmetic. # float/float = float result # float/int = float result # int/float = float result # int/int = int result # int( x ) converts x to an integer # ex. int(3.4) -> 3 # float( x ) converts x to a decimal # ex. float(3) -> 3.0