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,create a new dictionary d3 according to the fol- lowing rule (think

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!