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)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)Hidden in mobile, Best for skyscrapers.