读入一个考试得分,判断这个分数是哪个等级,并输出。
等级:》=90 优 ,>=80且小于90 良,》=70 且小于80,中,》=60且<70及格
《60 不及格
覆盖场景:
考虑字符类型(str,float)
数字范围(0-100)以外的
小数98.99等
代码:
#encoding=utf-8
while True:
try:
score = raw_input("input the score,'exit' to stop: >>:")
#print type(score)
#print isinstance(score,str)
if "exit" in score:
break
else:
score = float(score)
print "score:",score
if score >= 90 and score <=100: