if语句的一般形式:
if condition1:
statement1
elif condition2:
statement2
else:
statement3
if语句可嵌套:
a = 2 if a < 10: if a < 5: print('small') elif a >= 5: print('medium') elif a >= 10: print('big')
结果为:
small
原创文章,作者:1402239773,如若转载,请注明出处:https://blog.ytso.com/244423.html