小结 ex29-31:判断
ex29:如果(if)
概念:区段
if people < 3:
print "Too many cats! The world is doomed!"
为什么if语句的下一行需要4个空格的缩进?
如果不缩进,会报错:expected an indented block
ex30:习题 30: Else 和 If
if x > y:
语块1
elif x < y:
语块2
else:
语块3
ex31:作出决定
if语句的嵌套
...
if door == "1":
x= input("> ")
if x== "1":
语块
elif x== "2":
语块
else:
语块
elif door == "2":
y= input("> ")
if y== "1" or y== "2":
语块
else:
语块
else:
语块
...