''' Purpose: introduce variable usage, assignment and hand-checking of code. ''' n = 17 print( "n =", n ) s = 2 * n print( "s =", s ) t = s + 4 print( "t =", t ) u = t // 2 print( "u =", u ) u = 1 print( "u =", u ) # u is 1 v = u - n # 1 - 17 = -16 print( "v =", v ) u = -5 print( "u =", u ) print( "v =", v ) a = v print( "a =", a ) # v = u - n had a value (1-17 = -16) # the value of v doesn't change if u / n get changed unless you reassign v after u is changed # v is currently - 16 # u = 5 # u gets changed but v isn't! u = 5 and v = -16 at this point # unless we do # v = u - n # AGAIN because now we have a different value for u! 5 - 17 = -12 # now v = -12 # The value for v is NOW changed since we reassigned it! # IMPORTANT # So variables retain the last value we assigned them! # The value of variables change if we reassign them! # THIS WILL NOT WORK: # z = x + y # You need to define/assign your variables before you use them in expressions! # x = 2 # y = 4