|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
编写一个成绩评级程序,要求用户输入分数,程序返回对应的评级。&Dydu;
&o`|MQFh8}K$y+^bCIkEjYO_=
分数 < 60,D
60 <= 分数 < 80,C
80 <= 分数 < 90,B
90 <= 分数 < 100,A
分数 == 100,S直至用户输入小写字母 e 结束程序
score = input("请输入你的分数:")
while score != 'e':
score = int(score)
if score < 60:
print("D")
if 60 <= score < 80:
print("C")
if 80 <= score < 90:
print("B")
if 90 <= score < 100:
print("A")
if score == 100:
print("S")
score = input("请输入你的分数:")
这是作业的答案,以下是我写的,为什么我的会报错???我感觉是一样的啊??
score = input("请输入你的分数:")
while score != "e":
if int("score") < 60:
print("D")
if 60 <= int("score") < 80:
print("C")
if 80 <= int("score") < 90:
print("B")
if int("score") == 100:
print("S")
if 90 <= int("score") < 100:
print("A")
score = input("请输入你的分数:")
带了引号就是字符串,就不再是你输入的那个score了
|
|