Python Set < (less than) Method
Example
Returns False even if all items in set
x
are present in set y
:
x = {"a", "b", "c"}
y = {"c", "b", "a"}
z = x < y
print(z)
Try it Yourself »
Definition and Usage
The <
returns True if all items in the set exists in a specified larger set, otherwise it returns False.
Syntax
set1 < set2
More Examples
Example
Returns True because all items of set x
is present in the larger set y
:
x = {"a", "b", "c"}
y = {"f", "e", "d",
"c", "b", "a"}
z = x < y
print(z)
Try it Yourself »