I have a very specific question to how python assigns values and how they change in the process. I don't understand when variables change when you try to use them in other objects. As an example:
mylist = ['a', 'b', 'c']
mydict = {}
mydict['list'] = mylist
mylist = ['a']
Here the values inside mydict do not change
mylist = ['a', 'b', 'c']
mydict = {}
mydict['list'] = mylist
mylist.append('d')
Here the values inside mydict DO change
What's the difference here and how do I, as best practice, avoid to change values when I don't want them to change. This got me in a lot of trouble in a last project, since I didn't know why sometimes the values were not what I expected them to be.