Let's say I have 2 lists, list 1 and list 2 such that( for example)
l1 = ['w1','w2','w3','w4','w5']
l2 = ['w6','w7','w8']
Is there a short and sweet way to get a new list (size 4) containing words from both lists such that there is at least one word from each list? (No repetition)
Possible results
['w6','w2','w4','w8']
['w2','w8','w7','w4']
['w1','w2','w6','w4']
['w2','w3','w1','w7']
Aucun commentaire:
Enregistrer un commentaire