# 在 Python 中的链式比较运算符

Isaac Tony 2022年5月17日

``````x = 5
y = 7
z = 10

if y > x and z > y:
print("z is the greatest number")
else:
print("z is not the greatest number")
``````

``````z is the greatest number
``````

``````x = 5
y = 7
z = 10

if x < z > y:
print("z is the greatest number")
else:
print("z is not the greatest number")
``````

``````z is the greatest number
``````

``````length = 23
height = 23
width = 6

if length == height and height == width and width == length:
print("This is a cube")

else:
print("This is a cuboid")
``````

``````This is a cuboid
``````

``````if length == height == width:
print("This is a cube ")

else:
print("This is a cuboid ")
``````

``````This is a cuboid
``````

``````a = 3
b = 5
c = 9

if a == b == c:
print("All the variables are equal")
else:
print("Variable are not the same")
``````

``````Variable are not the same
``````

``````a = 3
b = 5
c = 9
d = 11
e = 13

if a < b < c < d < e:
print("This is an ascending sequence of numbers")
else:
print("This is not an ascending sequence of numbers")
``````

``````This is an ascending sequence of numbers
``````

Isaac Tony is a professional software developer and technical writer fascinated by Tech and productivity. He helps large technical organizations communicate their message clearly through writing.