条件语句
1.
>>> a = 3
>>> b = 4
>>> c = a if a < b else b
>>> print(c)
3
2.
>>> m=4
>>> n=2
>>> ('n', 'm')[m > n]
'm'
实质是索引的使用
3.
>>> m = 4
>>> n = 5
>>> m > n and m or n
5
实质是与或运算
2024-01-19 23:38:28
条件语句
1.
>>> a = 3
>>> b = 4
>>> c = a if a < b else b
>>> print(c)
3
2.
>>> m=4
>>> n=2
>>> ('n', 'm')[m > n]
'm'
实质是索引的使用
3.
>>> m = 4
>>> n = 5
>>> m > n and m or n
5
实质是与或运算