1分で学ぶPython|isdisjoint()の使い方

Home Set Methods

isdisjoint()の例1

Return True if no items in set
  x is present in set y:

    x = {"apple", "banana", "cherry"}y = {"google", "microsoft", "facebook"}
z = x.isdisjoint(y) print(z)

isdisjoint()の定義及び使い方

isdisjoint()関数は、存在しない場合Trueを返します。 がある場合はFalseを返します。

isdisjoint()の構文

set.isdisjoint(set)

isdisjoint()の引数

パラメータ 説明

set 必須. The set to search for equal items in

Example

What if no items are present in both sets?
Return False if one ore more items are present in both sets:

    x = 
    {"apple", "banana", "cherry"}
y = {"google", 
    "microsoft", "apple"}z = x.isdisjoint(y)
    print(z)

Home Set Methods

Last Updated: 7/27/2019, 11:23:37 AM