Python 逻辑运算符
Python 逻辑运算符
逻辑运算符用于组合条件语句
运算符 | 描述 | 示例 | 尝试一下 |
---|---|---|---|
and | 如果两个语句都为真,则返回 True | x < 5 and x < 10 | 尝试一下 » |
or | 如果其中一个语句为真,则返回 True | x < 5 or x < 4 | 尝试一下 » |
not | 反转结果,如果结果为真则返回 False | not(x < 5 and x < 10) | 尝试一下 » |
If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]
If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]