I am trying to check for equality to see if a dictionary has been changed before doing an action but it overwrites the variable somewhere and always stays the same.
I have tried moving the point in which dict_to_quit is being created to see if I could get it to stay out of the modifications.
dict[key] = value #dictionary was created from file
file.close()
dict_for_quit = dict # copy of dict to match against if modified
while (True):
if (choice == "1"):
# adds to dict
break
elif (choice == "2"):
# deletes from dict
break
elif(choice == "3"):
if dict_for_quit == dict:
print("same")
else:
print("not same"
Happy Path: dict is copied to dict_for_quit at the beginning. User runs through some options for dict(adds, deletes). Then when user selects a certain option, program checks dict_for_quit against dict to see if there was modifications.
Errors: Program is modifying dict_to_quit whenever someone makes a change to dict even though it's out of the loop the modifications are being made