Daily #24 · 22 October 2026
Back of the queue Medium
What does this print?
stock = {"apples": 3, "pears": 5}
del stock["apples"]
stock["apples"] = 4
print(list(stock))
Show the answer
B: ['pears', 'apples']
Why: Dicts remember insertion order. Deleting a key and adding it again puts it at the end, as a new arrival. Changing the value of an existing key does not move it.