Write a Python program to match key values in two dictionaries.


Topic: Write a Python program to match key values in two dictionaries.

Solution

x = {'key1': 1, 'key2': 3, 'key3': 2}
y = {'key1': 1, 'key2': 2}
for (key, value) in set(x.items()) & set(y.items()):
print('%s: %s is present in both x and y' % (key, value))



List all Python Programs