Hi guys,i have a doubt regarding comparing two sets
>>> 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
In the above logic,for both z=x<y and z=x>y
. I'm getting output as False,whereas one of the expression should return True. Could anyone explain me why?
The
<
and>
operators are testing for strict subsets. Neither of those sets is a subset of the other.When working with sets, > and < are relational operators. hence, these operations are used to see if one set is the proper subset of the other, which is False for as neither is the proper subset of the other.
Straight from the python documentation --