Last active
September 10, 2019 14:03
-
-
Save richardbwest/7d781e5bb42100314b5dd8ac70a7420a to your computer and use it in GitHub Desktop.
matching lists code wip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=[[9, 15, 25],[4, 14, 18, 25],[11, 12,24, 25],[4, 8, 9, 26]] | |
b=[[2, 4, 7, 13, 14],[3, 5, 8, 13, 14],[6, 9, 10, 13, 14],[5, 6, 7, 13, 15],[3, 4, 9, 13, 15],[2, 8, 12, 13, 15],[4, 6, 8, 14, 15],[2, 5, 9, 14, 15]] | |
#Basically i would like to match 2d list to another 2d list. | |
#Heres the code | |
for idx,values_a in enumerate(a): | |
result = [] | |
for values_b in b: | |
result.append(list(set(values_a) & set(values_b))) | |
print(idx) | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment