第006讲||Pyhon之常用操作符|**与-的优先级|not>and>or
本帖最后由 熊宝宝要当红军 于 2019-8-14 07:50 编辑0,**与-的优先级
例子:
<font size="5">>>> 5**-2
0.04
</font>就是1/25
2,逻辑运算符的优先级
not or and 的优先级是不同的:not > and > or
例题:
not 1 or 0 and 1 or 3 and 4 or 5 and 6 or 7 and 8 and 9
==(not 1) or (0 and 1) or (3 and 4) or (5 and 6) or (7 and 8 and 9)
== 0 or 0 or 4 or 6 or 9
== 4
知识点:短路逻辑(short-circuit logic)详见第4讲
页:
[1]