Source Code:
(back to article)
list1 = [1, 2, 3] list2 = [3, 4, 5] set1 = set(list1) set2 = set(list2) if set1.intersection(set2): print("The two lists have at least one common element.") else: print("The two lists do not have any common elements.")
Result:
Report an issue