一.控制流程之if判断
1、什么是if判断
判断一个条件如果成立则。。。不成立则。。。
2、为何要有if判断
让计算机能够像人一样具有判断能力
3、如何用if判断
'''
# 语法1:
'''
if 条件1:
code1
code2
code3
......
'''
# age=18
# if age != 18:
# print('你好啊小伙子')
# print('加个微信吧...')
# print('other code...') # 语法2:
'''
if 条件:
code1
code2
code3
......
else:
code1
code2
code3
......
'''
# age=18
# sex='male'
# wuzhong='human'
# is_beautiful=True
#
# if age > 16 and age < 22 and sex == 'female' and \
# wuzhong == 'human' and is_beautiful:
# print('开始表白...')
# else:
# print('阿姨好,我逗你玩呢...') # 语法3:
'''
if 条件1:
if 条件2:
code1
code2
code3
code2
code3
......
'''
# age = 18
# sex = 'female'
# wuzhong = 'human'
# is_beautiful = True
# is_successful = True
#
# if age > 16 and age < 22 and sex == 'female' and wuzhong == 'human' and is_beautiful:
# print('开始表白...')
# if is_successful:
# print('在一起')
# else:
# print('阿姨再见....')
# else:
# print('阿姨好,我逗你玩呢...') # 语法4:
'''
if 条件1:
子代码块1
elif 条件2:
子代码块2
elif 条件3:
子代码块3
elif 条件4:
子代码块4
.........
else:
子代码块5
''' score = input('your score>>: ')
score=int(score)
if score >= 90:
print('优秀')
elif score >= 80:
print('良好')
elif score >= 70:
print('普通')
else:
print('很差')