'''lecture_06_assignment.py Show how variable assignment works Oliver W. Layton CS151: Computational Thinking: Visual Media Spring 2021 ''' # x = 10 # cs151 = 5 # myNiceVariableName = 1 # print(x) # print(myNiceVariableName) # another_var_name = 99 # print(another_var_name) # cs151 = 50 # 50 = cs151 # variable name being assigned TO needs to be on the LEFT # cs151 = 50 # x = 9 # print(cs151) # cs151 = -99 # print(cs151) # x = 3 # y = 4 # z = x + y # just like z = 3 + 4 # print(z) # to use variables on the, right you need to assign a value first! # z + x + y + a # print(z) # assigning a variable to another variable a = 1 b = 2 a = b # Now I change b b = 9 # What happens to a and b? print(a) # 9? 2? <- actually is 2, not 9 print(b) # 9! <- checks out! # a started as 1. Assigned it to the value of b (2). Changed b to 9, yet a remains 2. n = 3 cs151 = 'hi!' print(n*cs151) # python replaces values: 3*'hi!' print(m*cs151) # m not in symbol, will not work. Need to define m before using it.