In Python3 I have a list of tuples as below
('A', object1)
('B', object5)
('B', object3)
('D', object2)
('E', object3)
('F', object1)
('G', object1)
I want to take two random elements from the tuple such that the first and second element of the first random tuple are different that the first and second element of the second random tuple. I.e., I can select from the above list ('A', object1) and ('B', object5)
, but I cannot select ('F', object1) and ('G', object1)
or ('B', object5) and ('B', object3)
.
Aucun commentaire:
Enregistrer un commentaire