Why is my dictionary not updating inside a loop in Python?

2 days ago 12
ARTICLE AD BOX

I'm trying to update a dictionary inside a loop, but the values don't change the way I expect.

data = {} numbers = [1, 2, 3, 4] for n in numbers: value = n * 2 data['result'] = value print(data)
Read Entire Article