I'm trying to do a division operation between two dict
and I'm always getting an int
result, but I expected a float
.
Here is what is going on:
test_dict1 = {'gfg': 20, 'is': 24, 'best': 30}
test_dict2 = {'gfg': 7, 'is': 7, 'best': 7}
res = {key: test_dict1[key] // test_dict2.get(key, 0)
for key in test_dict1.keys()}
res = {'best': 4, 'gfg': 2, 'is': 3}