Learn Before
Concept
isdisjoint(set)
x.isdisjoint(y) method returns True if no items in set x are present in set y.
colors = {"red", "yellow", "orange"} fruits = {"apple", "banana", "orange"} cars = {"Toyota", "Honda", "Audi"} x = colors.isdisjoint(fruits); // x = False y = colors.isdisjoint(cars); // y = True
x is set to False as the colors and fruits sets share a common element (orange). y is set to True as the colors and cars sets have no shared elements.
0
1
Updated 2021-05-31
Tags
Python Programming Language
Data Science