''' Purpose: demonstrate arithmetic and use of variables for naming things ''' # name some values a = 13 b = 5 print( "a =", a ) print( "b =", b ) input() # The program will not continue until you give it some information and press enter # display some integer calculations print( 'Integer arithmetic' ) # We don't normally put arithmetic in print statements so we put them in variables total = a + b difference = a - b product = a * b dec_quotient = a / b int_quotient = a // b remainder = a % b power = a ** b print( 'a + b =', total ) print( 'a - b =', difference ) print( 'a * b =', product ) print( 'a / b =', dec_quotient ) print( 'a // b =', int_quotient ) print( 'a % b =', remainder ) print( 'a ** b =', power ) # We need to name things so that we can use them over an over again. input() # introduce some other built-in functions print( 'Some handy functions' ) c = -10 d = 1.75 e = -1.75 print( "c =", c ) print( "d =", d ) print( "e =", e ) input() abs_c = abs( c ) #Give back the absolute value float_c = float( c ) # Gives back a decimal version of a number int_d = int( d ) # Gives back a integer version of a number print( 'abs( c ) =', abs_c ) # You can format print statements, but you probably won't need to in this class. You can google it. print( 'float( c ) =', float_c ) print( 'int( d ) =', int_d ) print()