-
两个数字比较:笔记式Python视频精讲【初级篇】
- 浮点比较
>>> a = 2.0
>>> b = 2
>>> a == b 浮点数比较
True
- 三个数字比较
-
>>> a = 2
>>> b = 4
>>> c = 6
>>> a < b < c 三个数字连续比较
True
>>> a < b and b < c 三个数字分开两两比较
True
>>>>>> 1 == 2 < 3
False
>>> 1 == 2 and 2 < 3
False
>>>
>>> a = 2.0
>>> b = 2
>>> a == b 浮点数比较
True
>>> a = 2
>>> b = 4
>>> c = 6
>>> a < b < c 三个数字连续比较
True
>>> a < b and b < c 三个数字分开两两比较
True
>>>>>> 1 == 2 < 3
False
>>> 1 == 2 and 2 < 3
False
>>>