I have two dictionaries with the same keys, while the values are variant:
a = {1: [1, 2, 3, 4, 5], 2: [6, 7, 8], 3: [1, 3, 5, 7, 9]}
b = {1: [2, 3, 4, 7], 2: [6, 7], 3: [1, 3, 15, 10]}
I'm trying to get the intersection under the same keys. I want this output:
{1: [2, 3, 4], 2: [6, 7], 3: [1, 3]}
I tried with this command:
dict(zip(a.keys() and b.keys(), a.values() and b.values()))
output: {1: [2, 3, 4, 7], 2: [6, 7], 3: [1, 3, 15, 10]}
However, the output is the following, which is wrong:
{1: [2, 3, 4, 7], 2: [6, 7], 3: [1, 3, 15, 10]}