- 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.
推薦閱讀
- Java逍遙游記
- 案例式C語言程序設計
- Getting started with Google Guava
- Beginning C++ Game Programming
- PostgreSQL Cookbook
- 新編Premiere Pro CC從入門到精通
- 從學徒到高手:汽車電路識圖、故障檢測與維修技能全圖解
- Python漫游數學王國:高等數學、線性代數、數理統計及運籌學
- Mastering RStudio:Develop,Communicate,and Collaborate with R
- Functional Kotlin
- Go語言精進之路:從新手到高手的編程思想、方法和技巧(1)
- Go語言底層原理剖析
- ExtJS Web應用程序開發指南第2版
- 代替VBA!用Python輕松實現Excel編程
- Android嵌入式系統程序開發(基于Cortex-A8)