利用IF进行多分支结构

socore=float(input("socre="))
level=""
if score>100:
    level="超出范围"
elif score>=90:
    level="优秀"
elif score>=80:
    level="良好"
elif score>=70:
    level="中等"
elif score>=60:
    level="及格"
elif score>=0:
    level="不及格"
else:
    level="超出范围"
print("等级:{}".format(level))

Guess you like

Origin blog.csdn.net/m0_62491934/article/details/121149827
Recommended