[Tutor] consider a problem of finding if two lists have any item in common
Manprit Singh
manpritsinghece at gmail.com
Sun Mar 21 03:15:18 EDT 2021
Dear sir ,
take two lists
lst1 = [2, 4, 6, 9]
lst2 = [2, 5, 9, 0]
this can be done using isdisjoint(other), it will return True if the lists
have no items in common .The official documentation says nothing about
other , just need to know if other can be an iterable or it should strictly
be a set or frozenset?
what should be the correct way ?
This
set(lst1).isdisjoint(set(lst2))
Or This
set(lst1).isdisjoint(lst2)
Regards
Manprit Singh
More information about the Tutor
mailing list