Skip to content

Instantly share code, notes, and snippets.

@hxer
Created February 21, 2016 07:55
Show Gist options
  • Save hxer/b86cff5c285761f23e51 to your computer and use it in GitHub Desktop.
Save hxer/b86cff5c285761f23e51 to your computer and use it in GitHub Desktop.
判断两个集合是否有交集
def is_intersection(a, b):
'''
input:
a = [1, 2, 3]
b = [3, 6, 9]
output:
True
'''
return any(_ in a for _ in b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment