最新版的,运行正常
class Person(object):
def __init__(self, name, score):
self.name = name
self.score = score
def get_grade(self):
if self.score >= 90 :
return self.name + ':A-优秀'
elif self.score >= 60 :
return self.name + ':B-及格'
else:
return self.name + ':B-不及格'
p1 = Person('Bob', 90)
p2 = Person('Alice', 65)
p3 = Person('Tim', 48)
print(p1.get_grade())
print(p2.get_grade())
print(p3.get_grade())