Lists, indexes, and copies

What does a contain after the last line?

Examples

Worked example

Input
a = [1, 2]; b = a; b.append(3)
Expected output
[1, 2, 3]

Hints and solution

Hint 1

Write down the starting state and walk through one example by hand.

Reveal worked answer

Both names refer to the same list. The append changes that one list.

Back to the lesson