Why do I get the results shown?
>>> x = {"a","b","1","2","3"}
>>> y = {"c","d","f","2","3","4"}
>>> z=x<y
>>> print(z)
False
>>> z=x>y
>>> print(z)
False
The <
and >
operators are testing for strict subsets. Neither of those sets is a subset of the other.
{1, 2} < {1, 2, 3} # True
{1, 2} < {1, 3} # False
{1, 2} < {1, 2} # False -- not a *strict* subset
{1, 2} <= {1, 2} # True -- is a subset
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With