I have a dictionary which has values as follows:
dictionary = {(10,9): 1, (44,11): 2, (1,1): 99}
Basically my keys are pairs of integers and the values of each key are just integers.
I have an array which stores a set of keys:
array = [(1,1), (5,19), (58,7)]
I would like to filter my dictionary to contain only elements which keys are stored in the array. In my case, after filtering the dictionary I would obtain the following:
dictionary = {(1,1): 99}
since the only key of the dictionary which is stored in the array is (1,1)
What would be the most efficient way to do this?