|
程序分析:(a>b)?a:b这是条件运算符的基本例子
def scoreOfStudent(self, score):
score = float(score)
if score >= 90:
print("成绩为:%s" % ("A"))
elif score >= 60: # 在这种情况下,二者等效score >= 60 and score < 89
print("成绩为:%s" % ("B"))
else:
print("成绩为:%s" % ("C"))
input the number:
60.1
成绩为:B
|