首页 Python基础入门视频教程 Python if...elif...else...多条件并列判断语句用法判断-多分支判断
pay pay

Python if...elif...else...多条件并列判断语句用法判断-多分支判断

日期: 二月 14, 2023, 7:17 a.m.
阅读: 481
作者: Python自学网-村长

摘要: 判断-多分支判断

'''案例:成绩判断-不及格、及格、良好、优秀、满分'''
score = input('你的分数是:')

if int(score) <= 60:  # 冒号和换行缩进
    print('你的分数是{},不及格!'.format(score))
elif 60 <= int(score) < 70:
    print('你的分数是{},及格!'.format(score))
elif 70 <= int(score) < 80:
    print('你的分数是{},良好!'.format(score))
elif 80 <= int(score) < 100:
    print('你的分数是{},优秀!'.format(score))
else:
    print('你的分数是{},满分!'.format(score))

print('***语句结束***')

 

原创视频,版权所有,未经允许,切勿转载,违者必究!
回顶部