''' Purpose: introduce variable usage, assignment and hand-checking of code. ''' n = 3 # memory is reserved for variable n. the memory is set to 3 print( "n =", n ) # a string and the value of a variable are printed s = 2 * n # memory is reserved for variable s. the memory is set # to product of 2 and the value currently stored for in # variable n (3). 2 * 3 equals 6, so s is set to 6 print( "s =", s ) # a string and the value of a variable are printed t = s + 4 # memory is reserved for variable s. the memory is set # to sum of the value currently stored for variable # s (6) and 4. 6 + 4 equals 10, so t is set to 10 print( "t =", t ) # a string and the value of a variable are printed u = t // 2 # memory is reserved for variable u. the memory is set # to integer quotient of the value currently stored for # variable t (10) divided by 2. 10 // 2 equals 5, so u # is set to 5 print( "u =", u ) # a string and the value of a variable are printed v = u - n # memory is reserved for variable v. the memory is set # to produce the difference of the values currently stored # for variable u (5) and n (3) 5 - 3 equals 2, so v # is set to 2 print( "v =", v ) # a string and the value of a variable are printed u = -5 # there is already memory set aside for u. so that # the memory is now set to 5. the assignment only updates # u. so none of the memory for the other variables # is changed. print( "u =", u ) # a string and the value of a variable are printed print( "v =", v ) # because v is unaffected by the assignment to u, v's # value of 2 is printed.