1个回答
展开全部
#!/usr/bin/python
# -*- coding:utf-8 -*-
def lev(num):
atype = isinstance(num, (int, float, long))
if atype is True:
if 90 <= num <= 100:
return 'A'
elif 80 <= num < 90:
return 'B'
elif 70 <= num < 80:
return 'C'
elif 60 <= num < 70:
return 'D'
elif num < 60:
return 'E'
else:
return '请输入正确分数'
if __name__ == '__main__':
student_num,anum = input(u'请输入学生学号及考试成绩,以英文逗号相隔:')
result = lev(anum)
if result not in 'ABCDE':
print result
else:
print u'学生{0}的成绩的等级是:{1}'.format(student_num, result)
更多追问追答
追问
运行出来乱码
追答
你什么环境?不行就把中文前面的u去掉
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询