I have a question and it is a bit hard for me to explain so I will be using lots of examples to help you all understand and see if you could help me.
Say I have two lists containing book names from best to worst rated by two people. User1 rated lstA
, and user2 rated lstB
lstA = ['Harry Potter','1984','50 Shades','Dracula']
lstB = ['50 Shades','Dracula','1984','Harry Potter']
User one thinks 'Harry Potter' is better than 'Dracula' (HP is index 0, and Dracula is index 3)
User two thinks 'Harry Potter' is worse than Dracula, (HP is index 3 and Dracula is index 1)
In this case, return a tuple ('Harry Potter', 'Dracula')
[('Dracula', 'Harry Potter')
is also fine]
User one also rated '50 shades' better than 'Dracula' and user two also rated '50 shades' better than 'Dracula' (index 2, 3 and 0, 1 respectively). In this case, nothing happens.
The final result of the program should return a list of tuples so,
[('Harry Potter','50 Shades'), ('Harry Potter','Dracula'), ('Harry Potter','1984'), ('1984', '50 Shades'), ('1984','Dracula')]
Could someone help me to point me in the right direction to come up with an algorithm that gives all the tuples?