'''
if elif else条件判断语句,也就是谁成立也就是为True,就会执行谁下面缩进的代码,就像生活中我们做的一些事,
比如这个周日,不加班,去出完,加班了,那就加完班晚上吃大大餐,就是会选择一条路去走。
注意:代码缩进,要么用Tab键缩进,要么用4个空格缩进
if (hello > 8):
print ("hello大于8")
print ("1")
这里两个print从缩进可以看出所属if (hello > 8):
'''
hello = 100
hi = 80
if (hello > 8): #hello值为100,这里hello>8结果True,因此就会打印下面print:hello大于8
print ("hello大于8")
print ("1")
hello = 6 #把hello的值修改为6
if (hello > 8): #这里hello>8结果False,因此就会不打印下面print
print ("hello大于8")
elif (hello > 7): #这里hello>7结果False,因此就会不打印下面print
print ("hello大于7")
else: #else这里就是以上if elif 都不成立就会进来,因此打印了下面print:你好
print ("你好")
print ("2")
'''
输出结果:
hello大于8
1
你好
2
'''