Comparing two sets in python
问题 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? 回答1: 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,