This is an aggravating issue that I've come into whilst programming in python. The user can append various variables to a list however, this list when accessed later on will still display the same results as when first assigned. e.g below
a=1
b=2
list = [a,b] #user defined order
print list # 1,2
a=2
print list # prints 1,2
I need list to print out 2,2. However i cannot find out a way to DYNAMICALLY update the list to accommodate ANY order of the variables (many ways are hard coding which i've seen online such as assigning list = [a,b] when needed to update however i dont know if its b,a or a,b)
Help would be much appreciated. Thank you
Edit : My question is different due to being about varaibles that need to be dynamically updated in a list rather than simply changing a list item.