一、参考解法:
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)