- Python Data Structures and Algorithms
- Benjamin Baka
- 130字
- 2021-07-09 19:45:01
Boolean operations
A Boolean operation returns a value of either True or False. Boolean operations are ordered in priority, so if more than one Boolean operation occurs in an expression, the operation with the highest priority will occur first. The following table outlines the three Boolean operators in descending order of priority:

Both the and operator and the or operator use "short-circuiting" when evaluating an expression. This means Python will only evaluate an operator if it needs to. For example, if x is True then in an expression x or y, the y does not get evaluated since the expression is obviously True. In a similar way, in an expression x and y where x is False, the interpreter will simply evaluate x and return False, without evaluating y.
推薦閱讀
- PaaS程序設(shè)計
- 無代碼編程:用云表搭建企業(yè)數(shù)字化管理平臺
- Visual C++數(shù)字圖像模式識別技術(shù)詳解
- Web全棧工程師的自我修養(yǎng)
- Bootstrap Essentials
- Java Fundamentals
- 快速入門與進(jìn)階:Creo 4·0全實例精講
- 石墨烯改性塑料
- 數(shù)據(jù)分析與挖掘算法:Python實戰(zhàn)
- Mastering SciPy
- Using Yocto Project with BeagleBone Black
- FusionCharts Beginner’s Guide:The Official Guide for FusionCharts Suite
- Design Patterns and Best Practices in Java
- Visual FoxPro程序設(shè)計實驗教程
- C/C++語言程序開發(fā)參考手冊