Jul-09-2020, 03:51 AM
(This post was last modified: Jul-09-2020, 04:05 PM by deanhystad.)
What does set_a > set_b even mean? Lists and tuples compare element by element, but since a tuple has no order, it makes no sense to compare elements. You say "distinct token total", but what does that mean? setA > setB if setA has more things? That is not the basis of comparison for any of the other collection types.
To be honest I am surprised that > and < don't throw an error when used with sets. The result is meaningless. Try this:
To be honest I am surprised that > and < don't throw an error when used with sets. The result is meaningless. Try this:
x = {'a', 'b', 'c', 'd', 'e'} y = {'f', 'd', 'c', 'b', 'a'} print(x > y) print(y > x) print(x == y)Equal works if both sets have the same elements, but the code above returns:
Output:False
False
False