boolean_operators.py
来自「python编程很好的入门材料,包括讲义和源码.」· Python 代码 · 共 22 行
PY
22 行
var1 = 10
#-------------------------------------------------------------------------------
# The "and" Operator will only return True if both comparisons return True.
#-------------------------------------------------------------------------------
print var1 == 10 and var1 <= 5
#-------------------------------------------------------------------------------
# The "or" Operator will return True if any of the comparisons returns True.
#-------------------------------------------------------------------------------
print var1 == 20 or var1 >= 5
#-------------------------------------------------------------------------------
# The "not" Operator simply negates or inverts the result of the comparison.
#-------------------------------------------------------------------------------
print not var1 == 10
raw_input( "\nPress Enter to exit..." )
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?