条件判断if
一、if条件判断结构
1.单分支
if condition :
statement1
etc
2.双分支
if condition :
statement1
etc
else :
statement1
etc
3.if-else嵌套
4.多分支
if condition :
statement1
etc
elif condition :
statement1
etc
else :
statement1
etc
example:
二、条件判断
1.布尔表达式(0-1)
非0即真
example1:
注:当条件判断为一个字符串时,布尔值为True
2.关系表达式
>,<,>=,<=,==,!=......
example:
3.逻辑表达式
and,or,not
example: