Vote count:
0
I have two lists:
A = [[2, 5, 13, 14], [4, 5, 10, 12], [2, 9, 10, 11], [2, 5, 12, 13], [4, 5, 6, 12]]
B = [12, 5]
I'm trying to find out which lists in A contain the elements in B (order doesn't matter) and get rid of the rest of the lists.
In this case the answers is:
[[4, 5, 10, 12], [2, 5, 12, 13], [2, 5, 12, 13]]
If we change B and make it B = [13], the answer would be:
[[2, 5, 13, 14], [2, 5, 12, 13]]
asked 1 min ago
How to find out if the elements in one list are in another?
Aucun commentaire:
Enregistrer un commentaire