dict_1 = {1: {2}, 2: {3}, 3: {4}, 4: {11}}
dict_2 = {1: {2}, 2: {1}, 3: {4}, 4: {1,3}}
to get:
dict_1 = {1: {2}, 2: {3,1}, 3: {4}, 4: {11,1,3}}
How would I add the values from dict_2 in dict_1 without deleting the ones already there? I can add them as a list but for some reason, I get the error list unhashable when trying to add them:
to_add = set()
for x in dict_2:
if x in dict_1.keys():
to_add.add(dict_1[x])
to_add.add(dict_2[x])
dict_1[x] = to_add