temp = ‘32‘ if temp > 85: print "Hot" elif temp > 62: print "Comfortable" else: print "Cold"
结果输出为Hot.
Why?
Essentially, "...the choice whether one object is considered smaller or larger than another one is made arbitrarily but consistently" means that when comparing objects of different types (ex. string with an int) the choice of which to always be larger was made arbitrarily. In this case, any string is always bigger than any int.
时间: 2024-10-13 10:06:07