一、參考解法:
score = int(input('輸入分數:'))
print("A" if score>89 else('B' if score>59 else 'C'))
二、參考解法:
while 1:
score = int(input('輸入分數:'))
mark = [90,60,0]
result=['A','B','C']
for i in range(0,3):
if score>=mark[i]:
print('%d屬於:%s'%(score,result[i]))
break
三、參考解法:
def grade(score):
if score >=90:
print("A")
elif score>=60:
print("B")
else:
print("C")
while 1:
score = int(input('輸入分數:'))
grade(score)
