利用python 简单计算学生成绩等级

首先启动软件,因为mac环境所以用Command+N(windows:Ctrl+N)新建文本式交互窗口,再Command+S(windows:Ctrl+S)先保存好位置

接下来开始编辑代码

#计算学生成绩等级

is_continue='y'
while is_continue=='Y' or is_continue=='y': #是否二次计算的yes or no 选择
    score=eval(input('请输入学生的成绩:'))
    if score>=90:
        print('A')
    elif score>=80:
        print('B')
    elif score>=70:
        print('C')
    elif score>=60:
        print('D')
    elif score<60:
        print('E')
    is_continue=input('\n是否继续?(Y/N)') 

 Fn+F5运行后就可以开始计算了

 

 以上就是我对于成绩等级计算的分享了 ,希望大家喜欢。 

猜你喜欢

转载自blog.csdn.net/m0_74436853/article/details/129823649