Python 比較演算子



Python 比較演算子


5.9 比較 (comparison) 
http://www.python.jp/doc/release/ref/comparisons.html


if (0 < x < 10):


という記述が出来るみたい。



>>> x =5
>>> 0 < x < 10
True
>>> x = 10
>>> 0 < x < 10
False
>>> x = 1
>>> 0 < x < 10
True
>>> x = 0
>>> 0 < x < 10
False


知らんかった。
これは便利。



もどる