发布网友 发布时间:2022-04-29 17:08
共4个回答
热心网友 时间:2022-04-18 19:37
x <= y <= z这句在语法上是没有错误的,但在逻辑上会出问题。x会先和y进行比较,结果是布尔值,当x小于等于y时结果是1,当x大于y时结果是0,然后1或者0再和z进行比较,这就有问题了。
热心网友 时间:2022-04-18 20:55
python语法认为条件x<=y<=z是合法的热心网友 时间:2022-04-18 22:30
Comparisons can be chained arbitrarily, e.g., x < y <= z is
equivalent to x < y and y <= z, except that y is
evaluated only once (but in both cases z is not evaluated at all
when x < y is found to be false).
网页链接
热心网友 时间:2022-04-19 00:21
错了,执行不出来