Learn first
Programs follow precise instructions
A program is a set of instructions. A variable stores a value. A condition chooses between paths. A loop repeats steps. Output is the result produced.
How to work it out Trace one instruction at a time. Keep a record of values and check exactly when a condition or repeated step is evaluated.
A separate example In a separate trace, start with n = 2, add 3, then double n. The two instructions happen in order: 5 is an intermediate value before the final result.
For this worksheet only, list positions start at 1. SET items TO [4, 7, 2] creates three ordered values. items[2] means the second value. SET items[2] TO 9 replaces that value, not the whole list. Programming languages can use different indexing rules.
Worked example
Initially items[1] is 4 and items[2] is 7. Replacing position 2 with 9 gives [4, 9, 2]. There are still three items.