x = input("请输入你的成绩:") #input your score
try:
x = float(x)
except: ValueError
if type(x)!=type(0.0):
print("输入有误!")
else:
s = x/10
if s > 9:
print("你的成绩为优秀!")
elif s > 8:
print("你的成绩为良好!")
elif s > 7:
print("你的成绩为中等!")
elif s > 6:
print("你的成绩为合格!")
else :
print("你的成绩为差!")
if
elif
else
s>9
7>s>6,>s>7,9>s>8
\
90分以上
60到90分
60分一下
等价于
x = input("请输入你的成绩:") #input your score
try:
x = float(x)
except: ValueError
if type(x)!=type(0.0):
print("输入有误!")
else:
s = x/10
if s > 9:
print("你的成绩为优秀!")
if 9 >= s > 8:
print("你的成绩为良好!")
if 8 >= s > 7:
print("你的成绩为中等!")
if 7 >= s > 6:
print("你的成绩为合格!")
if s < 6 :
print("你的成绩为差!")
等价于
x = input("请输入你的成绩:") #input your score
try:
x = float(x)
except: ValueError
if type(x)!=type(0.0):
print("输入有误!")
else:
s = x/10
if s >= 0:
if s >= 6:
if s >= 7:
if s >= 8:
if s >= 9:
if s <= 10 :
print("你的成绩为优秀!")
else:
print("你的成绩为良好!")
else:
print("你的成绩为中等!")
else:
print("你的成绩为合格!")
else:
print("你的成绩为差!")