min() function should return the smallest of the numbers given. Then why
min({0},{1})
returns {0}, while
min({1},{0})
returns {1}?
In python sets are compared based on whether or not one is a subset of the other.
None is a subset of the other, so <
gives False
in all cases, so the first one is returned.
So {1}<{0}
gives False
just like {2}<{1}
gives False
and {2}<{3,4,5}
gives False.
However {1,2}<{1,3,2}
gives True
.
This means there is no total order defined on sets.
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