class StudentDoc: def __init__ (self,number,name,major,score): self.number=number self.name=name self.major=major self.score=score def info(self): print(f'{self.number},{self.name},{self.major},{self.score}') def get_score(self): return self.score def change_score(self,change): self.score=change
from student import StudentDoc s1=StudentDoc(110120119,'喀喀喀','耷拉巴拉',0) s2=StudentDoc(119120110,'吼吼吼','猹',1) s1.info() s2.info() print(f'分数:',s1.get_score()) print(f'分数:',s2.get_score()) s1.change_score(100) s2.change_score(100) print(f'分数:',s1.get_score()) print(f'分数:',s2.get_score())