python 链状比拟操纵符

python 链状比拟操纵符

Python不必很多前提一个一个写,比拟操纵符不妨会合。

n = 10

result = 1 < n < 20

print(result)

# True

result = 1 > n <= 9

print(result)

# False

分享到 :
相关推荐

Leave a Reply

Your email address will not be published. Required fields are marked *