class Student(object): def __init__(self, name: str, score: int = 0): self.name = name self.score = score def print_score(self): print('Student %s\t\tScore:%s' % (self.name, self.score)) def get_grade(self): if self.score >= 90: return 'A' elif self.score >= 80: return 'B' else: return 'C'student = Student('Arbee')student2 = Student('Norzen', 123)s_class = Student.__class__print(student.__class__ == s_class)print(s_class)print(student)student.print_score()student.name = 'fevfafdszs'print(student.name)student.print_score()student2.print_score()print(student2.get_grade())
Sign in to make a reply
蝶殇/yl待月