Transforming a list of list
I have two lists :
l1=[([๐ฐ,๐ฑ],๐ฐ),([๐ฐ,๐ฒ],๐ฒ),([๐ฑ,๐ฒ],๐ฑ)]
l2=[[33,27],[25,35],[42,18]]
This two list must be read like this ([A, B], A) : A win in the duel with B and the score are 33 for A and 27 for B. I would like to transfer this information in a table or a matrix such that in line one has the score of each duelist against the others that is :
A = [[0,33,25],[27,0, 42],[35,18,0]]
of course this is an example. The solution must be generic. In the time I have tried to find an elegant solution, I have encountered the following problem : how to remove Rien from all the sublist in :
l3=[[33,๐๐๐๐,25,๐๐๐๐,๐๐๐๐,๐๐๐๐],[๐๐๐๐,27,๐๐๐๐,๐๐๐๐,42,๐๐๐๐],[๐๐๐๐,๐๐๐๐,๐๐๐๐,35,๐๐๐๐,18]]
and insert the 0according to the A matrix. Thanks for your help.
Please provide self-contained code that can be copied and pasted.
Currently, we get name errors, as neither
A,B,C,Rienare defined.Calling
Athe table or matrix when one of the duelists is alsoAseems error-prone.