Python 嵌套 If
If 包含 If
您可以在 if 语句中包含 if 语句,这称为 嵌套if 语句。
实例
x = 41
if x > 10:
print("Above ten,")
if x > 20:
print("and
also above 20!")
else:
print("but not
above 20.")
亲自试一试 »
您可以在 if 语句中包含 if 语句,这称为 嵌套if 语句。
x = 41
if x > 10:
print("Above ten,")
if x > 20:
print("and
also above 20!")
else:
print("but not
above 20.")
亲自试一试 »
