There are two dictionaries (d1
and d2
) formed after combining list values. I have to subtract the values (d2-d1
) and print the dictionary.
d1 = {'Rash': '80000000', 'Kil': '80000020', 'Varsha': '80000020', 'sam': '80010000'}
d2 = {'Varsha': '8000ffe0', 'sam': '80014000', 'Kil': '8000ffe0', 'Rash': '801fffff'}
d3 = {key: d2[key] - d1.get(key, 0) for key in d2}
print(d3)
This is not working as it is giving type error:
TypeError: unsupported operand type(s) for -: 'str' and 'str'