Python Set isdisjoint() 메서드
예시
x
세트의 항목이 세트 에 없으면 True 반환
y
:
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "facebook"}
z = x.isdisjoint(y)
print(z)
정의 및 사용
이 isdisjoint()
메서드는 두 세트에 항목이 모두 없으면 True를 반환하고, 그렇지 않으면 False를 반환합니다.
통사론
set.isdisjoint(set)
매개변수 값
Parameter | Description |
---|---|
set | Required. The set to search for equal items in |
더 많은 예
예시
두 세트 모두에 항목이 없으면 어떻게 됩니까?
두 세트에 하나 이상의 항목이 있으면 False를 반환합니다.
x =
{"apple", "banana", "cherry"}
y = {"google",
"microsoft", "apple"}
z = x.isdisjoint(y)
print(z)