M&C3: Assignment A = B + 1 changes the value of B by 1, as well as changing A

Assignment A = B + 1 changes the value of B by 1, as well as changing A

To help students adjust to the idea of “state”, it is helpful to use a tool like http://pythontutor.com or the whiteboard to have the values that are currently stored in a variable on display at all times. In doing so, a student will be less likely to misinterpret how a line of code will execute and may provide opportunities for students to ask more questions about why a program behaves in the way that they see on the screen or on the board. Video Length: 0:49

Python Example:

a = 2

b = 5

a = b + 1

print 'The value of a is', a

print 'The value of b is', b