M&C2: When assigning the value of one variable to another, students may invert the order. Is it A=B or B=A?

When assigning the value of one variable to another, students may invert the order. Is it A=B or B=A?

Many students get comfortable with assignment statements written in the form <variable_name> = <data_value> after a few attempts. It becomes more difficult for students when they have variables on both sides. Some students will write the variables in the opposite order because commutatively, both statements make sense.

To help a student to eliminate this issue, stress the substitution process. Exercises in which the students need to “solve” programming statements involving assignment are good practice. It is also helpful to include reminders on the classroom walls of the format of assignment statements and the nature of solving on the right and assigning to the left. Video Length: 3:17

Python Example:

a = 3

b = 6

b = a

a = 10

print 'The value of b is', b