class Student(object): def __init__(self, name, score): self.name = name self.score = score def get_grade(self): if self.score >100 or self.score<0: raise ValueError('wrong input') if self.score >= 60 and self.score<=79: return 'B' if self.score >= 80 and self.score<=100: return 'A' else: return 'C'
Sign in to make a reply
邹lh