Question: please use python 5. [1] Given two dictionaries d1 and d2, create a new dictionary d3 according to the fol- lowing rule (think of transitivity):
![please use python 5. [1] Given two dictionaries d1 and d2,](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f51f3de3823_34966f51f3d81b25.jpg)

please use python
5. [1] Given two dictionaries d1 and d2, create a new dictionary d3 according to the fol- lowing rule (think of transitivity): the entry a:c is in d3 if and only if there is an entry a:b in d1, and an entry b:c in d2. For instance: if d1={2 : 3; 8 : 19; 6 : 4; 5 : 3} and d1={2 : 5; 4 : 3; 3 : 9} your code should create the dictionary d3={2 : 9; 6 : 3; 5: 9}. #Question 5 def transitive_dict(di, d2): "create a dictionary by transitivity print(transitive_dict({2:3, 8:19, 6:4, 5:3},{2:5, 4:3, 3:9})) #should return {2:9, 6: 3, 5: 9} print(transitive_dict({2:3, 6:4, 5:3},{2:5, 6:9})) #should return empty dictionary print(transitive_dict({2:3, 3:3, 4:3},{3:2, 5:3, 6:9})) #should return {2: 2, 3: 2, 4: 2}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
