Question: Hello I need to compare 2 dicts but in the result, I need to know from which dict the result came.

```
dict1 = {'name': 'Morgan', 'surename': 'Finch'}
dict2 = {'name': 'David', 'surename': 'Finch'}

```

so if I compare with `input_data.items() ^ response_data.items()` result will something like this:

```
{('name','Morgan'),('name', 'David)}

```

expected result should look something like `{'dict1': ('name','Morgan'), dict2: ('name', 'David')}`
I don't care what data-structure just that I could know from what dict it came.

Answer: 
```
dict1 = {'name': 'Morgan', 'surname': 'Finch'}
dict2 = {'name': 'David', 'surname': 'Finch'}

# symmetric difference (exclusive OR)
print(dict1.items() ^ dict2.items())
# {('name', 'Morgan'), ('name', 'David')}

# dictionary subtraction
print({'dict1': dict1.items() - dict2.items(), 'dict2': dict2.items() - dict1.items()})
# {'dict1': {('name', 'Morgan')} 'dict2': {('name', 'David')}}

```
If you want the answer in the form of dictionary

You can use these steps

```
dict1 = {'name': 'Morgan', 'surename': 'Finch'}
dict2 = {'name': 'David', 'surename': 'Finch'}

dict3 = {}

for k,v in dict1.items():
    if dict1[k] != dict2[k]:
        dict3['dict1'] = (k,dict1[k])
        dict3['dict2'] = (k,dict2[k])

print(dict3)

```

Output:

```
{'dict1': ('name', 'Morgan'), 'dict2': ('name', 'David')}

```

Edit:
-----

If all values are different and want to store in a single key like `{'dict1' : ('name', 'Morgan', 'surname', 'Finc'), ... }`

```
dict1 = {'name': 'Morgan', 'surename': 'Finch'}
dict2 = {'name': 'David', 'surename': 'Finc'}

dict3 = {'dict1':(), 'dict2':()}

for k,v in dict1.items():
    if dict1[k] != dict2[k]:
        dict3['dict1'] += (k,dict1[k])
        dict3['dict2'] += (k,dict2[k])

print(dict3)

```

Output:

```
{'dict1': ('name', 'Morgan', 'surename', 'Finch'), 'dict2': ('name', 'David', 'surename', 'Finc')}

```