Skip to content

Instantly share code, notes, and snippets.

@richardbwest
Last active September 10, 2019 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richardbwest/7d781e5bb42100314b5dd8ac70a7420a to your computer and use it in GitHub Desktop.
Save richardbwest/7d781e5bb42100314b5dd8ac70a7420a to your computer and use it in GitHub Desktop.
matching lists code wip
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