python—计算学生成绩等级

一、打开软件 新建窗口 输入代码

#计算学生成绩等级
 
is_continue='y'
while is_continue=='Y' or is_continue=='y':
    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)') 

二、运行代码(F5) 结果如下

请输入学生的成绩:80
B

是否继续?(Y/N)Y
请输入学生的成绩:90
A

是否继续?(Y/N)Y
请输入学生的成绩:

希望你喜欢今天的自己

你可能感兴趣的:(python)