Values & References8 / 18
Up next

Mutable vs immutable

nums = [1, 2]
before = id(nums)
# mutating keeps the same object
nums.append(3)
print(id(nums) == before)
n = 10
before = id(n)
# "changing" an int actually rebinds to a new object
n += 1
print(id(n) == before)
What you're solving

lists change in place; ints and strings do not