I practice python recently. for a few days my script has stopped, because I'm struggling on a problem. I want to sort the items by both values which has in common. like an chain. as you can see lower.
what I have:
dic= {'A': [62, 17], 'B': [59, 60], 'C': [60, 61], 'D': [57, 58], 'E': [61, 62], 'F': [58, 59]}
what I want:
dic={'A': [62, 17], 'E': [31, 62],'C': [60, 31],'B': [3, 60],'F': [58, 3],'D': [57, 58]}
to see clearly:
'A': [62, 17]
'E': [*31*, 62]
'C': [60, *31*]
'B': [3, 60]
'F': [58, 3]
'D': [57, 58]
there is a simple method to sort them ? if the topic already exists, can you send me the link. i haven't found it. thank you in advance. nb. in all case, I know the first and the last value of the chain (17 and 57)