I have this code
DATA = [
{"Value":0}
]
dicDATA = {"Value":0}
var = 0
#in some function...
print("Insert a value:")
var = int(input())
dicDATA["Value"] = var
DATA.append(dicDATA)
for i in DATA:
print(i["Value"])
If i insert a value 2 ,I expect the output to be 2 and it's ok but if i insert another value 5 , I expect the output of:
2
5
But the actual output is:
5
5
The value gets overwritten