本文来介绍if -elif-else语句,直接以下例子。
# 这里介绍 if elif else语句
x = 5
y = 8
z = 15
if x > y:
print('x is greater than y')
elif x < z:
print('x is less than z')
else:
print('上面的if 和elfi 语句都不会被执行的时候,才会到这里执行代码')
本文来介绍if -elif-else语句,直接以下例子。
# 这里介绍 if elif else语句
x = 5
y = 8
z = 15
if x > y:
print('x is greater than y')
elif x < z:
print('x is less than z')
else:
print('上面的if 和elfi 语句都不会被执行的时候,才会到这里执行代码')