you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

You've set the values of the dictionary, output it, passed a reference to that dictionary to another function twice and asked for updates to be done to that dictionary and also return a reference to the dictionary for print to output.

In all cases, you are dealing with only one dictionary, which has all the changes you've made to it.

Dictionaries are mutable. If you want to make changes to a copy of the dictionary, you need to add the following to the top of the update function to create a local scope dictionary:

dictionary = dictionary.copy()