This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
您似乎已经混合了不平等运营商的方向。
当Python看到
x = 7&lt时; 5
,它找到了不等式的真实价值7< 5
并将其分配给x
。 7 不小于5,因此语句7< 5
是false
。因此,python说x = false
。x = 7&gt的反向是正确的。 5
。 7 IS 大于5,所以7> 5
是true
和x = true
。记住鳄鱼法:< and>就像一个饥饿的鳄鱼,寻找可以吃的食物最多的食物,因此它将指向较大的价值并远离较小的食物。
You seem to have mixed up the direction of the inequality operators.
When Python sees
x = 7 < 5
, it finds the truth value of the inequality7 < 5
and assigns it tox
. 7is not less than 5, so the statement7 < 5
isFalse
. So Python saysx = False
.The reverse is true of
x = 7 > 5
. 7 is greater than 5, so7 > 5
isTrue
andx = True
.Remember the alligator method: < and > are like a hungry alligator looking for the most food it can eat, so it will point toward the larger value and away from the smaller.
这不应该是真的。 7不小于5,因此评估为错误。
It should not be true. 7 is not less than 5, and therefore evaluates to False.